How to Build a Multi-Agent System With ATXP
Single-agent systems hit a ceiling. They’re sequential, they accumulate context, and they’re hard to parallelize. When your task complexity grows — research + writing + fact-checking + publishing, all happening concurrently — the right answer is multiple specialized agents working together.
Building that correctly requires solving a problem most tutorials ignore: each agent needs its own identity and budget. ATXP handles both natively.
What Is a Multi-Agent System?
A multi-agent system is an architecture where an orchestrator breaks down a task and delegates subtasks to specialized sub-agents. Each sub-agent handles a specific capability domain. The orchestrator coordinates, collects results, and produces final output.
Orchestrator
├── Sub-Agent A: Web Research
├── Sub-Agent B: Data Analysis
├── Sub-Agent C: Content Writing
└── Sub-Agent D: Email Delivery
Sub-agents run in parallel or in sequence, depending on dependencies. This architecture scales well: you add capabilities by adding agents, not by making one agent more complex.
The design question most developers skip: what account does each agent use?
Why Each Agent Needs Its Own Account
Giving all agents access to the same credentials creates three problems.
Cost attribution. You can’t tell which agent drove which charges. Debugging an expensive run means guessing which sub-agent consumed 400 tool calls.
Budget control. If agents share a balance, one runaway agent can exhaust the budget for the entire system. You want each agent to have a ceiling.
Identity isolation. If your research agent and your email agent share an identity, they share an email address, shared rate limits, and shared reputation. Isolation is cleaner and safer.
The right model: one account per agent, funded with the budget it needs for its task.
| Concern | Shared Account | Per-Agent Account |
|---|---|---|
| Cost attribution | Impossible | Exact, per-agent |
| Budget control | Shared ceiling | Individual ceilings |
| Identity | Shared address/credentials | Isolated per agent |
| Failure blast radius | One failure affects all | Failures are isolated |
| Auditability | Noisy logs | Clean per-agent logs |
How ATXP Handles Multi-Agent Identity and Billing
Each npx atxp call creates a new account: a unique identity, an @atxp.email address, and a fresh IOU balance. For multi-agent systems, you create one account per agent role.
# Create accounts for each agent role
npx atxp --name orchestrator-agent
npx atxp --name research-agent
npx atxp --name writing-agent
npx atxp --name delivery-agent
Each account gets its own credentials. You load IOU tokens onto each one based on expected spend. The orchestrator can also transfer tokens to sub-agents programmatically — funding them per task.
import atxp
orchestrator = atxp.Client(account="orchestrator-agent")
# Fund a sub-agent before delegating a task
orchestrator.payments.transfer(
to_account="research-agent",
amount=0.50 # $0.50 in IOU tokens for this task
)
See also: IOU token spending limits for how to configure per-agent budgets.
Building an Orchestrator + Sub-Agent Pattern
Here’s a complete implementation of a parallel research and writing system:
import atxp
import concurrent.futures
# Each agent has its own client
orchestrator = atxp.Client(account="orchestrator-agent")
researcher = atxp.Client(account="research-agent")
writer = atxp.Client(account="writing-agent")
mailer = atxp.Client(account="delivery-agent")
def research_task(topic: str) -> str:
"""Sub-agent: research a topic and return summary."""
results = researcher.tools.web_search(query=topic, num_results=6)
pages = []
for r in results[:3]:
page = researcher.tools.browse(url=r["url"])
pages.append(page["content"][:2000])
summary = researcher.tools.llm(
prompt=f"Summarize key insights on: {topic}\n\nSources:\n" + "\n".join(pages),
model="claude-3-5-haiku"
)
return summary["text"]
def write_task(research: dict) -> str:
"""Sub-agent: write a report from research results."""
combined = "\n\n".join([f"## {k}\n{v}" for k, v in research.items()])
draft = writer.tools.llm(
prompt=f"Write a comprehensive report from this research:\n\n{combined}",
model="gpt-4o"
)
return draft["text"]
def deliver_task(content: str, recipient: str):
"""Sub-agent: deliver final output via email."""
mailer.tools.email.send(
to=recipient,
subject="Research Report Ready",
body=content
)
def run_pipeline(topics: list, recipient: str):
# Phase 1: Research in parallel
research_results = {}
with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor:
futures = {executor.submit(research_task, t): t for t in topics}
for future in concurrent.futures.as_completed(futures):
topic = futures[future]
research_results[topic] = future.result()
# Phase 2: Write from aggregated research
report = write_task(research_results)
# Phase 3: Deliver
deliver_task(report, recipient)
print("Pipeline complete.")
run_pipeline(
topics=["AI agent payments", "multi-agent architectures", "agentic commerce"],
recipient="team@yourcompany.com"
)
Run npx atxp to provision each agent account. Each account is isolated, separately funded, and billed independently.
Cost Management Across Agents
With per-agent accounts, you have full visibility into where costs are going.
| Agent Role | Typical Tool Calls | Approx Cost/Run |
|---|---|---|
| Orchestrator | LLM coordination only | $0.002–$0.005 |
| Research (3 topics) | 6 searches + 9 page reads | $0.12–$0.22 |
| Writing | 1 LLM pass (long) | $0.005–$0.015 |
| Delivery | 1 email | $0.001 |
| Total per pipeline run | ~$0.13–$0.24 |
Compare this to a monolithic agent running the same pipeline: same cost, but no attribution. You can’t tell which step is getting expensive, and you can’t put a ceiling on any one step.
With ATXP’s per-agent model, you can cap the research agent at $0.30, the writing agent at $0.05, and the delivery agent at $0.01. If research runs over, it fails cleanly without taking the writing agent down with it.
This is the model that scales. One agent per capability. One account per agent. Budget per task, not per month.
See also: What is an AI agent? · Agent payments and identity · IOU token spending limits
Ready to build your multi-agent system? Run npx atxp — provisioning takes under a minute.