A lightweight Python framework for building multi-agent AI systems
Project description
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, 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 — 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 and lifecycle hooks for guardrails.
Installation
Requires Python 3.14+. Install with uv:
uv add ant-ai
Or clone and sync for local development:
git clone git@github.com:idea-idsia/ant-ai.git
cd ant-ai
uv sync --all-packages --all-groups --all-extras
Quickstart
Single agent
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
from ant_ai.core import FinalAnswerEvent
async for event in agent.stream(state):
if isinstance(event, FinalAnswerEvent):
print(event.content)
Structured output
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
# 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 for the full contributing guide, branching model, and review process.
License
This software is licensed under the MIT license. See the 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). |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ant_ai-1.0.6.tar.gz.
File metadata
- Download URL: ant_ai-1.0.6.tar.gz
- Upload date:
- Size: 50.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baf049a4cc2f8f486ca730742d819ce9ed88a489a4b8891b80ec6ff8eb3d629f
|
|
| MD5 |
a4e2dd59d024238ae80201e3fd74d6a6
|
|
| BLAKE2b-256 |
117a09497acc351564d1987486f8db2981103b1d6941972b9a55041e1fbd0ebc
|
Provenance
The following attestation bundles were made for ant_ai-1.0.6.tar.gz:
Publisher:
publish.yml on idea-idsia/ant-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ant_ai-1.0.6.tar.gz -
Subject digest:
baf049a4cc2f8f486ca730742d819ce9ed88a489a4b8891b80ec6ff8eb3d629f - Sigstore transparency entry: 1409422896
- Sigstore integration time:
-
Permalink:
idea-idsia/ant-ai@700a3bafb5df39906e6dcfabacbd8eb345ed841b -
Branch / Tag:
refs/tags/v1.0.6 - Owner: https://github.com/idea-idsia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@700a3bafb5df39906e6dcfabacbd8eb345ed841b -
Trigger Event:
push
-
Statement type:
File details
Details for the file ant_ai-1.0.6-py3-none-any.whl.
File metadata
- Download URL: ant_ai-1.0.6-py3-none-any.whl
- Upload date:
- Size: 74.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac560acb25a966aa89e63b0d04461dcca8a97f1aed3d73aaea4f288fb384bc3b
|
|
| MD5 |
64b972ad5c2f4b179fe27dc5befb3361
|
|
| BLAKE2b-256 |
09876ba53bc59e7674816a0fc63c89635bca3e2fdb87b63dfd898e78e6d7a2bb
|
Provenance
The following attestation bundles were made for ant_ai-1.0.6-py3-none-any.whl:
Publisher:
publish.yml on idea-idsia/ant-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ant_ai-1.0.6-py3-none-any.whl -
Subject digest:
ac560acb25a966aa89e63b0d04461dcca8a97f1aed3d73aaea4f288fb384bc3b - Sigstore transparency entry: 1409422912
- Sigstore integration time:
-
Permalink:
idea-idsia/ant-ai@700a3bafb5df39906e6dcfabacbd8eb345ed841b -
Branch / Tag:
refs/tags/v1.0.6 - Owner: https://github.com/idea-idsia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@700a3bafb5df39906e6dcfabacbd8eb345ed841b -
Trigger Event:
push
-
Statement type: