All writing
Agent architecture

Before you build
another agent

Build a strong generalist. Make expertise discoverable. Delegate only when the task earns it.

Updated · Revision notes

On this page · 8 min read
  1. Keep the investigation coherent
  2. Make expertise discoverable
  3. Allow only bounded dynamic delegation
  4. Delegate a question you can verify
  5. Test whether the boundary adds value
  6. Use one harness across product surfaces
  7. A decision you can make before delegation

“Our application became slow after the release.”

A smaller connection pool can trigger queueing, retries, and more load. A deployment agent, a database agent, and a networking agent might each identify a symptom. The diagnosis depends on connecting them.

For an assistant that works across products, build one capable generalist as the primary agent. Give it a harness that progressively exposes the knowledge and tools it needs. Permit additional agents only as temporary, dynamically delegated subagents with enforced limits.

Permanent specialists are separately routed agents with fixed domain roles. Stable, repetitive workloads can make that routing attractive: context and latency are easier to tune. For a cross-product assistant, however, routing, context transfer, and reconciliation also create opportunities for coordination failures. A specialist label adds no capability by itself. Preserve distinct capabilities through model selection, authorized tools, and scoped domain memory.

Keep the investigation coherent#

The generalist needs durable task state: the objective, evidence, hypotheses, and open questions. Preserve it across compaction and restarts, with links to source artifacts. This lets the agent connect a deployment change to database behavior several steps later.

One coherent investigationA latency regression reaches the generalist primary agent. It discovers deployment tools, retrieves database knowledge, and inspects network evidence. These sources feed hypothesis evaluation. The investigation either continues with the next diagnostic or produces findings and a next action. Latency regression After the release Primary agent GeneralistDurable task state Deployment Discovertools Database Retrieveknowledge Network Inspectevidence Evaluate hypotheses Next diagnostic ↺ Findings And next action
The investigation crosses domains while the primary agent retains the evidence and responsibility for the answer.

The harness is the runtime around the model: context management, tool discovery, code execution, permissions, and recovery. Build these capabilities once and reuse them across tasks.

Make expertise discoverable#

Progressive disclosure gives the agent broad reach with focused context. Start with a compact knowledge index and tool catalog. Retrieve relevant documents, discover tool schemas on demand, and load procedures as needed. The generalist can follow the investigation from deployments to databases while retaining its context.

Package expertise as reusable skills: diagnostic principles, procedures, examples, and scripts. Filter large tool results in code before adding them to context. Product teams contribute knowledge, tools, and evaluations to the shared harness.

Discovery is a capability to test. SkillsBench found that curated skills improved average pass rates, while some tasks regressed. A study of realistic skill retrieval found that gains weakened when agents had to find and select relevant skills. Test the path from symptom to useful context to correct tool use; preload essentials when latency matters.

If supplying the right material fixes a failure, improve discovery. If it does not, investigate the model, tool, or procedure before adding agent boundaries.

Allow only bounded dynamic delegation#

A subagent is a temporary execution created through the primary agent’s delegation tool. Require three things: a separable question, a reason for separate execution—parallel progress, context isolation, or independent review—and a result the primary agent can verify without repeating the investigation. Simple lookups and predictable procedures belong in tools, scripts, or deterministic workflows.

Dynamic-only delegation is the policy proposed here. The evidence supports choosing by task structure: a controlled study of 260 configurations across six benchmarks, with matched compute budgets, found gains on decomposable financial tasks and losses on sequential planning tasks.

Anthropic’s research system demonstrates parallel research followed by synthesis. Its reported gains also involved different models and more compute. Neither result establishes that dynamic delegation is universally best.

The primary agent proposes the work; the runtime enforces the limits:

LimitRuntime enforcementPurpose
CreationPrimary agent only; require a current-task contractKeep spawning under one owner
LifetimeCreate a task-scoped execution; end it on completion, timeout, or parent terminationKeep delegation temporary
Fan-outCap concurrent executions and total launches, including retriesPrevent unbounded spawning
DepthSubagents cannot delegate furtherPrevent recursive expansion
ResourcesReserve from the parent budget; cap time and tool callsBound total task cost
AccessRestrict data and tools to the parent’s authorityPrevent privilege expansion

Do not install routes that automatically send database questions to a database agent. Templates can supply instructions; delegation must be chosen for the current task. Subagents use the same harness with isolated state. Depth one gives up nested delegation to keep ownership and budget accounting simple.

Mandatory checks and approvals belong in runtime policy or deterministic workflows. If delegation is denied, continue directly, narrow the task, or escalate within the same limits.

Delegate a question you can verify#

In the latency investigation, the generalist can trace request flow while a subagent asks: “Did this release change connection pool behavior?” Its contract includes the deployment diff, telemetry, documentation, and read-only tools. The result must include findings, source evidence, counterevidence, uncertainty, and completion status.

Suppose the diff shows a pool limit falling from 100 to 20. That establishes a change, not its causal role. The generalist checks whether connection wait time rose with the release and proposes a controlled test. Evidence that does not fit stays visible.

A separate review can challenge this explanation. Withhold the preferred conclusion where practical, and give the reviewer the evidence. Fresh context can still share model blind spots, so review complements tests and external evidence.

The real limit on fan-out is also the capacity to verify. Ten plausible summaries can leave the generalist with more work than it started with. Source artifacts and explicit uncertainty make each finding easier to check and reconcile.

