Skip to content

Events Overview ​

Events are the runtime language of HPD Agent. They are how local apps, hosted clients, TUIs, bot adapters, middleware, sessions, workflows, and subagents observe what is happening during a run.

The simplest event experience is streaming text. The broader event model lets you build:

  • transcripts from text and reasoning events
  • tool timelines from tool-call events
  • permission prompts from bidirectional interactive events
  • workflow timelines from workflow events
  • subagent and multi-agent views from metadata and child events
  • trace views from trace/span fields
  • thread replay from durable thread events

What To Read ​

Start here:

Then use focused pages:

Core Rule ​

HPD sends events linearly. Your app projects them into the shape it needs.

text
ordered event stream
  -> transcript
  -> tool timeline
  -> permission queue
  -> workflow tree
  -> subagent view
  -> trace/debug log

Push Or Pull ​

Observation has one verb, Subscribe, on the AgentRuntime. Pass a handler and the runtime calls it for each event; omit the handler and you get a bounded inbox you read yourself. A subscription sees the events of every agent the runtime runs:

csharp
// push: react in-process (print, log, prompt)
using var text = runtime.Subscribe<TextDeltaEvent>(evt => Console.Write(evt.Text));

// pull: forward at your own pace (SSE, WebSocket, a bot)
await using var events = runtime.Subscribe<AgentEvent>(
    new ThreadKey(sessionId, "main"),
    AgentEventHierarchy.ThreadAndDescendants);
await foreach (var evt in events)
    await socket.SendAsync(evt);

Both shapes take the same scope: all of the runtime's own events, one exact thread, or a thread hierarchy. The inbox is subscribed when Subscribe returns, so nothing emitted before your first read is lost. Its policy decides what happens when you fall behind: EventInboxOptions.Deterministic() (the default shape) makes the agent wait, LatestOnly() keeps only the newest event, and LossyTelemetry() drops new events. Always dispose an inbox you stop reading. Disposing either shape stops observation only; it never cancels the run. Process-local struct events use SubscribeStruct<TEvent>(...).

For hierarchy, use the most specific correlation fields available: MessageId for message content, CallId for tools, request ids such as PermissionId for bidirectional flows, workflow node ids for workflows, agent metadata for child-agent labels, and trace/span fields for trace views.

Durable thread-scoped projectable events commit to the canonical journal before publication. Live-only diagnostics, progress, metrics, and high-volume samples use their dedicated runtime surfaces. Choose [DurableEvent] only when the event must participate in replay and thread reconstruction.

Built for production .NET agent applications.