Merge pull request #1245 from hughiwnl/linear_removal

Linear removal
master
Kye Gomez 1 day ago committed by GitHub
commit 871bc77713
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -24130,7 +24130,6 @@ flowchart LR
- Maintains strict ordering of task processing - Maintains strict ordering of task processing
### Star Swarm ### Star Swarm
```python ```python
def star_swarm(agents: AgentListType, tasks: List[str], return_full_history: bool = True) def star_swarm(agents: AgentListType, tasks: List[str], return_full_history: bool = True)
@ -24364,7 +24363,6 @@ flowchart TD
## Common Use Cases ## Common Use Cases
1. **Data Processing Pipelines** 1. **Data Processing Pipelines**
- Linear Swarm
- Circular Swarm - Circular Swarm
2. **Distributed Computing** 2. **Distributed Computing**

@ -294,7 +294,6 @@ flowchart TD
## Common Use Cases ## Common Use Cases
1. **Data Processing Pipelines** 1. **Data Processing Pipelines**
- Linear Swarm
- Circular Swarm - Circular Swarm
2. **Distributed Computing** 2. **Distributed Computing**

@ -106,7 +106,6 @@ def grid_swarm(
return history_output_formatter(conversation, output_type) return history_output_formatter(conversation, output_type)
# Star Swarm: A central agent first processes all tasks, followed by others # Star Swarm: A central agent first processes all tasks, followed by others
def star_swarm( def star_swarm(
agents: AgentListType, agents: AgentListType,

@ -119,60 +119,6 @@ class CircularSwarm(BaseSwarm):
return self._format_return() return self._format_return()
class LinearSwarm(BaseSwarm):
"""
Implements a linear swarm where agents process tasks sequentially.
"""
def __init__(
self,
agents: AgentListType,
name: str = "LinearSwarm",
description: str = "A linear swarm where agents process tasks sequentially",
output_type: str = "dict",
):
"""
Initialize the LinearSwarm.
Args:
agents: List of Agent objects or nested list of Agent objects
name: Name of the swarm
description: Description of the swarm's purpose
output_type: Type of output format, one of 'dict', 'list', 'string', 'json', 'yaml', 'xml', etc.
"""
super().__init__(agents, name, description, output_type)
def run(self, tasks: List[str]) -> Union[Dict, List, str]:
"""
Run the linear swarm with the given tasks
Args:
tasks: List of tasks to be processed
Returns:
Union[Dict, List, str]: The conversation history in the requested format
"""
if not self.agents or not tasks:
raise ValueError(
"Agents and tasks lists cannot be empty."
)
tasks_copy = tasks.copy()
responses = []
for agent in self.agents:
if tasks_copy:
task = tasks_copy.pop(0)
response = agent.run(task)
self.conversation.add(
role=agent.agent_name,
content=response,
)
responses.append(response)
return self._format_return()
class StarSwarm(BaseSwarm): class StarSwarm(BaseSwarm):
""" """
Implements a star swarm where a central agent processes all tasks, followed by others. Implements a star swarm where a central agent processes all tasks, followed by others.

Loading…
Cancel
Save