Skip to main content

An agent development + orchestration framework

Project description

RouteKitAI

A minimal, production-ready framework for building and orchestrating AI agents

Python 3.11+ License: MIT Code style: ruff Type checking: mypy

FeaturesQuick StartDocumentationExamplesContributing


⚠️ Early stage: RouteKitAI is still in very early development. APIs may change, and some features are experimental. Use with caution in production.

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

🎓 Examples

Check out the examples/ directory for complete examples:

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:

  1. Model: LLM interface abstraction
  2. Message: Conversation message representation
  3. Tool: Callable function/tool definition
  4. Agent: Agent with model and tools
  5. 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:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📋 Requirements

Core (always installed):

Optional extras:

Extra Purpose
[dev] CLI, tests, linting, type checking (pytest, mypy, ruff, rich, typer, safety, bandit)
[ui] Web UI for traces: routekitai serve (FastAPI, Uvicorn)
[optional] Vector memory, OpenAI adapter (sentence-transformers, faiss, openai, nest-asyncio)
[docs] Build documentation locally (MkDocs, MkDocs Material)

Examples:

pip install "RouteKitAI[dev]"       # development + CLI
pip install "RouteKitAI[dev,ui]"    # + trace web UI
pip install "RouteKitAI[docs]"      # build docs: mkdocs build / mkdocs serve

📄 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


Made with ❤️ by the Mohamed Ghassen Brahim

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

routekitai-0.2.1.tar.gz (132.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

routekitai-0.2.1-py3-none-any.whl (105.4 kB view details)

Uploaded Python 3

File details

Details for the file routekitai-0.2.1.tar.gz.

File metadata

  • Download URL: routekitai-0.2.1.tar.gz
  • Upload date:
  • Size: 132.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for routekitai-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7d98c4ebe3075da56f2a696d8321efe948f7c39e8b63f170039b24e6f6233f01
MD5 2bc9e6046110cc4fcb73c0ef9a741105
BLAKE2b-256 c21dce066040749a9fb082612c60cb320a71ef466f86e0b53ad5838a62a692cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for routekitai-0.2.1.tar.gz:

Publisher: publish.yml on MedGhassen/RouteKitAI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file routekitai-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: routekitai-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 105.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for routekitai-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cda06b3a34230d9a36e07d8289b1ba0b5035c43b589d58af4310ef2b439acb6f
MD5 9519ac218d4f3fcb1bded8efa70560a1
BLAKE2b-256 0f52bf19156f8e5c65b7fc63d63333fc3b3ec76d9f84057f03adfa0e4897a577

See more details on using hashes here.

Provenance

The following attestation bundles were made for routekitai-0.2.1-py3-none-any.whl:

Publisher: publish.yml on MedGhassen/RouteKitAI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page