https://github.com/idea-idsia/ant-ai
A lightweight Python framework for building multi-agent systems that communicate via A2A protocol
https://github.com/idea-idsia/ant-ai
a2a-protocol agent2agent agents ai ai-agents framework multi-agent open-source python
Last synced: about 2 months ago
JSON representation
A lightweight Python framework for building multi-agent systems that communicate via A2A protocol
- Host: GitHub
- URL: https://github.com/idea-idsia/ant-ai
- Owner: idea-idsia
- License: mit
- Created: 2026-04-23T15:12:25.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-05-20T12:38:09.000Z (about 2 months ago)
- Last Synced: 2026-05-20T12:49:10.514Z (about 2 months ago)
- Topics: a2a-protocol, agent2agent, agents, ai, ai-agents, framework, multi-agent, open-source, python
- Language: Python
- Homepage: https://idea.idsia.ch/ant-ai/
- Size: 862 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-a2a - ANT AI - idsia](https://github.com/idea-idsia) [](https://github.com/idea-idsia/ant-ai) - A lightweight Python framework from IDSIA for building tool-driven AI agents and multi-agent systems with first-class A2A protocol support (dedicated `a2a` module with client, server, executor, session, and translator). Features graph-based workflow orchestration, MCP tool integration, lifecycle hooks for guardrails, LLM-agnostic core, and built-in observability via Langfuse. MIT licensed and published on PyPI as `ant-ai`. (⚙️ Implementations & Libraries)
README




[](https://codecov.io/gh/idea-idsia/ant-ai)
[](https://idea-idsia.github.io/ant-ai/)
**A lightweight Python framework for building tool-driven AI agents and multi-agent systems.**
---
`ant-ai` is a lightweight Python framework for building multi-agent systems: graph-based workflow orchestration, first-class agent-to-agent (A2A) communication via the [A2A protocol](https://github.com/a2aproject/A2A), MCP tool integration, lifecycle hooks for guardrails, and built-in observability — all on top of an LLM-agnostic core.
## Why ANT AI
**Multi-agent by design.** Agents communicate and delegate via the [A2A protocol](https://github.com/a2aproject/A2A) — no custom glue code required.
**No lock-in.** Swap LLMs, tools, or observability backends without touching your agent logic.
**Structured, not scripted.** Model complex behavior as graphs — know exactly what runs, when, and why.
**Observable from day one.** Built-in tracing via [Langfuse](https://langfuse.com/) and lifecycle hooks for guardrails.
## Installation
Requires Python 3.14+. Install with [uv](https://docs.astral.sh/uv/):
```sh
uv add ant-ai
```
Or clone and sync for local development:
```sh
git clone git@github.com:idea-idsia/ant-ai.git
cd ant-ai
uv sync --all-packages --all-groups --all-extras
```
## Quickstart
### Single agent
```python
from ant_ai import Agent, Message, State, tool
from ant_ai.llm.integrations import LiteLLMChat
@tool
def get_weather(city: str) -> str:
"""Return the current weather for a city."""
return f"Sunny, 22°C in {city}"
llm = LiteLLMChat(model="gpt-4o-mini")
agent = Agent(
name="WeatherAgent",
system_prompt="You are a helpful weather assistant.",
llm=llm,
tools=[get_weather],
)
state = State(messages=[Message(role="user", content="What's the weather in Lugano?")])
answer = agent.invoke(state)
print(answer)
```
### Streaming events
```python
from ant_ai.core import FinalAnswerEvent
async for event in agent.stream(state):
if isinstance(event, FinalAnswerEvent):
print(event.content)
```
### Structured output
```python
from pydantic import BaseModel
class WeatherReport(BaseModel):
city: str
temperature: int
condition: str
answer = agent.invoke(state, response_schema=WeatherReport)
# answer is a JSON string matching WeatherReport
```
## Development
```sh
# Install dev dependencies and pre-commit hooks
uv sync --all-extras
uv run pre-commit install
# Run tests
uv run pytest
# Serve docs locally
uv run mkdocs serve
```
See [CONTRIBUTING.md](CONTRIBUTING.md) for the full contributing guide, branching model, and review process.
## License
This software is licensed under the MIT license. See the [LICENSE](LICENSE) file for details.
## Funding
This project is supported by the following grants.
| Acknowledgement |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Funded by the Swiss State Secretariat for Education, Research and Innovation (SERI), Project number 24.00596. |
| Funded by the European Union under Grant Agreement No. 101189745 (HIVEMIND).
|