Context engineering framework for multi-agent systems
Project description
AgentFlow
Context engineering framework for multi-agent systems.
A framework-agnostic toolkit for building multi-agent workflows with:
- Markdown + YAML front-matter config files (
.prompt.md,.workflow.md,.context.md) - Pluggable LLM providers (Anthropic Claude, OpenAI GPT, Google Gemini, any OpenAI-compatible API)
- Hybrid routing (YAML rules + LLM fallback)
- DAG-based workflow execution (sync, parallel, async nodes)
- Session scratchpads and long-term memory (file-based + vector search)
- Tool registry with local and HTTP dispatchers
Install
# Core only
pip install -e .
# With Claude support
pip install -e ".[anthropic]"
# With Google Gemini support
pip install -e ".[google]"
# Everything
pip install -e ".[all]"
# Development
pip install -e ".[dev]"
Quick Start
1. Define an agent (context/agents/researcher.prompt.md)
---
name: researcher
provider: anthropic
model: claude-sonnet-4-6
temperature: 0.7
max_tokens: 4096
tools: [web_search, summarize]
context_files: [shared/guidelines.context.md]
---
You are a research agent. Given a topic, search for relevant information
and provide a comprehensive summary with sources.
2. Define a workflow (context/workflows/research.workflow.md)
---
name: research_pipeline
trigger: api
nodes:
- id: research
agent: researcher
next: format
- id: format
agent: formatter
inputs:
message: "research.text"
---
Research pipeline: search, then format results.
3. Define routing rules (context/router.prompt.md)
---
name: main_router
routing_rules:
- if: "'research' in message or 'find' in message"
routeTo: research_pipeline
- if: "'analyze' in message"
routeTo: analyzer
fallback: general_assistant
llmFallback: true
---
Route incoming messages to the appropriate agent or workflow.
4. Run
from agentflow import (
ConfigLoader, RouterEngine, WorkflowExecutor, AgentExecutor,
ToolRegistry, SessionManager, EventBus,
FileSystemStorage, AnthropicProvider,
)
# Load configs
loader = ConfigLoader("./context")
loader.load()
# Set up infrastructure
storage = FileSystemStorage("./data")
events = EventBus()
provider = AnthropicProvider()
tools = ToolRegistry()
sessions = SessionManager(storage)
# Route a message
router = RouterEngine(loader, provider, events)
result = await router.route("Research the latest AI safety papers")
# Execute workflow
if result.target == "research_pipeline":
executor = WorkflowExecutor(loader, provider, tools, sessions, storage, events)
outputs = await executor.run("Research the latest AI safety papers", session_id="s1")
Architecture
agentflow/
agent/ # AgentExecutor, ContextAssembler, PromptTemplate
config/ # ConfigLoader, schemas, parser, ContextResolver
router/ # RouterEngine, RuleEvaluator
workflow/ # WorkflowExecutor, WorkflowDAG, NodeRunner
session/ # SessionManager, Scratchpad, ArtifactStore
memory/ # MemoryManager, FileMemory, VectorMemory
tools/ # ToolRegistry, LocalToolDispatcher, HTTPToolDispatcher
providers/ # Anthropic, OpenAI-compat, Google GenAI, Mock
storage/ # FileSystem, InMemory, S3
events.py # EventBus pub/sub system
types.py # Canonical data types (Message, AgentResponse, etc.)
protocols.py # Structural typing interfaces (LLMProvider, StorageBackend, etc.)
Context File Types
| Extension | Purpose | Example |
|---|---|---|
*.prompt.md |
Agent config + system prompt | agents/planner.prompt.md |
*.workflow.md |
DAG workflow definition | workflows/analysis.workflow.md |
*.context.md |
Shared context / conditional profiles | shared/schema.context.md |
*.memory.md |
Memory retention config | agents/researcher.memory.md |
Testing
pip install -e ".[dev]"
pytest
License
MIT
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 gittielabs_agentflow-0.2.3.tar.gz.
File metadata
- Download URL: gittielabs_agentflow-0.2.3.tar.gz
- Upload date:
- Size: 55.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa6d745321429fa4c2d4f2fdd3700a39201d0a9c3cf5d7dd61045ccb9bb7d098
|
|
| MD5 |
add93f80a07e50f81990c42591e35dd3
|
|
| BLAKE2b-256 |
22762e3a08d23a8a31b0b21e520daa589dd78fa9787821add0ff8d812d8a9d4e
|
File details
Details for the file gittielabs_agentflow-0.2.3-py3-none-any.whl.
File metadata
- Download URL: gittielabs_agentflow-0.2.3-py3-none-any.whl
- Upload date:
- Size: 59.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9ba61089d1008cd08c36c7677f8f7abc8857ce5ec9cb57bdc8790a1ded1ba8a
|
|
| MD5 |
60a90545892d9b38561af77e79115339
|
|
| BLAKE2b-256 |
9aec557150affc77c01817f22fe41685133bbde37f049e3cd931817b4b46d664
|