ANT AI
Project description
ANT AI provides a composable set of primitives for building production-ready AI agents: a ReAct reasoning loop, a flexible tool system with MCP support, a graph-based workflow engine, and first-class agent-to-agent (A2A) communication via the A2A protocol.
Features
- ReAct agent — built-in Reason→Act loop with streaming, structured output, and configurable retry logic
- Flexible tools — define tools as decorated functions, class namespaces, or load them directly from any MCP server
- Workflow engine — graph-based orchestration with static and conditional edges to sequence agent behaviour predictably
- Multi-agent colony — wire agents together with the A2A protocol; each agent becomes a callable tool to its peers
- LLM-agnostic — ships with LiteLLM and native OpenAI backends; any
ChatLLM-conforming implementation works - Observability — structured lifecycle events with Langfuse, OpenTelemetry, and log sinks
- Lifecycle hooks — intercept and control every LLM call: pass, block, retry, or substitute results; ships with a GuardrailsAI adapter
Installation
Requires Python 3.14+. Install with uv:
uv add ant-ai
Or clone and sync for local development:
git clone <repo-url>
cd ant-ai
uv sync --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.
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.0.tar.gz.
File metadata
- Download URL: ant_ai-1.0.0.tar.gz
- Upload date:
- Size: 46.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09825dd4d39ca154aae60dd31117082f76ea889559aaf97bcfabf608cc016a98
|
|
| MD5 |
6126216812e90fdeb2ad0cdced53cb6d
|
|
| BLAKE2b-256 |
860fa269b29c1950032e2d6d97c7b9f455a2810fe2118d615ecefe30bd789f45
|
Provenance
The following attestation bundles were made for ant_ai-1.0.0.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.0.tar.gz -
Subject digest:
09825dd4d39ca154aae60dd31117082f76ea889559aaf97bcfabf608cc016a98 - Sigstore transparency entry: 1368287226
- Sigstore integration time:
-
Permalink:
idea-idsia/ant-ai@d039113521fbf2c721ee46c3bb4e2f0bfbe21357 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/idea-idsia
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d039113521fbf2c721ee46c3bb4e2f0bfbe21357 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ant_ai-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ant_ai-1.0.0-py3-none-any.whl
- Upload date:
- Size: 70.9 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 |
6a41e1d5f21c1f7e5d2b9baf260ebf2e4c91e62412ef548f2213db433b97b4b4
|
|
| MD5 |
572731b122cf07153c3d091d67577ec3
|
|
| BLAKE2b-256 |
cfb7479f429adea28ba3818b4fa109eb357b3432e84debde455d859893bfeff9
|
Provenance
The following attestation bundles were made for ant_ai-1.0.0-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.0-py3-none-any.whl -
Subject digest:
6a41e1d5f21c1f7e5d2b9baf260ebf2e4c91e62412ef548f2213db433b97b4b4 - Sigstore transparency entry: 1368287229
- Sigstore integration time:
-
Permalink:
idea-idsia/ant-ai@d039113521fbf2c721ee46c3bb4e2f0bfbe21357 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/idea-idsia
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d039113521fbf2c721ee46c3bb4e2f0bfbe21357 -
Trigger Event:
release
-
Statement type: