Skip to main content
Events are coming soon and not yet available in the current SDK.
See Events for usage examples and guest-side emitting.

Sandbox methods


emit()

emit(eventName: string, data: any): Promise<void>
Send a named event with a JSON-serializable payload into the guest. Any process listening on the agent socket (/run/agent.sock) receives it. Parameters
NameTypeDescription
eventNamestringEvent name (e.g. "task.start")
dataanyEvent payload - must be JSON-serializable

onEvent()

onEvent(eventName: string, callback: (event: EventData) => void): Subscription
Subscribe to named events emitted by guest processes. The callback fires each time the guest sends a matching event through /run/agent.sock. Multiple subscriptions to the same event name are supported. Parameters
NameTypeDescription
eventNamestringEvent name to subscribe to (e.g. "task.progress")
callback(event: EventData) => voidCalled with the event data each time
Returns
TypeDescription
SubscriptionCall .unsubscribe() to stop receiving events

Types

EventData

Data received from a guest event.
FieldTypeDescription
dataanyEvent payload. undefined if the event had no data.
eventstringEvent name