A production-ready, zero-dependency multi-agent orchestration framework for Agentic AI.
Modern agentic AI systems need more than a single LLM call. They require planning, tool use, memory, multi-agent coordination, and self-criticism β all wired together reliably.
AgentFlow provides exactly that: a lightweight, extensible Python framework you can drop into any project to orchestrate networks of AI agents.
Goal βββΊ PlannerAgent βββΊ ExecutorAgent βββΊ CriticAgent βββΊ Result
β β β
ββββββββββββββββ΄ββ retry? βββββββ
| Feature | Description |
|---|---|
| BaseAgent | Abstract foundation with retry logic, messaging, and state |
| PlannerAgent | Decomposes goals into ordered subtasks (heuristic or LLM-backed) |
| ExecutorAgent | Runs subtasks via tools, LLM, or custom handlers |
| CriticAgent | Scores outputs and triggers retries when quality is low |
| AgentPipeline | Sequential, parallel, and plan-execute orchestration modes |
| AgentRouter | Dynamically routes tasks to the best-matching agent |
| ShortTermMemory | In-process sliding-window memory |
| LongTermMemory | File-backed persistent JSON Lines store |
| ToolRegistry | Register and discover tools by name or keyword |
| Built-in Tools | Calculator, File I/O, Web Search stub, Timer |
| Zero core deps | Pure Python stdlib β add LLM/vector-DB extras as needed |
| Full test suite | 40+ pytest tests across agents, memory, tools, and orchestrator |
| GitHub Actions CI | Tests on Python 3.9β3.12 with coverage reporting |
pip install agentflow
# or from source:
git clone https://github.com/your-org/agentflow
cd agentflow && pip install -e .from agentflow.agents.planner import PlannerAgent
from agentflow.agents.executor import ExecutorAgent
from agentflow.agents.critic import CriticAgent
from agentflow.orchestrator.pipeline import AgentPipeline
pipeline = AgentPipeline(
name="MyPipeline",
agents=[
PlannerAgent(name="Planner"),
ExecutorAgent(name="Executor"),
CriticAgent(name="Critic"),
],
mode="plan_execute",
)
run = pipeline.run("Build a REST API for a todo app")
print(run.final_output)
print(f"Success: {run.success} | Time: {run.total_time:.2f}s")from agentflow.orchestrator.router import AgentRouter
router = (
AgentRouter(strategy="keyword")
.register(planner, keywords=["plan", "design", "decompose"])
.register(executor, keywords=["build", "implement", "run"])
.register(critic, keywords=["review", "evaluate", "check"])
)
result = router.dispatch("Please review and evaluate the output quality")pipeline = AgentPipeline(
agents=[summary_agent, sentiment_agent, keyword_agent],
mode="parallel",
max_workers=3,
)
run = pipeline.run(document_text)
print(run.final_output) # dict of {agent_name: output}from agentflow.tools.builtins import CalculatorTool, FileTool
from agentflow.tools.registry import ToolRegistry
registry = ToolRegistry()
registry.register(CalculatorTool())
registry.register(FileTool(base_dir="/tmp"))
# Or use the decorator
@registry.tool("web_search", keywords=["search", "find"])
def search(query: str, **_) -> str:
... # plug in any search providerfrom agentflow.memory.short_term import ShortTermMemory
from agentflow.memory.long_term import LongTermMemory
# In-process
stm = ShortTermMemory(capacity=100)
stm.store({"result": "..."})
hits = stm.search("result")
# Persistent across runs
ltm = LongTermMemory(path="./agent_memory.jsonl")
ltm.store({"task": "translate", "output": "..."}, tags=["translation"])class MyLLMClient:
def complete(self, prompt: str) -> str:
# call OpenAI, Anthropic, Ollama, etc.
...
executor = ExecutorAgent(
name="LLMExecutor",
mode="llm",
llm_client=MyLLMClient(),
)
planner = PlannerAgent(
name="LLMPlanner",
strategy="llm",
llm_client=MyLLMClient(),
)agentflow/
βββ agents/
β βββ base.py β BaseAgent, AgentMessage, AgentResult
β βββ planner.py β PlannerAgent (sequential / dependency / llm)
β βββ executor.py β ExecutorAgent (tool / llm / hybrid)
β βββ critic.py β CriticAgent (heuristic / llm / custom)
βββ orchestrator/
β βββ pipeline.py β AgentPipeline (sequential / parallel / plan_execute)
β βββ router.py β AgentRouter (keyword / round_robin / custom)
βββ memory/
β βββ short_term.py β ShortTermMemory (in-process deque)
β βββ long_term.py β LongTermMemory (JSONL file)
βββ tools/
βββ registry.py β ToolRegistry, BaseTool, FunctionTool
βββ builtins.py β CalculatorTool, FileTool, WebSearchTool, TimerTool
pip install -e ".[dev]"
pytest tests/ -v --cov=agentflowpython examples/01_basic_pipeline.py
python examples/02_agent_router.py
python examples/03_tools_and_memory.py
python examples/04_parallel_pipeline.py- Async /
asynciosupport for pipeline and agents - Vector-store memory backends (FAISS, ChromaDB, Pinecone)
- LangChain & LlamaIndex tool adapters
- OpenAI & Anthropic LLM client integrations (built-in)
- Agent-to-agent delegation (hierarchical multi-agent)
- REST API server (
uvicorn+ FastAPI) - Web dashboard for pipeline monitoring
- Streaming output support
Contributions are welcome! Please open an issue or pull request.
- Fork the repo and create a feature branch
- Write tests for new functionality
- Ensure
pytestandruffpass - Submit a PR with a clear description
MIT β see LICENSE.