[fix][batched grid docs]

pull/1072/head
Kye Gomez 1 month ago
parent fdf037b965
commit 5ceef024ea

@ -113,22 +113,33 @@ Internal method that runs the workflow without error handling.
### Basic Usage ### Basic Usage
```python ```python
from swarms.structs.batched_grid_workflow import BatchedGridWorkflow
from swarms import Agent from swarms import Agent
from swarms.structs.batched_grid_workflow import BatchedGridWorkflow
# Create agents # Initialize the ETF-focused agent
agent1 = Agent(model="gpt-4", system_prompt="You are a helpful assistant") agent = Agent(
agent2 = Agent(model="gpt-4", system_prompt="You are a creative writer") agent_name="ETF-Research-Agent",
agent_description="Specialized agent for researching, analyzing, and recommending Exchange-Traded Funds (ETFs) across various sectors and markets.",
# Create workflow model_name="claude-sonnet-4-20250514",
workflow = BatchedGridWorkflow( dynamic_temperature_enabled=True,
agents=[agent1, agent2], max_loops=1,
max_loops=1 dynamic_context_window=True,
) )
# Execute tasks
tasks = ["Write a poem about nature", "Analyze market trends"] # Create workflow with default settings
workflow = BatchedGridWorkflow(agents=[agent, agent])
# Define simple tasks
tasks = [
"What are the best GOLD ETFs?",
"What are the best american energy ETFs?",
]
# Run the workflow
result = workflow.run(tasks) result = workflow.run(tasks)
print(result)
``` ```
### Multi-Loop Execution ### Multi-Loop Execution

@ -11,6 +11,7 @@ from swarms.prompts.multi_agent_collab_prompt import (
) )
from swarms.structs.agent import Agent from swarms.structs.agent import Agent
from swarms.structs.agent_rearrange import AgentRearrange from swarms.structs.agent_rearrange import AgentRearrange
from swarms.structs.batched_grid_workflow import BatchedGridWorkflow
from swarms.structs.concurrent_workflow import ConcurrentWorkflow from swarms.structs.concurrent_workflow import ConcurrentWorkflow
from swarms.structs.council_as_judge import CouncilAsAJudge from swarms.structs.council_as_judge import CouncilAsAJudge
from swarms.structs.groupchat import GroupChat from swarms.structs.groupchat import GroupChat
@ -396,6 +397,7 @@ class SwarmRouter:
"MultiAgentRouter": self._create_multi_agent_router, "MultiAgentRouter": self._create_multi_agent_router,
"SequentialWorkflow": self._create_sequential_workflow, "SequentialWorkflow": self._create_sequential_workflow,
"ConcurrentWorkflow": self._create_concurrent_workflow, "ConcurrentWorkflow": self._create_concurrent_workflow,
"BatchedGridWorkflow": self._create_batched_grid_workflow,
} }
def _create_heavy_swarm(self, *args, **kwargs): def _create_heavy_swarm(self, *args, **kwargs):
@ -427,6 +429,16 @@ class SwarmRouter:
*args, *args,
**kwargs, **kwargs,
) )
def _create_batched_grid_workflow(self, *args, **kwargs):
"""Factory function for BatchedGridWorkflow."""
return BatchedGridWorkflow(
name=self.name,
description=self.description,
agents=self.agents,
max_loops=self.max_loops,
)
def _create_malt(self, *args, **kwargs): def _create_malt(self, *args, **kwargs):
"""Factory function for MALT.""" """Factory function for MALT."""

Loading…
Cancel
Save