Skip to content

bodhi-realtime-agent / BackgroundAgentContext

Interface: BackgroundAgentContext ​

Defined in: src/agent/background-agent.ts:90

Runtime context passed to each BackgroundAgent's lifecycle hooks. Built fresh per session by the host actor.

Properties ​

session ​

readonly session: BackgroundAgentSessionView

Defined in: src/agent/background-agent.ts:113

Live read-only view of session state. Backed by the host actor's cache, not by direct cross-actor reads.


sessionId ​

readonly sessionId: string

Defined in: src/agent/background-agent.ts:91


signal ​

readonly signal: AbortSignal

Defined in: src/agent/background-agent.ts:107

Aborts when the session closes (always) and on agent transfer when cancelOnTransfer === true. Use this to interrupt long-running setInterval / setTimeout / external-fetch loops cleanly.


userId ​

readonly userId: string

Defined in: src/agent/background-agent.ts:92

Methods ​

log() ​

log(msg): void

Defined in: src/agent/background-agent.ts:116

Convenience logger that prefixes the agent name.

Parameters ​

msg ​

string

Returns ​

void


publish() ​

publish(notification): void

Defined in: src/agent/background-agent.ts:100

Publish a synthetic user turn through NotificationActor. Equivalent to sending notification.publish with the producer-supplied label, text, priority, etc. The host actor handles correlationId routing — it is stripped from the payload and forwarded as envelope metadata.

Parameters ​

notification ​

PublishNotification

Returns ​

void

Built with VitePress