Team
Your code's handle on a team: RunResult.team, or openTeam.
Every request is recorded in the team log as the principal it acts for; only busy, returned before the log could be written, is not.
Properties
refTeamRefrequiredThis team's tenant and id.
Methods
start
Starts a member from an agent the team lists, with task as its first input. Recorded in the team log as an operator request.
start(agent: Name, task: string, options?: {
budget?: Budget;
label?: string;
instructions?: string;
tools?: readonly string[];
model?: string;
idempotencyKey?: string;
}): Promise<TeamStartResult>agentNamerequiredThe agent to start, by name.
taskstringrequiredThe member's first input; it sees nothing else.
budgetBudgetThe member's own budget, capped by policy. Omitted: the agent's own budget.
labelstringA display name for the member, 1-64 characters with no control or format character, not operator. Never hashed and never shown to a model. Omitted: none.
instructionsstringA dynamic agent only: instructions added after the template's own, in a block marked as written by operator. At most 16 KiB. Omitted: the template's alone.
toolsreadonly string[]A dynamic agent only: the member's tools, a subset of the template's (the framework tools are always kept). Omitted: all of the template's.
modelstringA dynamic agent only: a key of the template's models. Omitted: the first key.
idempotencyKey / idempotency_keystringMakes a retry safe: the same key, principal and body return (or re-attach to) the first request's outcome. Scoped to this team and operation. Omitted: every call is a new request.
send
Sends a message to a member. It arrives as the member's next input and wakes it if idle.
send(to: MemberRef, text: string, options?: {
idempotencyKey?: string;
}): Promise<TeamSendResult>toMemberRefrequiredThe member, at the generation you know. See MemberRef.
textstringrequiredThe message.
idempotencyKey / idempotency_keystringMakes a retry safe: the same key, principal and body return (or re-attach to) the first request's outcome. Scoped to this team and operation. Omitted: every call is a new request.
ask
Asks a member a question and waits for its reply, its end, or the deadline. Addressed to the team's lead it is refused lead: only members run a turn that could reply.
ask(to: MemberRef, question: string, options?: {
timeoutMs?: PosInt;
idempotencyKey?: string;
}): Promise<TeamAskResult>toMemberRefrequiredThe member to ask; the team's lead is refused lead. See MemberRef.
questionstringrequiredThe question.
timeoutMs / timeout_msPosIntHow long to wait, a positive integer. Omitted: the host policy, initially 120 s, and never more than it. Zero, a negative, a fraction or a non-finite value is refused invalid_request before anything is recorded.
idempotencyKey / idempotency_keystringMakes a retry safe: the same key, principal and body return (or re-attach to) the first request's outcome. Scoped to this team and operation. Omitted: every call is a new request.
Throws StoreCorruptError when the stored log doesn't verify.
wait
Waits until members settle (become idle or end), or the deadline. Settlement is durable evidence: a member that went idle and started again still counts.
wait(members: readonly MemberRef[], options?: {
mode?: "all" | "any" | PosInt;
timeoutMs?: PosInt;
idempotencyKey?: string;
}): Promise<TeamWaitResult>membersreadonly MemberRef[]requiredThe members to wait for: frozen at the call. An empty list is refused invalid_request.
mode"all" | "any" | PosIntdefault allall, any, or how many must settle. any never cancels the others. Anything else is refused invalid_request before anything is recorded: another string, or a number that is not a positive integer or is above the count of distinct members.
timeoutMs / timeout_msPosIntHow long to wait, a positive integer. Omitted: the host policy, initially 120 s, and never more than it. Zero, a negative, a fraction or a non-finite value is refused invalid_request before anything is recorded.
idempotencyKey / idempotency_keystringMakes a retry safe: the same key, principal and body return (or re-attach to) the first request's outcome. Scoped to this team and operation. Omitted: every call is a new request.
Throws StoreCorruptError when the stored log doesn't verify.
cancel
Requests a member's cancel: durable at once, applied at the member's next step.
cancel(member: MemberRef, options?: {
idempotencyKey?: string;
}): Promise<TeamCancelResult>memberMemberRefrequiredThe member to cancel. See MemberRef.
idempotencyKey / idempotency_keystringMakes a retry safe: the same key, principal and body return (or re-attach to) the first request's outcome. Scoped to this team and operation. Omitted: every call is a new request.
members
Every member of the team, the lead included, with its state and, once idle or ended, its result. A pure read.
members(): Promise<readonly TeamMember[]>Throws StoreCorruptError when the stored log doesn't verify.
events
The team's audit feed: every committed event of every team log, as stored (results keep their artifact refs, so this never raises StoreCorruptError). A pure read that drives nothing. The stream itself is the return value, so invalid_cursor is raised as InvalidCursorError when the iteration begins, not returned; the HTTP route answers it 400.
events(options?: {
after?: TeamCursor;
follow?: boolean;
}): Promise<Result<AsyncIterable<TeamItem>>>afterTeamCursorResume after this cursor. A cursor of an older epoch first yields epoch_restarted; one from a later epoch, or past the head of the current one, is invalid_cursor. Omitted: from the start. See TeamCursor.
followbooleandefault falsetrue keeps the stream open for new events until the team closes, after the items of the append that closed it (a host team never closes, so its follower ends only when the caller stops); false yields what is committed, then ends. A commit wakes an in-process follower at once; otherwise it polls every 250 ms in one process and 1 s across processes.
Returns an error value with one of these codes: invalid_cursor.
askStatus / ask_status
An ask's state from the team log: open, not_found, or its outcome. A pure read; it never closes an ask.
askStatus(askId: AskId): Promise<AskStatus>askId / ask_idAskIdrequiredThe ask, as team.ask or its outcome names it.
Throws StoreCorruptError when the stored log doesn't verify.