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?: {
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.
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. Omitted: the host policy, initially 120 s, and never more than it.
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. A number below 1 or above the count of distinct members is refused invalid_request before anything is recorded.
timeoutMs / timeout_msPosIntHow long to wait. Omitted: the host policy, initially 120 s, and never more than it.
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
Phase 2, not yet available (lane 29-teams-phase2-29b): Until then a cursor of any other epoch restarts the feed, follow is not supported, and GET /v1/teams/{team}/events is not served. 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.
events(options?: {
after?: TeamCursor;
}): 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.
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.