Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions docs/llm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24130,31 +24130,6 @@ flowchart LR

- Maintains strict ordering of task processing

### Linear Swarm
```python
def linear_swarm(agents: AgentListType, tasks: List[str], return_full_history: bool = True)
```

**Information Flow:**
```mermaid
flowchart LR
Input[Task Input] --> A1
subgraph Sequential Processing
A1((Agent 1)) --> A2((Agent 2))
A2 --> A3((Agent 3))
A3 --> A4((Agent 4))
A4 --> A5((Agent 5))
end
A5 --> Output[Final Result]
```

**Best Used When:**

- Tasks need sequential, pipeline-style processing

- Each agent performs a specific transformation step

- Order of processing is critical

### Star Swarm
```python
Expand Down Expand Up @@ -24420,7 +24395,6 @@ from swarms.structs.swarming_architectures import (
exponential_swarm,
fibonacci_swarm,
grid_swarm,
linear_swarm,
mesh_swarm,
one_to_three,
prime_swarm,
Expand Down Expand Up @@ -24528,29 +24502,6 @@ def run_healthcare_grid_swarm():
print("\nGrid swarm processing completed")
print(result)

def run_finance_linear_swarm():
"""Loan approval process using linear swarm"""
print_separator()
print("FINANCE - LOAN APPROVAL PROCESS (Linear Swarm)")

agents = create_finance_agents()[:3]
tasks = [
"Review loan application and credit history",
"Assess risk factors and compliance requirements",
"Generate final loan recommendation"
]

print("\nTasks:")
for i, task in enumerate(tasks, 1):
print(f"{i}. {task}")

result = linear_swarm(agents, tasks)
print("\nResults:")
for log in result['history']:
print(f"\n{log['agent_name']}:")
print(f"Task: {log['task']}")
print(f"Response: {log['response']}")

def run_healthcare_star_swarm():
"""Complex medical case management using star swarm"""
print_separator()
Expand Down Expand Up @@ -24684,7 +24635,6 @@ async def run_all_examples():

# Finance examples
run_finance_circular_swarm()
run_finance_linear_swarm()
run_finance_mesh_swarm()
run_mathematical_finance_swarms()

Expand Down
51 changes: 0 additions & 51 deletions docs/swarms/examples/unique_swarms.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,32 +61,6 @@ flowchart LR

- Maintains strict ordering of task processing

### Linear Swarm
```python
def linear_swarm(agents: AgentListType, tasks: List[str], return_full_history: bool = True)
```

**Information Flow:**
```mermaid
flowchart LR
Input[Task Input] --> A1
subgraph Sequential Processing
A1((Agent 1)) --> A2((Agent 2))
A2 --> A3((Agent 3))
A3 --> A4((Agent 4))
A4 --> A5((Agent 5))
end
A5 --> Output[Final Result]
```

**Best Used When:**

- Tasks need sequential, pipeline-style processing

- Each agent performs a specific transformation step

- Order of processing is critical

### Star Swarm
```python
def star_swarm(agents: AgentListType, tasks: List[str], return_full_history: bool = True)
Expand Down Expand Up @@ -351,7 +325,6 @@ from swarms.structs.swarming_architectures import (
exponential_swarm,
fibonacci_swarm,
grid_swarm,
linear_swarm,
mesh_swarm,
one_to_three,
prime_swarm,
Expand Down Expand Up @@ -459,29 +432,6 @@ def run_healthcare_grid_swarm():
print("\nGrid swarm processing completed")
print(result)

def run_finance_linear_swarm():
"""Loan approval process using linear swarm"""
print_separator()
print("FINANCE - LOAN APPROVAL PROCESS (Linear Swarm)")

agents = create_finance_agents()[:3]
tasks = [
"Review loan application and credit history",
"Assess risk factors and compliance requirements",
"Generate final loan recommendation"
]

print("\nTasks:")
for i, task in enumerate(tasks, 1):
print(f"{i}. {task}")

result = linear_swarm(agents, tasks)
print("\nResults:")
for log in result['history']:
print(f"\n{log['agent_name']}:")
print(f"Task: {log['task']}")
print(f"Response: {log['response']}")

def run_healthcare_star_swarm():
"""Complex medical case management using star swarm"""
print_separator()
Expand Down Expand Up @@ -615,7 +565,6 @@ async def run_all_examples():

# Finance examples
run_finance_circular_swarm()
run_finance_linear_swarm()
run_finance_mesh_swarm()
run_mathematical_finance_swarms()

Expand Down
26 changes: 0 additions & 26 deletions examples/multi_agent/utils/unique_swarms_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
exponential_swarm,
fibonacci_swarm,
grid_swarm,
linear_swarm,
mesh_swarm,
one_to_three,
prime_swarm,
Expand Down Expand Up @@ -121,30 +120,6 @@ def run_healthcare_grid_swarm():
print(result)


def run_finance_linear_swarm():
"""Loan approval process using linear swarm"""
print_separator()
print("FINANCE - LOAN APPROVAL PROCESS (Linear Swarm)")

agents = create_finance_agents()[:3]
tasks = [
"Review loan application and credit history",
"Assess risk factors and compliance requirements",
"Generate final loan recommendation",
]

print("\nTasks:")
for i, task in enumerate(tasks, 1):
print(f"{i}. {task}")

result = linear_swarm(agents, tasks)
print("\nResults:")
for log in result["history"]:
print(f"\n{log['agent_name']}:")
print(f"Task: {log['task']}")
print(f"Response: {log['response']}")


def run_healthcare_star_swarm():
"""Complex medical case management using star swarm"""
print_separator()
Expand Down Expand Up @@ -287,7 +262,6 @@ async def run_all_examples():

# Finance examples
run_finance_circular_swarm()
run_finance_linear_swarm()
run_finance_mesh_swarm()
run_mathematical_finance_swarms()

Expand Down
2 changes: 0 additions & 2 deletions swarms/structs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
geometric_swarm,
grid_swarm,
harmonic_swarm,
linear_swarm,
log_swarm,
mesh_swarm,
one_to_one,
Expand Down Expand Up @@ -128,7 +127,6 @@
"geometric_swarm",
"grid_swarm",
"harmonic_swarm",
"linear_swarm",
"log_swarm",
"mesh_swarm",
"one_to_one",
Expand Down
43 changes: 0 additions & 43 deletions swarms/structs/swarming_architectures.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,49 +107,6 @@ def grid_swarm(
return history_output_formatter(conversation, output_type)


# Linear Swarm: Agents process tasks in a sequential linear manner
def linear_swarm(
agents: AgentListType,
tasks: List[str],
output_type: OutputType = "dict",
) -> Union[Dict[str, Any], List[str]]:
"""
Implements a linear swarm where agents process tasks in a sequential manner.

Args:
agents (AgentListType): A list of Agent objects to participate in the swarm.
tasks (List[str]): A list of tasks to be processed by the agents.
output_type (OutputType, optional): The format of the output. Defaults to "dict".

Returns:
Union[Dict[str, Any], List[str]]: The formatted output of the swarm's processing.
If output_type is "dict", returns a dictionary containing the conversation history.
If output_type is "list", returns a list of responses.

Raises:
ValueError: If agents or tasks lists are empty.
"""
if not agents or not tasks:
raise ValueError("Agents and tasks lists cannot be empty.")

conversation = Conversation()

for agent in agents:
if tasks:
task = tasks.pop(0)
conversation.add(
role="User",
content=task,
)
response = agent.run(conversation.get_str())
conversation.add(
role=agent.agent_name,
content=response,
)

return history_output_formatter(conversation, output_type)


# Star Swarm: A central agent first processes all tasks, followed by others
def star_swarm(
agents: AgentListType,
Expand Down
16 changes: 0 additions & 16 deletions tests/structs/test_swarm_architectures.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
geometric_swarm,
grid_swarm,
harmonic_swarm,
linear_swarm,
log_swarm,
mesh_swarm,
one_to_one,
Expand Down Expand Up @@ -69,21 +68,6 @@ def test_grid_swarm():
assert len(result) > 0


def test_linear_swarm():
"""Test linear swarm sequential processing"""
agents = create_test_agents(3)
tasks = ["Research task", "Write content", "Review output"]

result = linear_swarm(agents, tasks)

assert isinstance(result, list)
assert len(result) > 0

for log in result:
assert "role" in log
assert "content" in log


def test_star_swarm():
"""Test star swarm with central and peripheral agents"""
agents = create_test_agents(4)
Expand Down
Loading