Skip to main content

Module tools_delegate

Module tools_delegate 

Source
Expand description

The delegate tool: hand one job to a child agent on a route of its own.

A child is an Agent, not a second loop. It has the provider of the route it was sent to, a session of its own that the parent never sees, a preamble that says what it is, a small iteration budget and the same tools as the parent minus this one. It runs to its final answer, and that text is the tool’s result; what it cost is reported beside it, separately, so the parent’s own usage line does not quietly absorb it.

This is a cap, not a scheduler. A child cannot delegate (the tool is not in its registry), a run may start at most MAX_CHILDREN_PER_RUN, and there is no queue, no background run and no write to the parent’s session: the parent’s transcript holds the call and the answer. A child that fails is a tool result with the reason, which the model reads like any other.

Structs§

ChildLedger
The children one run has started: how many (the cap), and what each cost (the readout). One per run, so two runs on one agent do not share a cap.
ChildOutcome
What a child cost and what it said — the one shape both surfaces report (#171).
ChildRoute
A route as a child needs it: a provider of its own and the per-agent settings that belong to that route.
ChildRun
What one child cost and how it ended.
ConfigRoutes
ChildProviders over the configuration’s routes.
DelegateSettings
What a child is built with that does not depend on the call.
DelegateTool

Constants§

DEFAULT_CHILD_ITERATIONS
The budget a child gets when the call names none. Each iteration is a request to a possibly big model; six is enough to look at a few things and answer, and short enough that a child that is wandering is stopped before it is expensive.
MAX_CHILDREN_PER_RUN
The most children one run may start. A child is a request to a possibly bigger model that may run tools, so the bound is on spend, and four is room for a few independent jobs without leaving a model free to fan out on every turn.
MAX_CHILD_ITERATIONS
The most a call may ask for. A job that needs more is a job to split.

Traits§

ChildProviders
Where children get their providers. A trait so the tool can be tested without a server and so it never holds the configuration itself.

Functions§

describe_children
The line a run that delegated prints beside its own usage, or None when nothing was delegated. The children’s cost is summed here and nowhere else, so it is never merged into the parent’s token count.