← Back to all products
$59
AI Agent Framework
Multi-agent orchestration system with tool calling, memory management, planning loops, and human-in-the-loop patterns.
MarkdownYAMLPythonReactCI/CDLLMOpenAI
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 64 files
ai-agent-framework/
├── LICENSE
├── README.md
├── configs/
│ ├── agent_config.yaml
│ └── team_config.yaml
├── examples/
│ ├── __pycache__/
│ │ ├── basic_agent.cpython-312.pyc
│ │ ├── research_agent.cpython-312.pyc
│ │ └── team_example.cpython-312.pyc
│ ├── basic_agent.py
│ ├── research_agent.py
│ └── team_example.py
├── free-sample.zip
├── guide/
│ ├── 01-building-an-agent.md
│ └── 02-tool-design.md
├── guides/
│ ├── building-an-agent.md
│ └── tool-design.md
├── index.html
├── requirements.txt
├── src/
│ ├── __init__.py
│ ├── __pycache__/
│ │ ├── __init__.cpython-312.pyc
│ │ ├── agent.cpython-312.pyc
│ │ ├── approval.cpython-312.pyc
│ │ ├── guardrails.cpython-312.pyc
│ │ ├── llm_client.cpython-312.pyc
│ │ └── tool_registry.cpython-312.pyc
│ ├── agent.py
│ ├── approval.py
│ ├── coordination/
│ │ ├── __init__.py
│ │ ├── __pycache__/
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ ├── message_bus.cpython-312.pyc
│ │ │ └── supervisor.cpython-312.pyc
│ │ ├── message_bus.py
│ │ └── supervisor.py
│ ├── guardrails.py
│ ├── llm_client.py
│ ├── memory/
│ │ ├── __init__.py
│ │ ├── __pycache__/
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ ├── buffer.cpython-312.pyc
│ │ │ ├── long_term.cpython-312.pyc
│ │ │ └── summarizer.cpython-312.pyc
│ │ ├── buffer.py
│ │ ├── long_term.py
│ │ └── summarizer.py
│ ├── planning/
│ │ ├── __init__.py
│ │ ├── __pycache__/
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ ├── plan_execute.cpython-312.pyc
│ │ │ └── react.cpython-312.pyc
│ │ ├── plan_execute.py
│ │ └── react.py
│ ├── tool_registry.py
│ └── tools/
│ ├── __init__.py
│ ├── __pycache__/
│ │ ├── __init__.cpython-312.pyc
│ │ ├── calculator.cpython-312.pyc
│ │ ├── file_io.cpython-312.pyc
│ │ └── web_search.cpython-312.pyc
│ ├── calculator.py
│ ├── file_io.py
│ └── web_search.py
└── tests/
├── __init__.py
├── __pycache__/
│ ├── __init__.cpython-312.pyc
│ ├── test_memory.cpython-312.pyc
│ └── test_tools.cpython-312.pyc
├── test_memory.py
└── test_tools.py
📖 Documentation Preview README excerpt
AI Agent Framework
A modular, extensible framework for building LLM-powered AI agents in Python. Provides everything you need to go from a simple chatbot to a multi-agent orchestration system: tool calling, memory management, planning loops, coordination patterns, guardrails, and human-in-the-loop approval gates.
Features
- Agent base class with lifecycle hooks, event streaming, and configurable behavior
- Tool registry with automatic JSON Schema generation from Python type hints
- Memory management: short-term conversation buffer with summarization, long-term vector-backed semantic recall
- Planning loops: ReAct (interleaved reasoning and acting) and Plan-and-Execute (decompose then solve)
- Multi-agent coordination: supervisor/worker delegation and peer-to-peer message bus
- Guardrail hooks: content filtering, rate limiting, length guards -- composable in chains
- Human-in-the-loop: approval gates for high-risk tool calls (interactive, policy-based, auto-approve)
- Built-in tools: safe calculator (AST-based), web search stub, sandboxed file I/O
- Mock LLM client: test your entire agent pipeline without API calls or costs
- OpenAI client adapter: drop-in integration with GPT-4o and other OpenAI models
Quick Start
pip install -r requirements.txt
python examples/basic_agent.py
Minimal Agent (5 Lines)
from src.agent import Agent, AgentConfig
from src.tool_registry import ToolRegistry, tool
from src.llm_client import MockLLMClient
registry = ToolRegistry()
@registry.register
@tool(description="Add two numbers")
def add(a: float, b: float) -> float:
return a + b
agent = Agent(
config=AgentConfig(name="calc-bot", system_prompt="You do math."),
llm=MockLLMClient(),
tools=registry,
)
result = agent.run("What is 2 + 3?")
With Real LLM
from src.llm_client import OpenAIClient
agent = Agent(
config=AgentConfig(name="assistant"),
llm=OpenAIClient(api_key="YOUR_API_KEY_HERE"),
tools=registry,
)
Architecture
... continues with setup instructions, usage examples, and more.
📄 Code Sample .py preview
src/agent.py
"""
Core Agent class - the central building block of the framework.
An Agent wraps an LLM client with a system prompt, a set of tools it can call,
a memory backend, and optional guardrails. You subclass Agent to create
specialized agents (researchers, coders, reviewers), or use it directly with
configuration for simpler cases.
Design decisions:
- Agents own their conversation history but delegate persistence to a Memory backend.
This keeps the Agent lean while allowing swappable storage (in-memory, SQLite, Redis).
- Tool execution is synchronous by default. Async agents can override `run_async`.
- Every agent step emits a structured AgentEvent so you can log, debug, or stream
intermediate reasoning to a UI without coupling the agent to any particular frontend.
"""
from __future__ import annotations
import logging
import time
import uuid
from dataclasses import dataclass, field
from enum import Enum
from typing import Any, Callable
from src.llm_client import LLMClient, MockLLMClient
from src.tool_registry import ToolRegistry, ToolCall, ToolResult
from src.memory.buffer import ConversationBuffer
from src.guardrails import GuardrailChain, GuardrailVerdict
logger = logging.getLogger(__name__)
class AgentState(Enum):
"""Lifecycle states an agent transitions through during execution."""
IDLE = "idle"
THINKING = "thinking" # Waiting for LLM response
CALLING_TOOL = "calling_tool" # Executing a tool
WAITING_APPROVAL = "waiting_approval" # Blocked on human approval
FINISHED = "finished"
ERROR = "error"
@dataclass
class AgentConfig:
"""Configuration that controls agent behavior without touching code.
Args:
name: Human-readable agent name, used in logs and multi-agent messaging.
system_prompt: The system message that shapes the agent's persona and constraints.
# ... 228 more lines ...