Skip to main content

Context engineering framework for multi-agent systems

Project description

AgentFlow

PyPI version Python 3.11+ License: MIT CI

Context engineering framework for multi-agent systems.

AgentFlow is a framework-agnostic toolkit for building multi-agent workflows using plain Markdown and YAML configuration files. Define agents, workflows, routing rules, and context -- all in version-controllable .md files.

Full Documentation | PyPI | GitHub

Key Features

  • Markdown + YAML config files -- Agents, workflows, and routing defined in .prompt.md, .workflow.md, .context.md files
  • Pluggable LLM providers -- Anthropic Claude, OpenAI GPT, Google Gemini, or any OpenAI-compatible API
  • Hybrid routing -- YAML rule matching with LLM fallback, plus hierarchical domain routing
  • DAG-based workflows -- Sync, parallel, and async node execution with input mapping
  • Code handler nodes -- Register Python functions as workflow steps for deterministic processing without LLM calls
  • Foreach iteration -- Run any node (agent or handler) once per item in a list artifact
  • Session management -- Scratchpads, multi-user history, and artifact storage
  • Memory system -- File-based and vector search (embedding-agnostic)
  • Tool registry -- Local and HTTP tool dispatchers with structured raw_result in events
  • Event-driven observability -- EventBus with Langfuse telemetry (session, trace context, resource attributes)

Install

pip install gittielabs-agentflow

# With a specific LLM provider
pip install "gittielabs-agentflow[anthropic]"    # Claude
pip install "gittielabs-agentflow[google]"       # Gemini
pip install "gittielabs-agentflow[openai]"       # OpenAI / compatible

# Everything
pip install "gittielabs-agentflow[all]"

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")

See the Quick Start guide for a complete walkthrough.

Architecture

agentflow/
  agent/          # AgentExecutor, ContextAssembler, PromptTemplate
  config/         # ConfigLoader, schemas, parser, ContextResolver
  router/         # RouterEngine, DomainRouter, 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
  orchestration/  # DAGExecutor, ComplexityClassifier, Plan
  telemetry/      # LangfuseEventHandler
  events.py       # EventBus pub/sub system
  types.py        # Canonical data types (Message, AgentResponse, etc.)
  protocols.py    # Structural typing interfaces (LLMProvider, StorageBackend, etc.)

Learn more in the Architecture docs.

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
*.domain.md Domain routing boundary domains/content.domain.md

See Context Files for full schema reference.

Documentation

Full documentation is available at gittielabs.github.io/agentflow, including:

Contributing

git clone https://github.com/GittieLabs/agentflow.git
cd agentflow
pip install -e ".[dev]"
pytest

License

MIT

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

gittielabs_agentflow-0.7.7.tar.gz (66.7 kB view details)

Uploaded Source

Built Distribution

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

gittielabs_agentflow-0.7.7-py3-none-any.whl (67.9 kB view details)

Uploaded Python 3

File details

Details for the file gittielabs_agentflow-0.7.7.tar.gz.

File metadata

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

File hashes

Hashes for gittielabs_agentflow-0.7.7.tar.gz
Algorithm Hash digest
SHA256 02de7f08a2a814de49d392aa9ffae7b09601e37796a5b47f4bbce76393453408
MD5 1071eed620422a332601c904b8fc3828
BLAKE2b-256 8b69bd4989201f2b5a3b14098d47464a5036009f42fb6b33ed33dfa61ba7ea59

See more details on using hashes here.

Provenance

The following attestation bundles were made for gittielabs_agentflow-0.7.7.tar.gz:

Publisher: release.yml on GittieLabs/agentflow

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

File details

Details for the file gittielabs_agentflow-0.7.7-py3-none-any.whl.

File metadata

File hashes

Hashes for gittielabs_agentflow-0.7.7-py3-none-any.whl
Algorithm Hash digest
SHA256 32fe1e3bbab90a380ab856ef2a7f7a1ab47d62a24e5d7df6e0073d212d3f886e
MD5 76d0fb1923be5fba9a24c939244f4340
BLAKE2b-256 839322fbd614c516814eac0a94fde6a36b51b77195cd37a4be6fd65d139a8f7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for gittielabs_agentflow-0.7.7-py3-none-any.whl:

Publisher: release.yml on GittieLabs/agentflow

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