|
1 | | -# agent-swarm-lite |
| 1 | +# Agent Swarm Lite |
2 | 2 |
|
3 | | -A lightweight Python framework for building multi-agent systems. Define specialized agents, wire them together, and let them collaborate on complex tasks -- all in under 50 lines of setup code. |
| 3 | +## Live Demo |
4 | 4 |
|
5 | | -## Why agent-swarm-lite? |
6 | | - |
7 | | -Multi-agent orchestration frameworks tend to be massive. **agent-swarm-lite** takes the opposite approach: a small, readable core that gives you the primitives you actually need. |
8 | | - |
9 | | -- **Simple agent definition** -- subclass `Agent` or use the functional API |
10 | | -- **Built-in message passing** -- agents communicate through a typed message bus |
11 | | -- **Swarm orchestration** -- run agents in parallel, sequential, or router patterns |
12 | | -- **LLM-agnostic** -- bring any model via a simple adapter interface |
13 | | -- **Async-first** -- built on asyncio for real concurrency |
14 | | -- **Observable** -- built-in event logging for debugging and tracing |
15 | | - |
16 | | -## Installation |
17 | | - |
18 | | -```bash |
19 | | -pip install agent-swarm-lite |
20 | | -``` |
21 | | - |
22 | | -Or from source: |
23 | | - |
24 | | -```bash |
25 | | -git clone https://github.com/MukundaKatta/agent-swarm-lite.git |
26 | | -cd agent-swarm-lite |
27 | | -pip install -e . |
28 | | -``` |
29 | | - |
30 | | -## Quick Start |
31 | | - |
32 | | -```python |
33 | | -from agent_swarm_lite import Agent, Swarm |
34 | | - |
35 | | -# Define agents with simple functions |
36 | | -researcher = Agent( |
37 | | - name="researcher", |
38 | | - instructions="You research topics and return key facts.", |
39 | | - model="gpt-4o", |
40 | | -) |
41 | | - |
42 | | -writer = Agent( |
43 | | - name="writer", |
44 | | - instructions="You write clear summaries from research notes.", |
45 | | - model="gpt-4o", |
46 | | -) |
47 | | - |
48 | | -# Create a swarm and run a pipeline |
49 | | -swarm = Swarm(agents=[researcher, writer]) |
50 | | -result = swarm.run_pipeline( |
51 | | - input_text="What are the latest trends in quantum computing?", |
52 | | - pipeline=["researcher", "writer"], |
53 | | -) |
54 | | -print(result) |
55 | | -``` |
56 | | - |
57 | | -## Architecture |
58 | | - |
59 | | -### Agents |
60 | | - |
61 | | -An agent is a unit of work with a name, instructions, and optional tools: |
62 | | - |
63 | | -```python |
64 | | -agent = Agent( |
65 | | - name="data-analyst", |
66 | | - instructions="Analyze CSV data and return insights.", |
67 | | - tools=[read_csv, compute_stats], |
68 | | -) |
69 | | -``` |
70 | | - |
71 | | -### Message Bus |
72 | | - |
73 | | -Agents communicate through typed messages: |
74 | | - |
75 | | -```python |
76 | | -from agent_swarm_lite import Message |
77 | | - |
78 | | -msg = Message( |
79 | | - sender="researcher", |
80 | | - recipient="writer", |
81 | | - content="Key finding: quantum error correction improved 10x.", |
82 | | - metadata={"confidence": 0.95}, |
83 | | -) |
84 | | -``` |
85 | | - |
86 | | -### Swarm Patterns |
87 | | - |
88 | | -- **Pipeline** -- agents run sequentially, each receiving the previous output |
89 | | -- **Parallel** -- multiple agents process the same input concurrently |
90 | | -- **Router** -- a routing agent decides which specialist to invoke |
91 | | - |
92 | | -## Examples |
93 | | - |
94 | | -See the `examples/` directory: |
95 | | - |
96 | | -- `examples/pipeline_demo.py` -- sequential multi-agent pipeline |
97 | | -- `examples/parallel_demo.py` -- parallel agent execution |
98 | | -- `examples/router_demo.py` -- dynamic routing between agents |
99 | | - |
100 | | -## Project Structure |
101 | | - |
102 | | -``` |
103 | | -agent-swarm-lite/ |
104 | | - agent_swarm_lite/ |
105 | | - __init__.py # Public API |
106 | | - agent.py # Agent class and functional API |
107 | | - message.py # Message types and bus |
108 | | - swarm.py # Swarm orchestrator |
109 | | - adapters.py # LLM adapter interface |
110 | | - logger.py # Event logging and tracing |
111 | | - examples/ |
112 | | - pipeline_demo.py # Pipeline pattern demo |
113 | | - parallel_demo.py # Parallel pattern demo |
114 | | - router_demo.py # Router pattern demo |
115 | | - tests/ |
116 | | - test_swarm.py # Core tests |
117 | | - requirements.txt |
118 | | - setup.py |
119 | | - LICENSE |
120 | | - README.md |
121 | | -``` |
122 | | - |
123 | | -## Running Tests |
124 | | - |
125 | | -```bash |
126 | | -python -m pytest tests/ -v |
127 | | -``` |
128 | | - |
129 | | -## License |
130 | | - |
131 | | -MIT License - see [LICENSE](LICENSE) for details. |
132 | | - |
133 | | -## Contributing |
134 | | - |
135 | | -Contributions welcome! Open an issue or PR. |
| 5 | +Visit the landing page: [https://MukundaKatta.github.io/agent-swarm-lite](https://MukundaKatta.github.io/agent-swarm-lite) |
0 commit comments