An agent development + orchestration framework
Project description
RouteKitAI
A minimal, production-ready framework for building and orchestrating AI agents
Features • Quick Start • Documentation • Examples • Contributing
RouteKitAI is a Python framework for building AI agents with graph-based orchestration, built-in tracing, and deterministic replay. Unlike other frameworks, RouteKitAI treats observability and testability as first-class features from day one.
✨ Features
🎯 Core Capabilities
- Graph-Native Orchestration: Define agent workflows as explicit graphs with clear control flow
- Automatic Tracing: Every execution produces a complete, immutable trace log
- Deterministic Replay: Reproduce any agent run exactly for testing and debugging
- Type-Safe APIs: Full type hints with mypy compliance
- Async-First: Built for modern Python async/await patterns
- Minimal API: Just 5 core primitives—no bloat
🛡️ Production Features
- Security Hooks: PII redaction, tool allow/deny lists, approval gates
- Memory Support: Episodic, retrieval, and vector memory backends
- Policy System: ReAct, Supervisor, Graph, and custom policies
- Error Handling: Comprehensive error types with context
- CLI Tools: Run, trace, replay, and test agents from the command line
- Trace Analysis: Metrics, timeline visualization, step-by-step debugging, and search
🚀 Quick Start
Installation
pip install RouteKitAI
For development with CLI tools:
pip install "RouteKitAI[dev]"
Basic Example
import asyncio
from routekitai import Agent
from routekitai.providers.local import FakeModel
from routekitai.core.tools import EchoTool
# Create a model
model = FakeModel(name="test")
model.add_response("Hello from routekitai!")
# Create an agent
agent = Agent(
name="my_agent",
model=model,
tools=[EchoTool()]
)
# Run the agent
async def main():
result = await agent.run("Hello!")
print(result.output.content)
print(f"Trace ID: {result.trace_id}")
asyncio.run(main())
Graph-Based Workflow
import asyncio
from routekitai import Agent
from routekitai.core.policies import GraphPolicy
from routekitai.graphs import Graph, GraphNode, GraphEdge, NodeType
from routekitai.providers.local import FakeModel
from routekitai.core.tools import EchoTool
# Create models and agents
model1 = FakeModel(name="model1")
model1.add_response("Processing input...")
model2 = FakeModel(name="model2")
model2.add_response("Finalizing result...")
agent1 = Agent(name="agent1", model=model1, tools=[EchoTool()])
agent2 = Agent(name="agent2", model=model2, tools=[])
# Define a graph: agent1 -> tool -> agent2
graph = Graph(
name="example_graph",
entry_node="start",
exit_node="end",
nodes=[
GraphNode(
id="start",
type=NodeType.MODEL,
agent_name="agent1",
output_mapping={"output": "processed_input"},
),
GraphNode(
id="echo_tool",
type=NodeType.TOOL,
tool_name="echo",
input_mapping={"processed_input": "message"},
output_mapping={"result": "echo_result"},
),
GraphNode(
id="end",
type=NodeType.MODEL,
agent_name="agent2",
input_mapping={"echo_result": "prompt"},
),
],
edges=[
GraphEdge(source="start", target="echo_tool"),
GraphEdge(source="echo_tool", target="end"),
],
)
# Create agent with graph policy
agent = Agent(
name="graph_agent",
model=model1,
policy=GraphPolicy(graph=graph)
)
# Run the agent
async def main():
result = await agent.run("Process this task")
print(result.output.content)
asyncio.run(main())
📚 Documentation
- Architecture Guide: Deep dive into RouteKitAI's design
- Security & Governance: Security features and best practices
- Full documentation: Architecture, security, and guides (Read the Docs)
🎓 Examples
Check out the examples/ directory for complete examples:
- Basic Agent / Hello RouteKit: Simple agent with tools
- Graph Orchestration / Graph Policy: Multi-agent workflows
- Supervisor Pattern / Supervisor Policy: Supervisor delegating to sub-agents
- ReAct / Plan–Execute / Function Calling, Plan–Execute, Function Calling: Policy examples
- Evaluation Harness: Testing agents with datasets
Run all examples: ./scripts/run_examples.sh (or bash scripts/run_examples.sh).
🛠️ CLI Commands
RouteKitAI provides a CLI (routekitai) for common operations:
# Run an agent script
routekitai run agent_script.py
# View a trace (multiple formats available)
routekitai trace <trace_id> # Table view (default)
routekitai trace <trace_id> --format timeline # Timeline visualization
routekitai trace <trace_id> --format steps # Step-by-step execution
routekitai trace <trace_id> --format json # JSON output
routekitai trace <trace_id> --format raw # Raw JSONL
# Analyze trace metrics
routekitai trace-analyze <trace_id> # Performance metrics, token usage, costs
# Search traces
routekitai trace-search "error" # Search all traces for "error"
routekitai trace-search "model" --trace-id abc # Search specific trace
routekitai trace-search "tool" --event-type tool_called # Filter by event type
# Replay a trace
routekitai replay <trace_id> --agent my_agent
# Start web UI for trace visualization
routekitai serve # Start on default port 8080
routekitai serve --port 3000 # Custom port
routekitai serve --host 0.0.0.0 # Make accessible from network
# Run sanity checks
routekitai test-agent
🏗️ Core Primitives
RouteKitAI keeps it minimal with 5 core primitives:
- Model: LLM interface abstraction
- Message: Conversation message representation
- Tool: Callable function/tool definition
- Agent: Agent with model and tools
- Runtime: Orchestration and execution engine
🧪 Development
Setup
# Clone the repository
git clone https://github.com/MedGhassen/RouteKitAI.git
cd RouteKitAI
# Install with dev dependencies
pip install -e ".[dev]"
Running Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=routekitai --cov-report=html
# Run specific test file
pytest tests/test_runtime.py
Code Quality
# Type checking
mypy src/
# Linting
ruff check src/ tests/ examples/
# Format code
ruff format src/ tests/ examples/
🤝 Contributing
Contributions are welcome! Please read CONTRIBUTING.md and:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📋 Requirements
- Python 3.11 or higher
- Pydantic 2.0+
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
RouteKitAI is inspired by the need for testable, observable AI agent frameworks. Special thanks to the open-source community for their contributions and feedback.
🔗 Links
- GitHub: https://github.com/MedGhassen/RouteKitAI
- Documentation: https://routekitai.readthedocs.io
- Issues: https://github.com/MedGhassen/RouteKitAI/issues
Made with ❤️ by the Mohamed Ghassen Brahim
Project details
Release history Release notifications | RSS feed
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 routekitai-0.2.0.tar.gz.
File metadata
- Download URL: routekitai-0.2.0.tar.gz
- Upload date:
- Size: 130.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40f400cb0b187bb271fd5acbff349251e95a0591116a63c65686cefbf0e848f0
|
|
| MD5 |
eb5b366d6b7516c337a2d9f660c981f2
|
|
| BLAKE2b-256 |
5e867f929cc88f3ad0aeef7a9fd5f47a62685b4b5bbf72e111d5e0c6b8a675e1
|
Provenance
The following attestation bundles were made for routekitai-0.2.0.tar.gz:
Publisher:
publish.yml on MedGhassen/RouteKitAI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
routekitai-0.2.0.tar.gz -
Subject digest:
40f400cb0b187bb271fd5acbff349251e95a0591116a63c65686cefbf0e848f0 - Sigstore transparency entry: 914994806
- Sigstore integration time:
-
Permalink:
MedGhassen/RouteKitAI@e2d6e37ad66d0173104acdea90b7a48689732fbc -
Branch / Tag:
refs/heads/main - Owner: https://github.com/MedGhassen
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e2d6e37ad66d0173104acdea90b7a48689732fbc -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file routekitai-0.2.0-py3-none-any.whl.
File metadata
- Download URL: routekitai-0.2.0-py3-none-any.whl
- Upload date:
- Size: 104.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e736c5f0bdc700b1653e6e5c4b96a1748b4838b21730deb787740b7c5ff2948
|
|
| MD5 |
8a032657029e8a794dbcb1ae3468354f
|
|
| BLAKE2b-256 |
181066ee125892bb1fd3465a3bb5aefde6eb8884ff08be17b204d83a63477805
|
Provenance
The following attestation bundles were made for routekitai-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on MedGhassen/RouteKitAI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
routekitai-0.2.0-py3-none-any.whl -
Subject digest:
9e736c5f0bdc700b1653e6e5c4b96a1748b4838b21730deb787740b7c5ff2948 - Sigstore transparency entry: 914994883
- Sigstore integration time:
-
Permalink:
MedGhassen/RouteKitAI@e2d6e37ad66d0173104acdea90b7a48689732fbc -
Branch / Tag:
refs/heads/main - Owner: https://github.com/MedGhassen
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e2d6e37ad66d0173104acdea90b7a48689732fbc -
Trigger Event:
workflow_dispatch
-
Statement type: