Class: Team
Defined in: packages/orchestration/src/team/team.ts:68
Constructors
Constructor
new Team(
config):Team
Defined in: packages/orchestration/src/team/team.ts:86
Parameters
config
Returns
Team
Accessors
events
Get Signature
get events():
EventBus<OrchestrationEventMap>
Defined in: packages/orchestration/src/team/team.ts:119
Live event bus for the direct-dispatch path (run + ticket lifecycle and
per-token run.events). Subscribe BEFORE calling dispatchTicket() /
createAndDispatch() to stream events as they happen — those methods
only resolve once the run reaches a terminal/paused state.
Stable across the Team's lifetime: subscriptions survive dispose() and
subsequent re-dispatches. Accessing this getter no longer triggers
orchestrator construction — the bus is owned by Team.
Returns
EventBus<OrchestrationEventMap>
members
Get Signature
get members(): readonly
TeamMemberSpec[]
Defined in: packages/orchestration/src/team/team.ts:105
The current roster snapshot.
Returns
readonly TeamMemberSpec[]
Methods
buildCrew()
buildCrew():
Crew
Defined in: packages/orchestration/src/team/team.ts:146
Build a fresh Crew from the current roster (implicit/coordinator path).
Caller owns the returned Crew and is responsible for await crew.dispose()
when done: it holds an orchestrator with a scheduler heartbeat, plus a
coordinator and a proactive-update timer per session started against it.
The two teardowns are not substitutes for each other, in either direction.
await crewSession.stop() ends one conversation — it cancels runs and
gets a closing summary from the coordinator — but leaves the crew standing
for another start(). await crew.dispose() ends the crew without a
model call, so a live session it stops yields no summary. Finishing a live
session cleanly is stop() then dispose().
Your members are not closed. They arrive with owned unset, so the
crew tears down its own orchestrator, coordinator and session timers and
leaves every member's sandbox and tool-bridge port alone — this Team, or
another crew, may still be dispatching to them.
Members built via processableFactory are not supported by the
coordinator path — Crew agents need a constructed Processable at
registration time. Use direct dispatch for factory-backed members.
Returns
chat()
chat(
input):Promise<CrewSession>
Defined in: packages/orchestration/src/team/team.ts:189
Start a free-form chat session with the team. The coordinator routes the user input across members as needed (implicit orchestration).
The Crew backing the session is built here and never handed out, so the
Team keeps it and releases it in dispose() — same rule as everywhere
else: whoever constructs a thing owns it. session.stop() ends the
conversation and stops the runs; await team.dispose() is what finally
releases the crew's orchestrator and coordinator. Your members are
untouched by both — the Team's roster is yours.
Use buildCrew() instead when you want to hold the crew yourself.
Parameters
input
string
Returns
Promise<CrewSession>
createAndDispatch()
createAndDispatch(
config,opts?):Promise<Run>
Defined in: packages/orchestration/src/team/team.ts:287
Create a new ticket in the configured TicketStore and dispatch it in one call. Convenience for callers that don't separately manage ticket lifecycle (CLI demos, simple integrations).
The assignee defaults to config.assignee, falling back to opts.assignee,
with the same single-member-default / multi-member-required rules as
dispatchTicket.
Parameters
config
opts?
assignee?
string
Returns
Promise<Run>
dispatchTicket()
dispatchTicket(
ticketId,opts?):Promise<Run>
Defined in: packages/orchestration/src/team/team.ts:269
Dispatch an existing ticket from the configured TicketStore. The ticket
must already exist; ticketId is the orchestration ticket id (the same
value the store returned at create time).
The assignee must name a roster member. If omitted, it defaults to the
sole member when the team has exactly one; otherwise it throws — routing
an unassigned goal is chat()'s job, not direct dispatch.
Parameters
ticketId
string
opts?
assignee?
string
Returns
Promise<Run>
dispose()
dispose():
Promise<void>
Defined in: packages/orchestration/src/team/team.ts:387
Tear down what the Team built: the direct-dispatch orchestrator (if one
was built) and every Crew chat() started. The team-owned event bus is
preserved — subscriptions remain attached and will receive events from any
orchestrator built by a subsequent dispatch call, and a later chat()
builds a fresh crew.
Your members are not closed. They are yours; the Team registers them
and never constructs them. Their sandboxes and tool-bridge ports survive,
which is why this is safe to call on a roster shared with anything else.
Release those with closeAll(...bots) when you are done with the bots
themselves.
Async because a crew's teardown is: disposing a chat() crew stops its
orchestrator and closes the coordinator it built. An un-awaited call still
runs, but the teardown is not complete when it returns and a failure
surfaces as an unhandled rejection.
Every crew is torn down even if one fails; the failures are then raised
together as ERR_TEAM_DISPOSE_FAILED, with all of them on errors and
the first chained as cause.
Returns
Promise<void>
getTicket()
getTicket(
id):Promise<Ticket|null>
Defined in: packages/orchestration/src/team/team.ts:303
Fetch a ticket from the configured TicketStore by id.
Public, narrow accessor for the common "read back a ticket I just dispatched" use case — avoids reaching into the backing orchestrator.
Parameters
id
string
Returns
Promise<Ticket | null>
groupChat()
groupChat(
opts?):GroupSession
Defined in: packages/orchestration/src/team/team.ts:209
Start a peer group-chat session over the roster (group-chat topology). The members discuss in a shared thread; a facilitator (round-robin by default) owns speaker selection — Team contributes no turn logic.
Every selected member's processable must be a Baleybot instance (group
chat re-equips each bot with per-turn thread/workspace tools, which needs
the concrete bot config). Members built via processableFactory, or whose
processable is any other Processable, are rejected — all offenders are
listed in one error. Roster budgets are ignored in this topology (see
TeamGroupChatOptions).
Returns the GroupSession directly; call session.start(prompt) to run.
Parameters
opts?
TeamGroupChatOptions = {}