Documentation
¶
Index ¶
- Constants
- func PathwayWorkflow(ctx workflow.Context, input PathwayInput) (*pathwalk.RunResult, error)
- func StartRun(ctx context.Context, c client.Client, input PathwayInput, opts RunOptions) (string, error)
- func StartWorker(c client.Client, acts *PathwayActivities) (worker.Worker, error)
- func WaitForResult(ctx context.Context, c client.Client, workflowID, runID string) (*pathwalk.RunResult, error)
- type CompletionCallbackInput
- type PathwayActivities
- type PathwayInput
- type RunOptions
- type RunSnapshot
- type StepActivityInput
- type StepActivityResult
Constants ¶
const TaskQueue = "pathwalk"
Variables ¶
This section is empty.
Functions ¶
func PathwayWorkflow ¶
PathwayWorkflow executes a pathwalk pathway as a Temporal workflow. It returns the final RunResult or an error.
func StartRun ¶
func StartRun(ctx context.Context, c client.Client, input PathwayInput, opts RunOptions) (string, error)
StartRun kicks off a PathwayWorkflow and returns the workflow ID immediately. The caller can later use GetResult or WaitForResult with the returned workflow ID. Pass opts.WorkflowID for idempotency; if empty, Temporal generates a UUID.
func StartWorker ¶
StartWorker creates and starts a worker for the pathwalk task queue. It registers PathwayWorkflow and the provided PathwayActivities.
func WaitForResult ¶
func WaitForResult(ctx context.Context, c client.Client, workflowID, runID string) (*pathwalk.RunResult, error)
WaitForResult blocks until the workflow finishes and returns the final RunResult. Pass runID="" to use the default empty run ID (appropriate for single-run workflows).
Types ¶
type CompletionCallbackInput ¶
type CompletionCallbackInput struct {
Data string // echoes PathwayInput.CompletionData
Result *pathwalk.RunResult // nil on workflow error
Err string // set if workflow-level error occurred
}
CompletionCallbackInput is the input to the completion callback activity. Called by PathwayWorkflow after the pathway run finishes.
type PathwayActivities ¶
type PathwayActivities struct {
// LLMClientOverride optionally overrides the LLM client (for testing).
// If nil, one is created from the input credentials.
LLMClientOverride pathwalk.LLMClient
}
PathwayActivities holds the activity implementations.
func (*PathwayActivities) ExecuteStep ¶
func (a *PathwayActivities) ExecuteStep(ctx context.Context, input StepActivityInput) (*StepActivityResult, error)
ExecuteStep is a Temporal activity that executes a single node step. It parses the pathway, creates an engine, and calls engine.Step().
type PathwayInput ¶
type PathwayInput struct {
PathwayJSON []byte // JSON-encoded pathway
Task string // Initial task description
MaxSteps int // 0 = use engine default (50)
Verbose bool
LLMModel string
LLMBaseURL string
LLMAPIKey string
// Optional completion callback. When set, PathwayWorkflow calls this activity
// on CompletionTaskQueue after finishing (success or error), passing a
// CompletionCallbackInput.
CompletionTaskQueue string
CompletionActivityName string
CompletionData string // opaque caller data (e.g., execution ID)
}
PathwayInput contains the parameters for a PathwayWorkflow.
type RunOptions ¶
type RunOptions struct {
WorkflowID string // Optional; if empty, Temporal generates a UUID
}
RunOptions configures a pathway workflow run.
type RunSnapshot ¶
type RunSnapshot struct {
Status string // "running" or terminal reason
CurrentNodeID string
Output string
Variables map[string]any
Steps []pathwalk.Step
Error string
}
RunSnapshot captures the current state of a running or completed workflow.
type StepActivityInput ¶
type StepActivityInput struct {
PathwayJSON []byte // JSON-encoded pathway
State *pathwalk.State // Current execution state
CurrentNodeID string
LLMModel string
LLMBaseURL string
LLMAPIKey string
Verbose bool
}
StepActivityInput is the input to the ExecuteStep activity.
type StepActivityResult ¶
type StepActivityResult struct {
State *pathwalk.State
StepResult *pathwalk.StepResult
}
StepActivityResult is the output of the ExecuteStep activity.