runtime

package
v1.0.0-alpha.7 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxSteps = 10000

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncResult

type AsyncResult[S any] struct {
	Result *Result[S]
	Error  error
}

type EventContextOptions

type EventContextOptions struct {
	Enabled bool
}

type EventHandler

type EventHandler func(context.Context, trace.Event) error

type EventStream

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

func NewEventStream

func NewEventStream(buffer int) *EventStream

func (*EventStream) Close

func (s *EventStream) Close()

func (*EventStream) Dropped

func (s *EventStream) Dropped() int64

func (*EventStream) Events

func (s *EventStream) Events() <-chan trace.Event

func (*EventStream) Handle

func (s *EventStream) Handle(_ context.Context, event trace.Event) error

type InterruptRecord

type InterruptRecord struct {
	ID           string            `json:"id"`
	WorkflowID   string            `json:"workflow_id"`
	SessionID    string            `json:"session_id,omitempty"`
	RunID        string            `json:"run_id"`
	Metadata     map[string]string `json:"metadata,omitempty"`
	NodeID       string            `json:"node_id"`
	ResumeNode   string            `json:"resume_node"`
	CheckpointID string            `json:"checkpoint_id"`
	Request      graph.Interrupt   `json:"request"`
	Response     *hitl.Response    `json:"response,omitempty"`
	CreatedAt    time.Time         `json:"created_at"`
	ResolvedAt   time.Time         `json:"resolved_at,omitempty"`
}

type Invocation

type Invocation[S any] struct {
	// contains filtered or unexported fields
}

func (*Invocation[S]) Cancel

func (i *Invocation[S]) Cancel()

func (*Invocation[S]) Done

func (i *Invocation[S]) Done() <-chan AsyncResult[S]

type InvokeOption

type InvokeOption func(*invokeConfig)

func WithMetadata

func WithMetadata(metadata map[string]string) InvokeOption

func WithRunID

func WithRunID(runID string) InvokeOption

func WithSession

func WithSession(sessionID string) InvokeOption

func WithStartAt

func WithStartAt(nodeID string) InvokeOption

type Option

type Option[S any] func(*Runner[S])

func WithCheckpointStore

func WithCheckpointStore[S any](store checkpoint.Store) Option[S]

func WithEventContext

func WithEventContext[S any](options EventContextOptions) Option[S]

func WithEventHandler

func WithEventHandler[S any](handler EventHandler) Option[S]

func WithMaxSteps

func WithMaxSteps[S any](maxSteps int) Option[S]

func WithRecorder

func WithRecorder[S any](recorder trace.Recorder) Option[S]

func WithSerializer

func WithSerializer[S any](serializer checkpoint.Serializer[S]) Option[S]

type Result

type Result[S any] struct {
	Run         Run                     `json:"run"`
	State       S                       `json:"state"`
	Events      []trace.Event           `json:"events"`
	Checkpoints []checkpoint.Checkpoint `json:"checkpoints"`
}

type ResumeRequest

type ResumeRequest[S any] struct {
	Run          Run           `json:"run"`
	State        S             `json:"state"`
	ResumeNode   string        `json:"resume_node"`
	Response     hitl.Response `json:"response"`
	InterruptID  string        `json:"interrupt_id,omitempty"`
	CheckpointID string        `json:"checkpoint_id,omitempty"`
}

type Run

type Run struct {
	ID          string            `json:"id"`
	WorkflowID  string            `json:"workflow_id"`
	SessionID   string            `json:"session_id,omitempty"`
	Status      Status            `json:"status"`
	Metadata    map[string]string `json:"metadata,omitempty"`
	StartedAt   time.Time         `json:"started_at"`
	CompletedAt time.Time         `json:"completed_at,omitempty"`
	Error       string            `json:"error,omitempty"`
}

type Runner

type Runner[S any] struct {
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner[S any](stateGraph *graph.StateGraph[S], opts ...Option[S]) (*Runner[S], error)

func (*Runner[S]) Invoke

func (r *Runner[S]) Invoke(ctx context.Context, initialState S, opts ...InvokeOption) (*Result[S], error)

func (*Runner[S]) InvokeAsync

func (r *Runner[S]) InvokeAsync(ctx context.Context, initialState S, opts ...InvokeOption) *Invocation[S]

func (*Runner[S]) Resume

func (r *Runner[S]) Resume(ctx context.Context, interruptID string, response hitl.Response) (*Result[S], error)

func (*Runner[S]) ResumeFrom

func (r *Runner[S]) ResumeFrom(ctx context.Context, request ResumeRequest[S]) (*Result[S], error)

type Status

type Status string
const (
	StatusQueued      Status = "queued"
	StatusRunning     Status = "running"
	StatusCompleted   Status = "completed"
	StatusFailed      Status = "failed"
	StatusCancelled   Status = "cancelled"
	StatusInterrupted Status = "interrupted"
)

Jump to

Keyboard shortcuts

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