Agent Orchestration
WASP supports running multiple autonomous sub-agents simultaneously, each with independent objectives, goal queues, and execution contexts.
Use Cases
- Parallel research: Run 5 agents researching different topics simultaneously
- Monitoring agents: Long-running agents that watch prices, RSS feeds, or system metrics
- Specialized agents: Agents optimized for specific domains (coding, web scraping, data analysis)
- Hierarchical teams: Meta-agent supervises a team of specialists
Creating Agents
Via Telegram/Dashboard:
agent_manager(
action="create",
name="btc_monitor",
objective="Check BTC price every hour and alert if it changes by more than 3%",
priority=6
)
Via API:
curl -b cookies.txt -X POST https://agentwasp.com/api/agents \
-H "Content-Type: application/json" \
-d '{
"name": "research_agent",
"objective": "Daily: check top AI news and summarize to memory",
"priority": 5
}'
Agent vs. Goal
Key distinction:
- A Goal is a single objective with a defined end state
- An Agent is a persistent entity that can pursue multiple goals over time
An agent can be:
- Restarted with new goals after completing each one
- Paused and resumed
- Given recurring reminders to trigger new goal cycles
Recurring Agent Patterns
The most powerful pattern: create an agent, then set a reminder to restart it periodically:
# Create the agent
agent_manager(action="create", name="daily_digest", objective="Compile daily news digest")
# Then set a recurring reminder linked to the agent
create_reminder(
message="Compile daily news digest",
time="09:00",
recurring="daily",
agent_id="<agent-id-from-above>"
)
When the reminder fires, ReminderCheckerJob calls agent_orchestrator.create_agent_goal(), restarting the agent's execution cycle.
Agent Priority
| Source | Priority | Notes |
|---|---|---|
| User-created agent | 8 | High priority |
| Agent-created agent | 6 | Medium |
| Autonomous agent | 3 | Low priority |
Higher-priority agents get their goal ticked first in each cycle.
Managing Agents
# List all agents
agent_manager(action="list")
# Pause an agent
agent_manager(action="pause", agent_id="...")
# Resume a paused agent
agent_manager(action="resume", agent_id="...")
# Archive (delete) an agent
agent_manager(action="archive", agent_id="...")
Resource Limits
The global token budget prevents agents from consuming all LLM capacity:
agents_global_token_budget_per_minute = 100_000
When this budget is exceeded, agent ticks are paused until the next minute window.
Individual agents can also be given their own token budgets via the goal orchestrator.
Multi-Agent State Isolation
Each agent has isolated:
- Goal queue (separate goal IDs in Redis)
- Execution context (separate
chat_idfor notifications) - Memory access (agents can read shared memory but write to their own namespace)
Agents do NOT have isolated:
- Skill registry (all agents use the same skills)
- Model manager (all agents share the same LLM providers)
- PostgreSQL (all agents write to the same database)
Meta-Agent Supervisor (Advanced)
When META_AGENT_ENABLED=true, the MetaSupervisor can coordinate agent teams:
meta_orchestrate(
objective="Research and compare the top 5 Python web frameworks",
team_size=5,
strategy="parallel_then_synthesize"
)
The supervisor:
- Decomposes the objective into specialized sub-tasks
- Creates 5 specialized agents (one per framework)
- Monitors progress across all agents
- When all complete, synthesizes the results into a unified report
Currently disabled by default (META_AGENT_ENABLED=false).
Debugging Agents
# View all agent state in Redis
docker exec agent-redis redis-cli HGETALL agents
# View a specific agent
docker exec agent-redis redis-cli HGET agents <agent-id>
# View agent in PostgreSQL (survives Redis flush)
docker exec agent-postgres psql -U agent -d agent -c \
"SELECT id, name, status, priority, created_at FROM agents ORDER BY created_at DESC;"
# View goals for an agent
docker exec agent-redis redis-cli HGETALL goals | python3 -c "
import sys, json
data = sys.stdin.read().split('\n')
goals = [json.loads(data[i+1]) for i in range(0, len(data)-1, 2)]
for g in goals:
if g.get('source') == 'agent':
print(f'{g[\"id\"]}: {g[\"objective\"]} ({g[\"status\"]})')
"
Performance Considerations
With many active agents:
- Each agent ticks every 15 seconds
- Each tick can execute up to 3 steps
- LLM calls are the bottleneck (each step = 1 LLM call minimum)
For 5 agents running simultaneously:
- Minimum: 5 LLM calls per 15s = 20 calls/minute
- With
AGENTS_GLOBAL_TOKEN_BUDGET_PER_MINUTE=100000, this is easily within budget for fast models