executions

package
v1.18.8 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package executions reads a workflow's run history out of its message traces. A run is one triggering message: its trace is the run, its steps are the run's steps. Nothing is stored here; it is a view over the traces store, so retention, sampling and storage backends are the traces' own.

Index

Constants

View Source
const (
	// StatusSucceeded: no step recorded an error.
	StatusSucceeded = "succeeded"
	// StatusFailed: at least one step recorded an error.
	StatusFailed = "failed"
	// StatusWaiting: nothing failed and the run's last step is an approval,
	// so the message is held until someone decides.
	StatusWaiting = "waiting"
)

Run statuses.

Variables

This section is empty.

Functions

func Input

Input is what a run started with, for a replay: the payload of its first step at a source node, and that node's id. Engine bookkeeping is removed from the payload's metadata; everything else is kept.

Types

type Execution

type Execution struct {
	RunID      string      `json:"run_id"`
	WorkflowID string      `json:"workflow_id"`
	StartedAt  time.Time   `json:"started_at"`
	DurationMs int64       `json:"duration_ms"`
	Status     string      `json:"status"`
	StepCount  int         `json:"step_count"`
	ErrorCount int         `json:"error_count"`
	AI         genai.Usage `json:"ai"`
	Steps      []Step      `json:"steps"`
}

Execution is one run of a workflow.

func FromTrace

func FromTrace(wf storage.Workflow, t storage.MessageTrace, withOutput bool) Execution

FromTrace builds a run from its trace. wf supplies node types, labels and edges; a step whose node is no longer in wf is still listed, untyped. withOutput includes each step's payload, which is large; a list leaves it out.

type Step

type Step struct {
	NodeID     string    `json:"node_id"`
	NodeType   string    `json:"node_type,omitempty"`
	Label      string    `json:"label,omitempty"`
	Timestamp  time.Time `json:"timestamp"`
	DurationMs int64     `json:"duration_ms"`
	Error      string    `json:"error,omitempty"`
	// AI is the language model usage of this step's own calls.
	AI genai.Usage `json:"ai"`
	// Output is the message as the step left it; only on a single run.
	Output map[string]any `json:"output,omitempty"`
}

Step is one node's part in a run.

Directories

Path Synopsis
transport
http
Package http serves a workflow's runs: running it once with a payload the user supplies, and (see executions.go) its run history.
Package http serves a workflow's runs: running it once with a payload the user supplies, and (see executions.go) its run history.

Jump to

Keyboard shortcuts

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