Multi-Agent Planning (MAP)
Multi-Agent Planning (MAP) is AxonFlow's orchestration layer for coordinating multiple AI agents to accomplish complex tasks. MAP breaks down user requests into subtasks, assigns them to specialized agents, and aggregates results—all while enforcing governance policies at every step.
AxonFlow can be used purely as a governance layer around existing agent frameworks (LangChain, LangGraph, CrewAI, AutoGen) without adopting MAP:
- Workflow Control Plane - Add step-level governance gates to your LangChain/LangGraph/CrewAI workflows
- Gateway Mode - Add governance to individual LLM calls
See Choosing a Mode for detailed guidance.
How It Works
Key Components
Planning Engine
The Planning Engine analyzes incoming requests and generates execution plans:
- Query Analysis: Detects intent and required capabilities
- Agent Selection: Chooses appropriate agents based on capabilities
- Step Generation: Creates execution steps with dependencies
- Domain Templates: Uses domain-specific templates (travel, healthcare, finance)
Agent Registry
The Agent Registry manages available agents:
| Mode | Description | Edition |
|---|---|---|
| File-based | Agents defined in YAML configuration files | Community |
| Database-backed | Agents stored in PostgreSQL with CRUD API | Enterprise |
| Hybrid | Both file-based and database agents (DB takes priority) | Enterprise |
Workflow Engine
The Workflow Engine executes plans:
- Step Execution: Runs each step type (llm-call, connector-call, etc.)
- Dependency Management: Ensures steps run in correct order
- Parallel Execution: Runs independent steps simultaneously
- Template Variables: Passes data between steps via
{{input.key}}and{{steps.name.output}}
Step Types
MAP supports five step types for different operations:
| Step Type | Description | Use Case |
|---|---|---|
llm-call | Invoke an LLM provider for inference | Text generation, analysis |
connector-call | Query an MCP connector | Database queries, API calls |
conditional | Branch based on conditions | Decision logic |
function-call | Execute a custom function | Data transformation |
api-call | Call an external HTTP API | Third-party integrations |
See Step Types for detailed configuration.
Agent Types
| Type | Description | Example |
|---|---|---|
| Specialist | Single-domain expertise | Flight search, data analysis |
| Coordinator | Orchestrates other agents | Trip planner, workflow manager |
Execution Modes
| Mode | Description | When to Use |
|---|---|---|
| Sequential | Steps run in order, each receiving previous output | Dependent tasks |
| Parallel | Independent steps run simultaneously | Multiple data sources |
| Conditional | Steps run based on conditions | Decision trees |
Policy Enforcement
MAP integrates with AxonFlow's policy engine to enforce governance at plan execution time. Before a plan executes, policies are evaluated against the plan context.
How Policy Enforcement Works
Plan Execution Request → Policy Evaluation → Execute or Block
↓
┌─────────────────────┐
│ Dynamic Policies │
│ • Risk thresholds │
│ • Cost limits │
│ • Model restrictions│
│ • Domain rules │
└─────────────────────┘
Policy Evaluation in ExecutePlan
When you call executePlan(), the following happens:
- Policy Evaluation: Dynamic policies are evaluated against the plan context
- Decision:
allow,block, orrequire_approval - PolicyInfo in Response: The response includes policy evaluation details
const result = await axonflow.executePlan(planId);
// PolicyInfo shows what policies were evaluated
console.log(result.policyInfo);
// {
// allowed: true,
// applied_policies: ["cost-limit", "model-restriction"],
// risk_score: 0.2
// }
Blocked Plans
If policies block execution, the API returns HTTP 403 with details:
{
"success": false,
"error": "Plan execution blocked by policy",
"policy_info": {
"allowed": false,
"block_reason": "Risk score exceeds threshold",
"matched_policies": ["high-risk-block"]
}
}
Audit Logging
All MAP operations are automatically logged to the audit trail for compliance and debugging.
Operations Logged
| Request Type | When Logged | Data Captured |
|---|---|---|
plan_created | Plan is stored | plan_id, query, domain, step_count |
plan_execution_started | Execution begins | plan_id, domain |
plan_completed | Execution succeeds | plan_id, final_status, policy_info |
plan_failed | Execution fails | plan_id, error_message |
Querying Plan Audit Logs
Use the SDK audit search methods to query MAP audit logs:
# Python SDK
from axonflow.types import AuditSearchRequest
from datetime import datetime, timedelta, timezone
response = await client.search_audit_logs(
AuditSearchRequest(
start_time=datetime.now(timezone.utc) - timedelta(hours=1),
limit=100,
)
)
# Filter by plan operations
for entry in response.entries:
if entry.request_type.startswith("plan_"):
print(f"{entry.request_type}: {entry.query_summary}")
See Audit Logging for more details.
Community vs Enterprise
| Feature | Community | Enterprise |
|---|---|---|
| File-based agent registry | ✅ | ✅ |
| Plan generation | ✅ | ✅ |
| Sequential execution | ✅ | ✅ |
| Parallel execution | ✅ | ✅ |
| All 5 step types | ✅ | ✅ |
| Decision & Execution Replay API | ✅ | ✅ |
| Policy enforcement in plans | ✅ | ✅ |
| Plan audit logging | ✅ | ✅ |
| Database-backed agents | ✅ | |
| Agent CRUD API | ✅ | |
| Agent versioning | ✅ | |
| Multi-tenant isolation (RLS) | ✅ | |
| Execution analytics dashboard | ✅ | |
| Compliance export (PDF/CSV) | ✅ |
Quick Example
1. Define an Agent
# agents/research-agent.yaml
apiVersion: axonflow.io/v1
kind: AgentConfig
metadata:
name: research-agent
domain: generic
spec:
type: specialist
description: Research and summarize information
capabilities:
- research
- summarization
llm:
provider: openai
model: gpt-4
2. Generate a Plan
All MAP requests go through the AxonFlow Agent (port 8080), which handles authentication and policy enforcement before routing to the Orchestrator.
# Generate a plan via Agent proxy
curl -X POST http://localhost:8080/api/request \
-H "Content-Type: application/json" \
-H "X-Org-ID: my-org" \
-d '{
"query": "Research the benefits of remote work",
"request_type": "multi-agent-plan",
"context": {
"domain": "generic"
}
}'
Response:
{
"success": true,
"data": {
"plan_id": "plan_abc123",
"steps": [...]
},
"policy_info": {
"static_checks": ["sql_injection", "pii_detection"],
"processing_time": "4.2ms"
}
}
3. Execute the Plan
# Execute the generated plan
curl -X POST http://localhost:8080/api/request \
-H "Content-Type: application/json" \
-H "X-Org-ID: my-org" \
-d '{
"query": "execute",
"request_type": "execute-plan",
"context": {
"plan_id": "plan_abc123"
}
}'
Using the SDK
For production use, prefer the SDK methods which handle authentication and error handling:
TypeScript:
// Generate a plan
const plan = await axonflow.generatePlan(
"Research the benefits of remote work",
"generic" // domain
);
// Execute the plan
const result = await axonflow.executePlan(plan.planId);
Go:
// Generate a plan
plan, err := client.GeneratePlan(
"Research the benefits of remote work",
"generic", // domain
)
// Execute the plan
result, err := client.ExecutePlan(plan.PlanID)
Next Steps
- Getting Started - Set up your first multi-agent workflow
- Agent Configuration - Learn the full agent YAML schema
- Step Types - Deep dive into each step type
- Planning Patterns - Common orchestration patterns
- Decision & Execution Replay API - Debug and audit workflow executions with policy decisions
- Workflow Control Plane - Add governance gates to external orchestrators (LangChain, LangGraph, CrewAI)
Enterprise Features
For database-backed agents, CRUD APIs, versioning, and analytics:
- Enterprise MAP Guide - Full enterprise documentation
- Request a Demo - See MAP in action