Skip to content

Events reference ​

Use this reference to read v1 session-journal events. It describes the envelope, payload kinds, replay routes, live delivery, and transactional outbox. An envelope is the owner-written record that identifies an event and contains its typed payload.

For provider setup, see Configure providers. For runtime settings, see Runtime configuration. For provider binding, receipt admission, storage, and recovery, see Events & Sessions architecture.

Journal envelope ​

The SessionEventEnvelope contract is defined in SessionsContracts.cs.

JSON fieldMeaning
schemaVersionEnvelope schema version; current value is 1.
eventVersionPayload version; current value is 2.
eventIdStable GUID for idempotent append and client deduplication.
identityExact projectId, runId, and sessionId.
positionOwner-assigned, increasing project/run journal position.
occurredAtOwner-assigned time. Do not use it as the ordering key.
kindEvent enum value derived from the payload type.
payloadTyped payload with its own kind discriminator.
objectReferencesStored references and owner-controlled retention metadata.

The HTTP serializer uses camel-case enum names. For example, envelope kind is toolCall, while payload.kind is tool_call. Outbox event-type strings use the C# enum spelling shown below, not the HTTP spelling.

Provider selection uses the shared SessionsCapabilities identifiers in Agentweaver.Abstractions. The current Events & Sessions host binds the native PostgreSQL journal as its default and does not route runs to the optional AgentSessions implementation.

Event kinds ​

All fields listed here are inside payload, after the discriminator. Object-reference fields hold metadata, not inline object bytes.

C# kindpayload.kindFields and purpose
Turnturnrole, content: turn content reference. Roles are user, assistant, system, or tool.
ToolCalltool_callcallId, toolName, state, arguments, result: tool lifecycle and optional references. States are requested, accepted, completed, or failed.
PolicyEvaluationpolicy_evaluationactorId, tenantId, stepId, grantId, grantRevision, purpose, actionId, outcome, reasonCode, fence, providerId, adapterVersion, optionsSchemaVersion, optionsRevision: redacted policy evidence.
DecisionAccepteddecision_accepteddecisionId, decisionType, selectedOption, rationale, acceptedEffectIds: accepted decision and referenced effects.
EffectAcceptedeffect_acceptedeffectId, effectType, receipt: accepted effect and optional receipt reference.
ArtifactReferenceartifact_referenceartifact: stored artifact reference.
CacheReferencecache_referencecache, runtimeVersion, bindingId: SDK cache and compatibility binding.
AddressedMessageaddressed_messagemessageId, sender, recipient, threadId, threadSequence, purpose: link to a routed message.
ProducedRunCaptureproduced_run_capturecapture, package: Source Control output proof and exact package reference.
RuntimeConfigurationruntime_configurationconfiguration: private accepted configuration reference; public projection returns null.

Event version 1 supports the kinds above except PolicyEvaluation, ProducedRunCapture, and RuntimeConfiguration. Version 2 supports all ten. An unsupported schema or event version returns 422 unsupported_contract_version.

PolicyEvaluationOutcome values are Allow, Deny, and Error. Reason codes are Allowed, DefaultDeny, NoEffectiveGrant, PlatformRuleDenied, ProjectRuleNarrowed, StaleFence, ProviderUnavailable, and EvaluationFailed. The record is evidence, not an action grant.

ProducedRunCaptureProof has its own contract version, currently 2. It pins identity, actor and tenant, selection hash, Source Control pin, Workspace incarnation and generation, Git object IDs, package/manifest/patch hashes and lengths, and capture time. The event version and capture contract version are separate fields.

Object references and public projection ​

SessionObjectReference contains an opaque key, purpose, optional byteLength, and optional typed material. Stored references also include retention.ownerId and retention.retainUntil.