As evidence arrives, database and network checks may converge on the same bottleneck. The generalist can combine their findings and cancel redundant branches. Adaptive delegation research proposes this flexibility; its benefit still needs validation on the actual workload.

Trace each contract, tool call, artifact, and result under the parent task. Propagate cancellation and release reservations. Preserve partial results for recovery without resetting budgets or treating unfinished output as verified.

Test whether the boundary adds value#

Compare the generalist, generalist with delegation, and any existing specialist system. Give them equivalent useful knowledge, state access, tools, and model capabilities. Use held-out tasks within and across domains. At matched budgets, measure quality, latency, total cost, and recovery failures—including discovery, retries, and verification. Then measure what extra spend buys.

If specialists win, isolate the cause. Supply the generalist with the same relevant context; then test separate execution and parallelism. If the gap persists, block migration while addressing the measured limitation. The proposed architecture must meet the required quality and latency targets.

Re-evaluate after model upgrades. Experiments with long-running agents found that stronger models reduced the need for some scaffolding, while evaluation still helped on harder tasks. Retire orchestration that no longer earns its cost.

Use one harness across product surfaces#

Customer-facing, personal, team, and internal operations agents can share this generalist design. Separate their identities, credentials, memory, and execution environments as required. Multi-tenant and dedicated deployments can reuse the harness while enforcing distinct access boundaries.

Keep expertise reusable, ownership coherent, and delegation temporary.

Optional delegation contract

This illustrative contract describes one dynamic subagent execution. Subagent mechanisms supply the execution primitives; the runtime enforces the policy. Numeric limits are examples to tune through evaluation.

# Illustrative policy and request, not a specific SDK schema.
runtime_policy:
  creation: primary_agent_only
  contract_scope: current_parent_task
  lifetime: until_completion_timeout_or_parent_termination
  max_concurrent_subagents: 2
  max_total_launches: 4  # Includes retries.
  max_depth: 1          # Subagents cannot delegate.
  budget_source: parent_task
  require_reservation: true
  permission_ceiling: parent_grants
  propagate_cancellation: true

delegation_request:
  objective: Check whether the release changed connection pool behavior
  model_class: strong
  reasoning_effort: high
  context: explicit_authorized_evidence
  tools: [deployments.diff, metrics.query, logs.search]
  actions: read_only
  memory: task_artifacts_only
  limits:
    timeout_seconds: 120
    max_tool_calls: 12
    max_output_tokens: 2000
  result: [findings, evidence, counterevidence, uncertainty, status]

The runtime rejects requests outside policy, accounts for aggregate usage, and records the effective contract. Output limits do not replace a total token or spend budget. Subagent results remain evidence for the primary agent to evaluate.

The runtime checks the contract before creating a subagent. This example shows admission, rejection, and completion under the same policy.

Admitted

AdmittedThe runtime reserves capacity, creates a temporary execution, and returns evidence for the primary agent to verify. Admit Deny Primary agent Current-task contract Runtime admission Scope, grants and budget Create subagent Same harnessIsolated task state Reject request No execution End execution Release reservationRetain evidence Primary continues Narrow, proceedor escalate Primary verifies Inspect resultKeep source evidence
The runtime reserves capacity, creates a temporary execution, and returns evidence for the primary agent to verify.

Budget exhausted

Budget exhaustedNo capacity can be reserved. No subagent is created; the primary agent must continue within the remaining limits. Admit Deny Primary agent Current-task contract Runtime admission Scope, grants and budget Create subagent Same harnessIsolated task state Reject request Budget exhausted End execution Release reservationRetain evidence Primary continues Narrow, proceedor escalate Primary verifies Inspect resultKeep source evidence
No capacity can be reserved. No subagent is created; the primary agent must continue within the remaining limits.

Access denied

Access deniedThe requested tool exceeds the parent task’s authority. Delegation cannot expand permissions. Admit Deny Primary agent Current-task contract Runtime admission Scope, grants and budget Create subagent Same harnessIsolated task state Reject request Tool outside scope End execution Release reservationRetain evidence Primary continues Narrow, proceedor escalate Primary verifies Inspect resultKeep source evidence
The requested tool exceeds the parent task’s authority. Delegation cannot expand permissions.

Parent canceled

Parent canceledThe subagent stops, unused capacity is released, and partial results remain marked incomplete. Admit Deny Primary agent Current-task contract Runtime admission Scope, grants and budget Create subagent Same harnessIsolated task state Reject request No execution Cancel execution Release reservationRetain evidence Primary continues Narrow, proceedor escalate Preserve artifacts Incomplete outputNo further execution
The subagent stops, unused capacity is released, and partial results remain marked incomplete.

A decision you can make before delegation

Task shapeFirst choiceReason to change
One evolving diagnosis, shared evidenceOne generalist and deterministic toolsA separable investigation has a precise return contract
Independent inspections of disjoint modulesBounded temporary childrenIntegration cost or conflicting assumptions erase the time saved
Repeated mechanical transformationOrdinary codeInputs genuinely require judgment

A delegation that loses: three children inspect the same flaky integration test with incomplete logs, each proposes a different cause, and the parent repeats all three investigations. Parallel activity increased cost without producing independent evidence. Measure accepted work after integration, not completed child messages. Default to depth one, shared harness behavior, explicit deadlines, and a parent-owned final decision.

Search titles, article text, and concepts.

Start typing to search the writing.