The idea: give independent work to helpers
A parent agent can create child agents, collect their results, and produce one answer. Local delegation runs children alongside the parent. Workers provide remote execution. A2A is a separate protocol for communicating with other compatible agents.
Try local delegation before adding a server:
mini-a usedelegation=true maxconcurrent=2
Then type:
/delegate Write a three-item checklist for reviewing installation instructions.
/subtasks
Inspect the listed task with /subtask <id>. A completed child result is evidence for the parent to assess, not automatic proof that the overall goal is done. Children can add model usage; set concurrency and execution limits deliberately.
Forking controls which parent context a child receives. The automatic policy chooses a bounded scope; clean requests a fresh task context. Move to workers when you need another machine’s environment, then configure authentication and resource limits explicitly. See delegation parameters.
Delegation
mini-a supports delegating work to child agents for parallel execution and distributed workloads.
Local Child Agents
Enable delegation to let mini-a spawn sub-agents that work on parts of a goal in parallel:
mini-a usedelegation=true
The parent agent decomposes the goal, assigns sub-tasks to child agents, and aggregates their results.
Starting a Worker
Start a headless worker that accepts delegated tasks over HTTP:
mini-a workermode=true onport=8080 apitoken=your-secret-token workername="research-east" workerdesc="US-East research worker"
The worker exposes a REST API. Key endpoints:
| Endpoint | Description |
|---|---|
GET /info |
Server capabilities |
POST /task |
Submit a new task |
POST /status |
Poll task status |
POST /result |
Retrieve final result |
POST /cancel |
Cancel a running task |
GET /healthz |
Health check |
GET /metrics |
Task and delegation metrics |
Submit a task directly via HTTP:
curl -X POST http://localhost:8080/task \
-H "Authorization: Bearer your-secret-token" \
-H "Content-Type: application/json" \
-d '{"goal": "Analyze data and produce summary", "args": {"maxsteps": 10}, "timeout": 300}'
# Poll status
curl -X POST http://localhost:8080/status \
-H "Authorization: Bearer your-secret-token" \
-H "Content-Type: application/json" \
-d '{"taskId": "..."}'
# Get result
curl -X POST http://localhost:8080/result \
-H "Authorization: Bearer your-secret-token" \
-H "Content-Type: application/json" \
-d '{"taskId": "..."}'
Workers also support the A2A HTTP+JSON/REST transport (/message:send, /tasks, /tasks:cancel, /.well-known/agent.json). Enable it on the parent with usea2a=true:
mini-a usedelegation=true usea2a=true workers="http://localhost:8080" apitoken=your-secret-token goal="Coordinate parallel subtasks"
Dynamic Worker Registration
Instead of a static workers= list, workers can self-register and send heartbeats to the parent:
# Parent: start registration server
mini-a usedelegation=true usetools=true \
workerreg=12345 workerregtoken=secret workerevictionttl=90000
# Worker: self-register and heartbeat
mini-a workermode=true onport=8080 apitoken=secret \
workerregurl="http://main-host:12345" \
workerregtoken=secret workerreginterval=30000
Registration endpoints on the parent’s workerreg port: POST /worker-register, POST /worker-deregister, GET /worker-list, GET /healthz. Workers that miss heartbeats are evicted after workerevictionttl milliseconds (default 60 000). This pattern also works with Kubernetes HPA: new pods register on startup and deregister on graceful shutdown.
Remote Workers
Connect to worker APIs running on other machines for distributed execution:
mini-a usedelegation=true workers='http://worker1:8080,http://worker2:8080' apitoken=your-secret-token usetools=true goal="Coordinate parallel subtasks"
Remote workers run their own mini-a instances and accept task assignments from the parent agent. This scales mini-a horizontally across multiple machines.
Concurrency Control
Limit the number of concurrent child agents or worker connections:
mini-a usedelegation=true maxconcurrent=5
Workers can also register themselves dynamically with the parent agent, enabling elastic scaling.
Forked Sub-agents
A forked sub-agent inherits a snapshot of the parent’s context instead of starting with a clean slate. This avoids re-doing research or re-establishing facts the parent has already gathered.
Automatic inheritance (forkpolicy)
Outgoing delegation now defaults to forkpolicy=auto. For each task, Mini-A picks how much parent context the child gets: clean (none), memory (working/session memory), context (recent history or a bounded virtualization view) or full (both, within budgets). Facts already present in the goal aren’t duplicated. A configured decision model may settle ambiguous cases with one bounded choice question (8 KiB input, 2-second timeout, eight per run); otherwise a deterministic rule decides.
mini-a usedelegation=true goal="Coordinate subtasks" # auto (default)
mini-a usedelegation=true forkdecide=false goal="..." # auto, no classifier
mini-a usedelegation=true forkpolicy=legacy goal="..." # previous behavior
| Parameter | Default | Description |
|---|---|---|
forkpolicy |
auto |
auto, legacy, clean, memory, context or full |
forkdecide |
true |
Allow decision-model help for ambiguous automatic inheritance |
forkstatemaxbytes |
65536 |
UTF-8 limit on automatic state plus projected context |
forkpolicy doesn’t enable delegation, tools, shell or memory; those flags work as before. Explicit task values win: fork=false suppresses automatic inheritance (outside legacy), and a per-task forkpolicy overrides the run default for that task only. A forced memory|context|full fails if it can’t fit. Explicit child state or conversation turns automatic inheritance off. clean isn’t a security sandbox, since configured knowledge and shared memory or wiki access still apply. Metrics appear under getMetrics().fork_policy.
Explicit forks
Use fork=true on the delegate-subtask tool call, or /delegate fork <goal> in the console:
# Via console
/delegate fork Write a summary of everything we have found so far
# Via tool call (LLM-driven)
# { "goal": "Summarize findings", "fork": true, "forkscope": ["memory", "context"] }
forkscope controls what is inherited:
| Value | What is passed to the child |
|---|---|
"memory" (default) |
Working memory snapshot (facts, decisions, evidence, etc.) |
"context" |
Last 50 conversation history entries |
Both can be combined: forkscope: ["memory", "context"].
For remote workers the fork state is transmitted as JSON; forkstatemaxbytes (default 64 KB) caps the payload, dropping oldest history entries first if oversized.
# CLI startup task with fork
mini-a usedelegation=true subtasksfile=scouts.yaml goal="Security audit"
# scouts.yaml: [{goal: "Check for issues using existing findings", fork: true}]
Auto-delegation (Noisy Tools)
Auto-delegation automatically intercepts tool results that are too large or verbose for the parent’s context window, replacing the raw observation with a focused summary produced by a sub-agent.
Enable with autodelegation=true (also requires usedelegation=true):
# Summarize shell output larger than 8 KB automatically
mini-a usedelegation=true usetools=true useshell=true \
autodelegation=true \
goal="Run diagnostics on this server and report issues"
# Always summarize specific tools regardless of size
mini-a usedelegation=true usetools=true useshell=true \
autodelegation=true noisytools=shell,web-search \
goal="Research and report on cloud pricing"
# Lower threshold and raise per-step cap
mini-a usedelegation=true usetools=true \
autodelegation=true autodelegationthreshold=2048 autodelegationmaxperstep=4 \
goal="Process multiple large API responses"
| Parameter | Default | Description |
|---|---|---|
autodelegation |
false |
Master toggle (also requires usedelegation=true) |
autodelegationthreshold |
8192 |
Byte length that triggers auto-delegation |
autodelegationmaxperstep |
2 |
Cap on auto-delegations per agent step |
noisytools |
"" |
Comma-separated tool names always delegated regardless of size |
Under the default forkpolicy=auto, the summarization sub-agent runs clean because the tool output is already in its goal. With forkpolicy=legacy, it is forked (inherits working memory) when usememory=true and working memory is non-empty. Auto-delegation cannot cascade — child agents never trigger it.
Pre-specified Startup Scouts
Register sub-agent goals at startup so they run in parallel with (or before) the main loop. Results are harvested into working memory as artifacts.
Inline tasks (pipe-separated):
mini-a usedelegation=true usetools=true useshell=true \
subtasks="List all TODO comments in src/|Count lines of code|Find all test files" \
goal="Give me a project health overview"
Tasks from file (subtasksfile=):
# scouts.yaml
- goal: "Count open GitHub issues"
timeout: 60
- goal: "Summarize recent git commits"
fork: true
- goal: "Check if CI is passing"
args:
maxsteps: 3
mini-a usedelegation=true usetools=true \
subtasksfile=scouts.yaml \
goal="Give project status report"
Sequential execution (run scouts one at a time before the main loop):
mini-a usedelegation=true usetools=true \
subtaskssequential=true \
subtasks="Step 1: gather raw data|Step 2: validate data|Step 3: transform data" \
goal="Run the ETL pipeline and report results"
Console Commands
When delegation is enabled, these commands are available in the interactive console:
/delegate <goal> # Delegate a sub-goal using the session forkpolicy
/delegate fork <goal> # Delegate a forked sub-goal (inherits parent memory + history)
/delegate clean <goal> # No automatic parent context for this task
/delegate auto <goal> # Use automatic inheritance for this task
/delegate -- clean up X # Literal goal that starts with a modifier word
/subtasks # List all subtasks (forked subtasks show a [fork] badge)
/subtask <id> # Show subtask details
/subtask result <id> # Show subtask result
/subtask cancel <id> # Cancel a running subtask
/rewind # Undo last exchange and cancel any active subtasks
/rewind 3 # Undo last 3 exchanges and cancel active subtasks
Timeouts and retries
Workers advertising submission-recovery-v1 and workerInstanceId negotiate same-process submission receipts. Identical retained submissions return the same task ID; changed payloads/instances return 409. After a lost response, Mini-A makes up to three bounded /submission/status lookups without replaying execution. A recovered task resumes observation; cancellation still cancels late-recovered work. Receipts expire with taskretention; restarts, expired receipts and older workers retain Remote outcome unknown, with no automatic resubmission or alternate-worker dispatch.
Legacy /task carries submissionId/workerInstanceId together at top level; A2A carries them in metadata. /submission/status uses the submission bearer/IP policy. IDs allow 1–128 ASCII letters, digits, underscores or hyphens. Metrics expose delegation.remote_submission_recoveries and remote_submission_recovery_failures; remote cancellation is bounded to five seconds. Fork-state limits count serialized UTF-8 bytes, preserve the parent snapshot during trimming, and fail before execution if still oversized.
delegationtimeout (default 300000 ms) is the foreground wait and the initial stall timeout for a local subtask. Activity extends execution, so a working child is not cut off; set delegationhardtimeout for an absolute limit, and delegationstalltimeout for the idle time before a running child counts as stalled. On a worker, defaulttimeout and maxtimeout are total execution limits counted from when execution starts.
delegationmaxretries (default 2) is the maximum number of execution attempts for confirmed failures, including the first. If a remote submission loses its response or returns no task ID, the outcome is unknown and Mini-A does not resubmit: the worker may already be running the goal. Failures before submission remain retryable, and cancellation is attempted only when the current attempt’s remote task ID is known. A cancellation request cannot undo side effects a remote worker already completed. See remote_poll_retries, remote_outcome_unknown, and remote_cancel_failures under getMetrics().delegation.
Inter-Agent Communication
By default delegated agents are isolated: they exchange only the goal and the final result. Set agentcomms to let agents inside one root goal’s delegation tree coordinate live. It uses private, in-memory OpenAF channels owned by the existing subtask manager, so it needs no broker service, parent HTTP listener, persistent storage, or additional model. Leave it unset (or use profiles: [none]) and nothing changes: no communication tools, channels, inbox observations, or remote exchange calls are added. Sending messages and reading state requires usetools=true; use usedelegation=true to create collaborators.
Profiles and grants
Profiles compose, but they do not grant access by themselves. A declaration contains profiles, grants, an optional alias, an optional delegate ceiling, and optional limits. JSON maps and SLON strings are accepted.
| Profile | Required grants | Behavior |
|---|---|---|
none |
none | No communication; cannot be combined with other profiles |
parent-relay |
send / receive |
Exchange intermediate information with the immediate parent or child |
direct |
send / receive |
Address peers through the runtime broker, without invoking the parent’s model |
pubsub |
publish / subscribe |
Fan out to active subscribers of an exact topic name |
shared-state |
read / write |
Version-checked reads and updates of exact state namespaces |
send and receive are arrays of runtime IDs or declared aliases; the reserved name parent resolves to the immediate parent, and both endpoints must permit the relationship. Topics and namespaces are exact names (wildcards are rejected), and agents cannot address agents in another root run. Aliases are unique among active agents, use only letters, digits, underscores, or hyphens, and are at most 64 characters.
Grants are not inherited. delegate is only the ceiling for explicitly requested child declarations; an omitted child declaration is none, even when its parent can communicate. Existing tool policy can further deny operations, and workers add an operator-configured ceiling. These checks protect the communication API; they are not a sandbox for agents that already run arbitrary in-process code.
Example: relay an early finding
Start the parent with:
{
"profiles": ["parent-relay"],
"alias": "coordinator",
"grants": {"send": ["researcher"], "receive": ["researcher"]},
"delegate": {
"profiles": ["parent-relay"],
"grants": {"send": ["parent"], "receive": ["parent"]}
}
}
The parent then calls delegate-subtask with waitForResult: false and a matching child declaration:
{
"goal": "Investigate the failure; relay an early finding if it affects my next action.",
"waitForResult": false,
"agentcomms": {
"profiles": ["parent-relay"],
"alias": "researcher",
"grants": {"send": ["parent"], "receive": ["parent"]}
}
}
The child can call agent-comms with {"action":"send","to":"parent","payload":"The error occurs before the network request."}, and the parent sees an attributed observation before its next model call. Use waitForResult=false for parent collaboration: the blocking default cannot answer questions while waiting for a child. Messages never wake completed agents, invoke an extra model, or wait for a reply, so a child must be able to finish without an answer. For peer review, declare direct on both peers with reciprocal aliases. For shared research, use pubsub with publish: ["findings"] for producers and subscribe: ["findings"] for consumers; only currently registered subscribers receive a publication, and a saturated subscriber rejects the whole fanout.
Tools and shared state
agent-comms exposes only the granted actions among send, publish, and receive. agent-state exposes get for readable namespaces and put/delete for writable ones. Two agents can race to claim a work item:
{"action":"put","namespace":"work","key":"item-1","expectedVersion":0,"value":{"owner":"researcher"}}
Exactly one creation succeeds; the other receives conflict and should read the current value or pick other work. Updates require the returned version, and deletes keep a version tombstone until root shutdown so a stale writer cannot recreate an entry at version zero. This state is separate from memorych, memorysessionch, and forked memory. Outcomes include accepted, ok, pending, denied, unavailable, conflict, full, too_large, rate_limited, invalid, and expired; a successful send means admission to a queue, not that the recipient acted. Received text is attributed external data, never a permission grant or trusted instruction.
Remote workers
Start a worker with apitoken and an explicit agentcomms ceiling. Without both it does not advertise agent-comms-v1, and a communication-enabled task never falls back to a worker lacking that capability. The parent polls the worker’s authenticated /comms endpoint during its normal execution loop, and a per-task token isolates exchanges; no worker-to-worker connection is needed. Remote operations return pending with an operationId, and the correlated result arrives at a later step, so latency depends on the polling interval and queue depth.
Messages and pending operations are transient: cancellation, expiry, worker loss, and root shutdown can discard them. There is no restart recovery or exactly-once guarantee, so use normal delegation results for final answers.
Bounds and observability
The limits keys default to the ceilings below, and configurations may lower them:
| Key | Default |
|---|---|
valueBytes |
8192 UTF-8 bytes per operation |
agentPending / rootPending |
64 / 512 records |
storageBytes |
4194304 channel-record bytes |
perMinute / operations |
60 per agent per minute / 1000 per run |
batchRecords / batchBytes |
8 / 8192 bytes |
ttlMs |
300000 ms, capped by the task lifetime |
stateEntries |
128, including deletion tombstones |
Nothing is evicted silently: small limits return too_large or full. Communication receipt does not reset task activity, and communication-only tool success does not reset the no-progress budget. getMetrics().communication and metricsch snapshots report accepted operations, rejections by reason, deliveries, conflicts, bytes, queue depth, and estimated context tokens. auditch receives comms events with identities, message IDs, and byte counts but no payloads. Explicit full model or debug traces can still contain messages, because they are part of model context. Communication is not an automatic quality or speed gain: compare identical isolated and communicating runs with evaluation suites before enabling it broadly.
Deliverable repair and result acceptance
For automatic read-only or explicitly idempotent tasks, delegationmaxrepairs=2 permits targeted repairs of incomplete deliverables. This is separate from delegationmaxretries, which bounds execution attempts. Repairs use the main model unless a model lock applies; potentially mutating work is not automatically replayed as a repair.
A child’s status=completed means it returned. Check its additive outcome and acceptance (pending, accepted, rejected) before treating it as successful. Dependent tasks require accepted results. Artifact fingerprints are checked before dependent execution and final acceptance; changed evidence requires a fresh check.
When a final answer needs evidence from a particular source, Mini-A keeps the relevant read passages across status polls. If the evidence is missing, the parent can seek it and retry acceptance within the repair budget. If that budget runs out, the partial response retains the original deliverable and identifies the missing evidence.
Register workers step by step
Each worker needs its own model configuration and the permissions/tools for its role. Start with a static worker list before adding dynamic registration:
# Worker terminal (model configured in its environment)
mini-a workermode=true onport=8081 apitoken=TASK_TOKEN \
workername=calc-worker workerspecialties=math
# Main terminal (its own model configured)
mini-a usedelegation=true usetools=true apitoken=TASK_TOKEN \
workers=http://localhost:8081 \
goal="Delegate to the remote worker: calculate 17 times 23."
For registration, keep the main session running with workerreg=12345 workerregtoken=REGISTRATION_TOKEN. Start the worker with the same task token and:
mini-a workermode=true onport=8081 apitoken=TASK_TOKEN \
workername=calc-worker workerspecialties=math \
workerregurl=http://main-host:12345 workerregtoken=REGISTRATION_TOKEN \
workerreginterval=30000 workerurl=http://worker-host:8081
These tokens are placeholders; supply real credentials securely. The main’s apitoken authenticates task calls to the worker. The separate workerregtoken authenticates worker heartbeats to the main. Matching registration credentials do not imply task credentials match.
workerurl is the base URL the main must reach, advertised in registration and the agent card. Its default uses the worker’s own host address and onport, which can be unreachable outside a container. Use a Compose service name, published host port, or per-worker Kubernetes address as appropriate; do not advertise localhost to a main in another container. Each advertised address must identify the same worker throughout task polling.
Inspect /.well-known/agent.json and /healthz, then the registration server’s authenticated /worker-list. Confirm logs actually route to the worker: a main answering locally does not prove remote delegation. Keep workerevictionttl around two to three heartbeat intervals. Clean shutdown deregisters; missed heartbeats evict dynamic entries, while static entries remain. See the process, Docker Compose and Kubernetes walkthrough for complete deployments.