Ordinary journal reads do not disclose private runtime configuration or reviewed remote tool result references:

  • Runtime configuration events retain identity and position, but return configuration: null and no object references.
  • Admitted private remote tool results become completed ToolCall events with toolName: "external-tool", an event-derived call ID, null arguments/result, and no object references.
  • Invalid private reference combinations fail integrity validation instead of passing through.

The browser cannot recover transcript or private result bytes from these projections. Private material has separate authenticated owner routes.

Replay and live delivery ​

SurfaceRouteFormat
Gateway replayGET /api/v1/projects/{projectId}/runs/{runId}/events{ events, nextCursor, hasMore }
Gateway liveGET /api/v1/projects/{projectId}/runs/{runId}/events/livetext/event-stream
Native session replayGET /internal/sessions/{sessionId}/eventsSame event-page DTO
Native run replayGET /internal/projects/{projectId}/runs/{runId}/eventsSame event-page DTO
Native session liveGET /internal/sessions/{sessionId}/events/liveapplication/x-ndjson deliveries
Native run liveGET /internal/projects/{projectId}/runs/{runId}/events/liveapplication/x-ndjson deliveries

Replay accepts cursor and limit. The default limit is 100; the journal accepts 1 through 200. Cursors are opaque and scope-bound. Do not construct or reuse a cursor for another session or run.

Gateway server-sent events (SSE) use the journal cursor as the id and session-event as the event name. Reconnect with Last-Event-ID or cursor. The Gateway reads committed owner replay pages and rechecks current access before delivery.

Native live routes accept cursor, maximumEvents, and maximumDurationSeconds. Defaults are 1,000 events and 300 seconds; maximums are 10,000 and 300. Each NDJSON delivery contains event and nextCursor.

Read all replay pages, then follow live delivery from the final cursor. Deduplicate overlap by eventId, and order by position. The browser implements this in useRunJournal.ts; a timestamp does not resolve ordering.

Addressed messages ​

Addressed-message records have their own thread order and lifecycle:

EnumValues
AddressedMessageDeliveryModeImmediate, Enqueue
AddressedMessagePurposeProgress, Handoff, NeedsInput, Error, Steering, Question, ApprovalRequest, Proposal
AddressedMessageKindText, Steering, Question, Approval, Proposal
AddressedMessageStatusAccepted, Claimed, Delivered, Acknowledged, Expired, Undeliverable
AddressedMessageFailureReasonStaleFence, TargetCancelled, TargetCompleted, RecipientUnavailable

A message's threadSequence is not a journal position or an outbox sequence. Acceptance does not report presentation or acknowledgment.

Transactional outbox ​

The PostgreSQL library defines OutboxEvent, not a fixed domain event taxonomy. It stores Id, StreamId, IdempotencyKey, EventType, EventVersion, Payload, and OccurredAt. StoredOutboxEvent adds a monotonic stream Sequence. Claiming adds LeaseToken, WorkerId, and LeasedUntil.

The Events owner writes these concrete event types:

Event typeStreamPayload
sessions.event.Turnsessions/{projectId}/{runId}Journal envelope
sessions.event.ToolCallSame journal streamJournal envelope
sessions.event.PolicyEvaluationSame journal streamJournal envelope
sessions.event.DecisionAcceptedSame journal streamJournal envelope
sessions.event.EffectAcceptedSame journal streamJournal envelope
sessions.event.ArtifactReferenceSame journal streamJournal envelope
sessions.event.CacheReferenceSame journal streamJournal envelope
sessions.event.AddressedMessageSame journal streamJournal envelope
sessions.event.ProducedRunCaptureSame journal streamJournal envelope
sessions.event.RuntimeConfigurationSame journal streamJournal envelope
sessions.addressed_messageaddressed-messages/{projectId}/{runId}Addressed-message record

Journal and outbox insertion share the owner transaction. Outbox delivery is at least once. Consumers use inbox admission in the same transaction as their effects. Relay outcomes distinguish Acknowledged, AcknowledgmentFenced, and PublishFailed; a failed or fenced acknowledgment permits redelivery.

Source ​