AGNT5 Python SDK
Build AI agents and durable workflows with the AGNT5 Python SDK
Build AI agents and reliable workflows with automatic recovery. AGNT5 combines agent orchestration and fault-tolerant execution in one lightweight framework.
Primitives comparison
| Attribute | Function | Entity | Workflow | Agent | Tool |
|---|---|---|---|---|---|
| What | Stateless operation with retries | Stateful component with unique key | Multi-step orchestrated process | LLM with instructions and tools | Python function LLMs can call |
| State | None | Isolated per entity key | Isolated per workflow instance | Conversation history via Entity | None |
| Durability | Automatic retries, checkpointing | Persistent state across runs | Checkpointed steps, resume on failure | Context preserved in Entity | Runs within agent context |
| Best For | Document analysis, embeddings generation, LLM API calls | AI chat sessions, agent memory, conversation history | RAG pipelines, content generation with review, AI evals | Customer support, research assistants, code review | Vector search, knowledge base queries, API integrations |
Key Features
- Automatic recovery from failures with configurable retry policies
- Checkpointing resumes from exact failure point
- Multi-agent coordination via handoffs and composition
- Python-native - decorators, async/await, type hints
- Multi-provider - OpenAI, Anthropic, Groq, Azure, Bedrock, OpenRouter
- Built-in tracing for debugging and monitoring
Installation
pip install agnt5Quick example
from agnt5 import Agent, workflow, tool, Context, WorkflowContext
# Define a tool for the agent
@tool(auto_schema=True)
async def search_docs(ctx: Context, query: str) -> str:
"""Search documentation for answers."""
# Your search logic here
return f"Found documentation about: {query}"
# Create an AI agent with tools
agent = Agent(
name="assistant",
model="openai/gpt-4o-mini",
instructions="You are a helpful assistant. Search docs when needed.",
tools=[search_docs]
)
# Create a durable workflow that orchestrates the agent
@workflow
async def process_question(ctx: WorkflowContext, question: str) -> dict:
"""Durable workflow for processing questions."""
# Step 1: Get answer from agent (checkpointed)
answer = await ctx.step("get_answer", agent.run(question))
# Step 2: Store result (checkpointed)
await ctx.step("store", save_answer(question, answer))
return {"question": question, "answer": answer}
# If this crashes after step 1, it resumes from step 2 on restartNote: Set your OPENAI_API_KEY environment variable before running.
Next Steps
Getting Started
- Quickstart - Installation, first worker, and local development setup
- Worker Runtime - Configure and deploy workers
Core Primitives
- Functions - Stateless operations with retries
- Entities - Stateful components with unique keys
- Workflows - Multi-step orchestration patterns
- Context API - Orchestration, state, AI, and observability APIs
Agent Development Kit (ADK)
- Agents - Autonomous LLM-driven systems
- Sessions - Conversation containers and multi-agent coordination
- Tools - Callable capabilities that extend agent abilities
- Memory - Long-term knowledge storage with semantic search
Examples
- Examples - Practical usage examples
Modules
- Getting StartedInstallation and first steps with the AGNT5 Python SDK
- FunctionsHandler decorators and function execution in the AGNT5 Python SDK
- EntitiesStateful components with unique keys and single-writer consistency
- WorkflowsMulti-step orchestration and durable execution patterns
- Context APIExecution context with APIs for orchestration, state, AI, and observability
- AgentsAutonomous LLM-driven systems with tool orchestration and reasoning
- SessionsConversation containers with scoped state and multi-agent coordination
- ToolsCallable capabilities that extend agent abilities with automatic schema extraction
- MemoryLong-term knowledge storage with semantic search for agents
- Worker RuntimeConfigure and deploy Python workers for AGNT5