stream

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package stream provides event streaming for real-time observability.

Index

Constants

View Source
const (
	EventNodeStart      = "node_start"
	EventNodeEnd        = "node_end"
	EventEdgeTransition = "edge_transition"
	EventToolCall       = "tool_call"
	EventToolResult     = "tool_result"
	EventModelCall      = "model_call"
	EventModelResponse  = "model_response"
	EventCheckpoint     = "checkpoint"
	EventInterrupt      = "interrupt"
	EventCompleted      = "completed"
	EventError          = "error"
)

Standard event types published during graph and agent execution.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker struct {
	// contains filtered or unexported fields
}

Broker manages SSE subscribers.

func NewBroker

func NewBroker() *Broker

NewBroker creates a new event broker.

func (*Broker) Publish

func (b *Broker) Publish(evt Event)

Publish sends an event to all subscribers.

func (*Broker) SSEHandler

func (b *Broker) SSEHandler(subscriptionID string) http.HandlerFunc

SSEHandler returns an HTTP handler that streams events to the client.

func (*Broker) Subscribe

func (b *Broker) Subscribe(id string) <-chan Event

Subscribe creates a new subscription channel.

func (*Broker) Unsubscribe

func (b *Broker) Unsubscribe(id string)

Unsubscribe removes a subscription.

type Event

type Event struct {
	Type string `json:"type"`
	Data any    `json:"data"`
}

Event is a server-sent event.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL