Skip to content
Français

AgentObservation

import type { AgentObservation } from "@elie-laloum/outpost";

The fields below cover all variants; the signature specifies their allowed combinations.

  • kindRequired
    "model-route" | "subagent" | "message-usage" | "stderr" | "stopped" | "steer" | "reasoning" | "file-change" | "model-request" | "model-response" | "model-retry" | "model-error" | "hook" | "instructions-loaded" | "skills-loaded" | "tool-output" | "phase" | "summary" | "warning" | "text" | "text-delta" | "result" | "prompt" | "tool" | "tool-result" | "step" | "tool-denied" | "stop-prevented" | "compaction" | "conversation" | "usage" | "failure" | "quota" | "fallback" | "finished" | "raw"
    Discriminant selecting the inherited agent event payload; model-route identifies an effective model selection.
  • stepVariant-dependent
    number
    Harness step for which this effective model was selected.
  • choiceVariant-dependent
    string
    Effective candidate key after confidence and availability fallback rules.
  • modelVariant-dependent
    AgentModel
    Selected normalized model with its own reasoning and output settings.
  • reasonVariant-dependent
    "unavailable" | "selected" | "confidence" | "completion" | "idle-timeout" | "deadline" | "aborted" | "oversized-event" | "steered" | string
    On tool-denied, why the call was refused. On stopped, why Outpost ended the process: completion, idle-timeout, deadline, aborted, oversized-event or steered. On model-route, selected, confidence or unavailable explains the effective selection.
  • confidenceVariant-dependent
    number | undefined
    Native decision confidence, present only when a valid choice response was received.
  • subagentIdOptional
    string | undefined
    Identifier of the built-in child that emitted the event; absent for the root harness. Lifecycle events link that identifier to the delegating tool call.
  • passRequired
    number
    One-based pass number within the dispatch; 1 when the scope carries none.
  • atRequired
    string
    ISO timestamp assigned to the agent observation.
  • seqOptional
    number | undefined
    Hub sequence number, set when the observation passed through a hub; absent on observations you build yourself.
  • sourceOptional
    ObservationSource | undefined
    Producing subsystem when the observation passed through a hub.
  • scopeOptional
    ObservationScope | undefined
    Hub scope of the observation: workflow execution, task, attempt, dispatch, pass, subagent and candidate identifiers known at emission.
  • idVariant-dependent
    string
    Conversation identifier for conversation events, or unique child execution identifier for subagent lifecycle events.
  • callIdVariant-dependent
    string | string | undefined | string | string | undefined | string | string
    Tool call identifier linking the tool, tool-result, tool-output, tool-denied, file-change and subagent events of one call. CLI adapters copy the native identifier when the protocol has one.
  • nameVariant-dependent
    string
    Phase name on phase events; tool name on tool, tool-result and tool-denied events; delegating tool name on subagent events.
  • statusVariant-dependent
    "started" | "finished" | "failed" | number
    On summary, the exit status of the pass’s last turn, always 0 because a nonzero exit rejects the dispatch. On subagent, started, finished or failed.
  • conversationVariant-dependent
    string | undefined
    Persisted child conversation identifier when the child enables transcript storage.
  • tokensVariant-dependent
    Usage
    Token counts: an increment on usage, the pass total on summary, one message’s usage on message-usage.
  • messageIdVariant-dependent
    string | undefined
    Claude Code identifier of the message whose usage a message-usage event reports.
  • parentCallIdVariant-dependent
    string | undefined
    Parent tool call supplied by a CLI for a nested agent message or tool event.
  • textVariant-dependent
    string
    Text of the event according to kind: agent text, streamed fragment, final answer, rendered prompt, steering instruction, reasoning, stderr line or tool output chunk.
  • truncatedVariant-dependent
    boolean | undefined
    Whether the stderr fragment or oversized raw preview was bounded before delivery.
  • modeVariant-dependent
    SteeringMode
    How a steer event reached the agent: injected into the running turn, or resumed in a new turn of the same conversation.
  • changesVariant-dependent
    unknown
    File changes as Codex reports them, passed through unmodified.
  • requestVariant-dependent
    unknown
    Model request observed only when the hub explicitly enables verbose payloads; may contain private instructions and messages.
  • responseVariant-dependent
    unknown
    Model response observed only when verbose payloads are enabled, including tool calls and replayable content.
  • attemptVariant-dependent
    number
    Retry attempt explicitly reported by a model provider; Outpost does not infer hidden retries.
  • messageVariant-dependent
    string | undefined | string | string | string | string | string | string
    Message of a warning, failure, quota, fallback, model-retry or model-error event, or the message a stop hook sent back to the model on stop-prevented.
  • phaseVariant-dependent
    string
    Harness hook phase that completed.
  • changedVariant-dependent
    boolean
    Whether a hook returned a decision or changed its observable input.
  • countVariant-dependent
    number
    Number of nonempty instruction sources resolved for this harness turn.
  • namesVariant-dependent
    readonly string[]
    Skills newly loaded into the conversation and available to subsequent model steps.
  • channelVariant-dependent
    "stdout" | "stderr"
    Command output stream for the tool-output event: stdout or stderr.
  • agentVariant-dependent
    string | undefined
    Name of the agent running the pass, on phase events: claude, codex, antigravity, copilot or kimi, custom for a built-in harness agent, replay for a replay agent.
  • branchVariant-dependent
    string | undefined
    Name of the work branch used or observed during execution.
  • directoryVariant-dependent
    string | undefined
    Host workspace directory used for this execution.
  • durationMsVariant-dependent
    number
    Duration of the pass in milliseconds, summed over its turns, on summary events.
  • inputVariant-dependent
    unknown
    Raw arguments supplied to the tool named by this tool event.
  • isErrorVariant-dependent
    boolean
    Whether the tool call failed or reported an error.
  • previewVariant-dependent
    string
    First 2000 characters of the tool result.
  • charactersVariant-dependent
    number
    Full length of the tool result before any truncation.
  • indexVariant-dependent
    number
    One-based step number within a built-in harness turn.
  • strategyVariant-dependent
    string
    Name of the context strategy that rewrote the history.
  • messagesVariant-dependent
    number
    Number of messages in the history after compaction.
  • cumulativeVariant-dependent
    boolean | undefined
    True when an adapter reports a running total for the native session instead of an increment. Outpost subtracts the session baseline and the usage already counted, so observers always receive usage events with increments and no cumulative flag.
  • resetAtVariant-dependent
    string | undefined
    ISO timestamp at which a quota or fallback event says the usage or rate limit resets; present only when reported in structured form.
  • fromVariant-dependent
    FallbackCandidate
    Candidate that stopped in a fallback event: its position, adapter name and model name when one was selected.
  • toVariant-dependent
    FallbackCandidate
    Candidate that takes over in a fallback event: its position, adapter name and model name when one was selected.
  • failureVariant-dependent
    FallbackTrigger
    Category that ended the previous candidate in a fallback event: quota or unavailable.
  • valueVariant-dependent
    unknown
    Raw protocol line as the agent printed it; for an oversized line, only its first 2000 characters.
  • bytesVariant-dependent
    number | undefined
    Observed UTF-8 byte size of an oversized protocol line or buffered prefix before termination.
export type AgentObservation = AgentEvent & {
  readonly pass: number;
  readonly at: string;
  readonly seq?: number;
  readonly source?: ObservationSource;
  readonly scope?: ObservationScope;
};