Skip to main content

Class: Crew

Defined in: packages/orchestration/src/crew/crew.ts:50

Constructors​

Constructor​

new Crew(config): Crew

Defined in: packages/orchestration/src/crew/crew.ts:66

Parameters​

config​

CrewConfig

Returns​

Crew

Accessors​

events​

Get Signature​

get events(): EventBus<OrchestrationEventMap>

Defined in: packages/orchestration/src/crew/crew.ts:119

The crew's ticket and run lifecycle, and every worker stream event (run.event), whether a session or a direct dispatch started the run. A session's own stream (CrewSession.events) adds the coordinator, attribution and snapshots.

Returns​

EventBus<OrchestrationEventMap>

Methods​

addAgent()​

addAgent(agent): RegisteredAgent

Defined in: packages/orchestration/src/crew/crew.ts:195

Parameters​

agent​

CrewAgentConfig

Returns​

RegisteredAgent


createTicket()​

createTicket(config): Promise<Ticket>

Defined in: packages/orchestration/src/crew/crew.ts:124

File a ticket on the crew's board (merging ticketDefaults).

Parameters​

config​

TicketConfig

Returns​

Promise<Ticket>


dispatch()​

dispatch(ticketId, agentName): Promise<Run>

Defined in: packages/orchestration/src/crew/crew.ts:133

Run a ticket on a named agent now, with no coordinator; resolves when the run ends or pauses.

Parameters​

ticketId​

string

agentName​

string

Returns​

Promise<Run>


dispose()​

dispose(): Promise<void>

Defined in: packages/orchestration/src/crew/crew.ts:226

Tear down the crew permanently: stop the sessions it started, cancel its runs and stop the orchestrator, then close everything the crew owns.

It only closes what the crew owns: agents marked CrewAgentConfig.owned and the coordinators start() built. An agent you passed in is yours: a crew has no refcount and cancels only its own runs, so closing a bot another crew or a Team is mid-call against would pull its resources out from under it. Close those yourself with closeAll().

CrewSession.stop() ends one conversation with a closing summary and leaves the agents for another start(). dispose() makes no model call, so a session it stops produces no summary and no crew.done. For a clean finish, await session.stop() first and then await crew.dispose().

Idempotent, and not retryable after a rejection: the crew is already marked disposed and has dropped its references, so a second call returns at once. Read CloseFailedError.errors (or its cause) to see what leaked.

Returns​

Promise<void>


getGroupId()​

getGroupId(): string

Defined in: packages/orchestration/src/crew/crew.ts:90

DeclaredGroup: how the dev panel lists this crew.

Returns​

string


getGroupKind()​

getGroupKind(): string

Defined in: packages/orchestration/src/crew/crew.ts:94

Returns​

string


getMemberKeys()​

getMemberKeys(): string[]

Defined in: packages/orchestration/src/crew/crew.ts:99

Reads the live roster, so an agent added by addAgent() shows up on the panel's next list.

Returns​

string[]


getTicket()​

getTicket(id): Promise<Ticket | null>

Defined in: packages/orchestration/src/crew/crew.ts:128

Parameters​

id​

string

Returns​

Promise<Ticket | null>


start()​

start(goal): Promise<CrewSession>

Defined in: packages/orchestration/src/crew/crew.ts:147

Start a crew session with a goal. Returns a CrewSession for ongoing conversation while workers execute; the goal is sent without waiting for the coordinator's reply. If that first send fails, the session ends with the error as its summary.

Rejects once the crew has been disposed: a restart would re-arm the scheduler and a proactive timer that nothing would stop again. Build a new crew.

Parameters​

goal​

string

Returns​

Promise<CrewSession>