Skip to content

AgentFinishedEvent

Defined in: packages/protocol/src/lib/agent-wire.ts:412

The end of an Agent Run with its structured outcome.

The agent loop is experimental in 0.3 and may change in any minor release.

optional code?: string

Defined in: packages/protocol/src/lib/agent-wire.ts:439

Optional machine-readable failure kind with no closed taxonomy, same meaning as on the error event.


optional error?: string

Defined in: packages/protocol/src/lib/agent-wire.ts:434

Human-readable failure description when ok is false.


metrics: AgentRunMetrics

Defined in: packages/protocol/src/lib/agent-wire.ts:432

Cost counters for the run.


ok: boolean

Defined in: packages/protocol/src/lib/agent-wire.ts:423

true when the run ended as intended (completed, waiting), false for cancelled, budget and error.


reason: "error" | "completed" | "waiting" | "cancelled" | "budget"

Defined in: packages/protocol/src/lib/agent-wire.ts:425

Why the run ended.


optional reply?: string

Defined in: packages/protocol/src/lib/agent-wire.ts:430

Full text of the final reply, or the closing message on a budget ending. Absent when the run failed, was cancelled or ended without text.


runId: RunId

Defined in: packages/protocol/src/lib/agent-wire.ts:418

The Agent Run that ended.


type: "finished"

Defined in: packages/protocol/src/lib/agent-wire.ts:414

Member discriminator.


version: 1

Defined in: packages/protocol/src/lib/agent-wire.ts:416

Agent wire version, always AGENT_WIRE_VERSION.