Agents that talk to each other, tools that just work, and a graph you can actually reason about — ant-ai is a lightweight Python framework for building multi-agent systems, from a single tool-using agent to a whole colony of them.
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 grab everything at once:
uv add "ant-ai[all]"
Need just a piece — OpenAI, Langfuse, mem0, guardrails, viz? See the install guide for the full list of extras.
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
agent.stream() interleaves live ContentDeltaEvents (token by token) before the terminal event they build up to — match on it for live text, or ignore it and just take the final answer:
from ant_ai.core import ContentDeltaEvent, FinalAnswerEvent
async for event in agent.stream(state):
if isinstance(event, ContentDeltaEvent):
print(event.delta, end="", flush=True)
elif isinstance(event, FinalAnswerEvent):
print()
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.
Citation
If you use ant-ai in your research, please cite it. See CITATION.cff for the machine-readable citation metadata, or use the BibTeX entry below.
@software{Sas_ant-ai_A_lightweight_2026,
author = {Sas, Cezar and Giuffrida, Vincenzo and Mitrović, Sandra and Salani, Matteo},
doi = {10.5281/zenodo.21276625},
license = {MIT},
month = jun,
title = {{ant-ai: A lightweight Python framework for building multi-agent AI systems}},
url = {https://github.com/idea-idsia/ant-ai},
year = {2026}
}
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). |
Metadata
Release files for ant-ai 1.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ant_ai-1.9.0.tar.gz | 71.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ant_ai-1.9.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 176.0 kB
Release files / ant_ai-1.9.0.tar.gz
| Download URL | ant_ai-1.9.0.tar.gz |
|---|---|
| Size | 71.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c01ed8cd97a8a1f5fec01e2f329293570d1bec5761bad2486abffd5972d5fce
|
|
BLAKE2b-256 checksum How to use checksums |
9a69ae919d133cfcaa9748dd8ccfb9fd071fabeaca51b7c4723fdadfa6b3b4d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.
Transparency logRelease files / ant_ai-1.9.0-py3-none-any.whl
| Download URL | ant_ai-1.9.0-py3-none-any.whl |
|---|---|
| Size | 104.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a948934dbd5ce02318cd1072f1c4968f81558c56c6c890c2d035869e178b60a
|
|
BLAKE2b-256 checksum How to use checksums |
a35c11c99a89e1d6bd917e109a4fb79e0c24663662da80d40dec012a46d37c4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.
Transparency log