Configuration
Records
member() returns a Member, and swarm(budget=...) takes a Budget. They are on their own page because Member and member() would share a heading anchor on one page.
Member
A swarm member: a built agent, or a registered @agent factory and its arguments.
Create one with member(), which documents the fields and the member contract.
class Member(BaseModel)Attributes
agentAgent | None-
A built, registered agent. Exactly one of
agentandfactoryis set. factoryAgentFactory | None-
A registered
@agentfactory, called withargsto build the member’s agent. argsdict[str, Any]-
The factory’s keyword arguments.
namestr | None-
The member’s name.
Noneuses the agent’s or factory’s unqualified registry name. rolestr | None-
The member’s role, given to the controller and in the member’s preamble.
countint-
How many members this record stands for. Above 1 needs the factory form.
limitslist[Limit]-
The member’s own limits.
bridgedbool | None-
Whether the member’s agent is bridged.
Nonecounts agents in theinspect_swe/namespace as bridged. deliveryLiteral['notify', 'poll'] | None-
The member’s configured delivery mode:
notifyorpoll.Noneselectsnotify. Innotifymode, swarm_on_continue() adds notices to the member’s conversation; inpollmode it adds none, and the member learns of changes from the status line that ends a shared memory result and fromswarm_waitresults. sandboxstr | None-
The member’s own sandbox environment, where
{member}stands for the member’s name.Noneshares the sample’s sandbox. visible_sandboxeslist[str]-
Other sandbox environments the member can reach by name, such as a shared service. Only with
sandbox.
Budget
The swarm-wide budget.
By default the swarm derives its caps from the sample’s cost, token and time limits when it starts, holding back reserve of each. The caps are stopping rules: when one is reached the swarm stops its members, gives them up to grace seconds to finish the calls they have in flight, and then cancels the members still running. If the sample has a time limit, the grace period is capped at half its remaining time.
Every field is a plain value, so each can be a task parameter, and two budgets that differ in any field are logged as different arguments.
class Budget(BaseModel)Attributes
costfloat | None-
Swarm cost cap in dollars.
Nonederives it from the sample’s cost limit. tokensint | str | None-
Swarm token cap. A string such as
"output:1m"is parsed byparse_token_limit()and keeps its metering type.Nonederives it from the sample’s token limit, with that limit’s metering type. timefloat | None-
Seconds after which the swarm stops its members.
Nonederives it from the sample’s time limit. reservefloat-
Fraction of each sample limit held back when a cap is derived.
splitLiteral['pool', 'equal'] | tuple[float, ...]-
How the cost and token caps are divided between members: one shared pool, equal shares, or one weight per member in roster order. A member that uses up its share stops, and its unused share is not given to the others.
gracefloat-
Seconds members have, at most, to finish calls already in flight after a stop. If the sample has a time limit, this period is capped at half its remaining time.