Skip to main content
ANT AI

A lightweight Python framework for building tool-driven AI agents and multi-agent systems.

PyPI Python License Coverage Ruff ty DOI

Documentation · Install · Quickstart · Architecture · Contributing


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 over the A2A protocol — no custom glue code required.
🧩 Editor-native Serve any agent to Zed, VSCode, or the Gemini CLI over the Agent Client Protocol, with filesystem, terminal, and slash-command support built in.
🔌 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-ai, datafog, 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

Your first agent

An agent is an LLM, a system prompt, and a set of tools. Decorate a function with @tool and it becomes callable by the model:

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}"


agent = Agent(
    name="WeatherAgent",
    system_prompt="You are a helpful weather assistant.",
    llm=LiteLLMChat(model="gpt-4o-mini"),
    tools=[get_weather],
)

state = State(messages=[Message(role="user", content="What's the weather in Lugano?")])
print(agent.invoke(state))

Streaming

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

Pass a Pydantic model as response_schema and the final answer comes back as JSON matching it:

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

A colony of agents

A Colony wires agents together over A2A: each one runs as its own ASGI service, and a collaboration edge makes one agent callable as a tool by another.

from ant_ai.a2a import Colony

colony = Colony()
colony.agent(
    "codegen", agent=codegen_agent, workflow=codegen_workflow, card=codegen_card
)
colony.agent(
    "testgen", agent=testgen_agent, workflow=testgen_workflow, card=testgen_card
)

colony.collab("codegen", "testgen")  # codegen can now call testgen as a tool

asgi_app = colony.asgi(agent_name="codegen", use_fastapi=True)

Serving an agent to your editor

ACPServer exposes an agent over the Agent Client Protocol, so it runs inside Zed, VSCode, or the Gemini CLI — no changes to the agent itself:

from ant_ai.acp import ACP_ALL_TOOLS, ACPServer

agent = Agent(..., tools=[*ACP_ALL_TOOLS])  # read files, run terminals, push plans

ACPServer(agent=agent, workflow=workflow).serve_stdio()

Documentation

Guide What it covers
Installation Extras, installing from source, verifying your setup.
Single-agent Tools, streaming, memory, skills, and visualizing workflows.
Multi-agent Colonies, agent cards, collaboration edges, deployment.
ACP Serving an agent to an editor, IDE tools, slash commands.
Architecture How agents, workflows, and events fit together end-to-end.

Runnable scripts live in examples/ — an ACP agent for your editor, a stdio→WebSocket proxy, and an interactive ACP test client.

Development

# Install dev dependencies and pre-commit hooks
uv sync --all-packages --all-groups --all-extras
uv run pre-commit install

# Run the test suite (skipping tests that need vLLM or external services)
uv run pytest -m "not vllm and not external"

# Serve the 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).
Funded by the European Union

Metadata

Release files for ant-ai 1.12.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ant-ai 1.12.1
File Size Uploaded
ant_ai-1.12.1.tar.gz 88.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ant-ai 1.12.1
File Interpreter ABI Platform
ant_ai-1.12.1-py3-none-any.whl Python 3 none any Details

Total release size: 212.6 kB

Release files / ant_ai-1.12.1.tar.gz

Download URL ant_ai-1.12.1.tar.gz
Size 88.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b5b087c915faed9f8dc939a3e24b92384d142862d7cc612260bbc953290077fa
BLAKE2b-256 checksum
How to use checksums
8932fc575bb7518c99e303ad883ddbb3b123ba639d43edbac2f8367cfcbbabee
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 Sep 18, 2026.

Transparency log

Release files / ant_ai-1.12.1-py3-none-any.whl

Download URL ant_ai-1.12.1-py3-none-any.whl
Size 124.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
640e0538387f85aa9a660d3f4b3ec48bfc1f0e4580351c8ea86b74001c26007a
BLAKE2b-256 checksum
How to use checksums
5b7a6eb10a8d0232ff130494c8d8e63c9313f3c7c16a86d36e4dd69c273ef67d
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 Sep 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.12.1 This release

2 release files

1.12.0

2 release files

1.11.0

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.9

2 release files

1.5.8

2 release files

1.5.7

2 release files

1.5.6

2 release files

1.5.5

2 release files

1.5.4

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page