Skip to main content

Class: Team

Defined in: packages/orchestration/src/team/team.ts:64

Constructors​

Constructor​

new Team(config): Team

Defined in: packages/orchestration/src/team/team.ts:72

Parameters​

config​

TeamConfig

Returns​

Team

Accessors​

events​

Get Signature​

get events(): EventBus<OrchestrationEventMap>

Defined in: packages/orchestration/src/team/team.ts:101

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.

Subscriptions survive dispose() and later re-dispatches.

Returns​

EventBus<OrchestrationEventMap>


members​

Get Signature​

get members(): readonly TeamMemberSpec[]

Defined in: packages/orchestration/src/team/team.ts:89

Returns​

readonly TeamMemberSpec[]

Methods​

buildCrew()​

buildCrew(): Crew

Defined in: packages/orchestration/src/team/team.ts:117

Build a fresh Crew from the current roster (implicit/coordinator path).

The caller owns the returned Crew and must await crew.dispose() when done: it holds a scheduler heartbeat, plus a coordinator and a proactive-update timer per session. See Crew.dispose() for how that differs from CrewSession.stop().

Your members are not closed. They are never owned, so the crew leaves every member's sandbox and tool-bridge port alone: this Team, or another crew, may still be dispatching to them.

Returns​

Crew


chat()​

chat(input): Promise<CrewSession>

Defined in: packages/orchestration/src/team/team.ts:140

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 never handed out, so team.dispose() releases it; session.stop() only ends the conversation and its runs. Your members are untouched by both.

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:231

Create a ticket and dispatch it in one call.

opts.assignee wins over config.assignee, with the same single-member-default / multi-member-required rules as dispatchTicket.

Parameters​

config​

TicketConfig

opts?​
assignee?​

string

Returns​

Promise<Run>


dispatchTicket()​

dispatchTicket(ticketId, opts?): Promise<Run>

Defined in: packages/orchestration/src/team/team.ts:217

Dispatch a ticket already in the configured TicketStore.

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:276

Tear down what the Team built: the dispatch crew (if one was built; its runs still going are cancelled) and every Crew chat() started. The team-owned event bus is preserved — subscriptions remain attached and will receive events from the crew a subsequent dispatch builds, 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.

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:241

Parameters​

id​

string

Returns​

Promise<Ticket | null>


groupChat()​

groupChat(opts?): GroupSession

Defined in: packages/orchestration/src/team/team.ts:160

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 = {}

Returns​

GroupSession