interrupt

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package interrupt provides workflow signal handling for pausing and resuming agent runs. It exposes a Controller that workflows can use to react to external pause/resume requests via workflow engine signals.

Index

Constants

View Source
const (
	// SignalPause is the workflow signal name used to pause a run.
	SignalPause = api.SignalPause
	// SignalResume is the workflow signal name used to resume a paused run.
	SignalResume = api.SignalResume

	// SignalProvideClarification delivers a ClarificationAnswer to a waiting run.
	SignalProvideClarification = api.SignalProvideClarification
	// SignalProvideToolResults delivers external tool results to a waiting run.
	SignalProvideToolResults = api.SignalProvideToolResults
	// SignalProvideConfirmation delivers a ConfirmationDecision to a waiting run.
	SignalProvideConfirmation = api.SignalProvideConfirmation
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClarificationAnswer

type ClarificationAnswer = *api.ClarificationAnswer

ClarificationAnswer carries a typed answer for a paused clarification request.

type ConfirmationDecision

type ConfirmationDecision = *api.ConfirmationDecision

ConfirmationDecision carries a typed decision for a confirmation await.

type Controller

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

Controller drains runtime interrupt signals and exposes helpers the workflow loop can call to react to pause/resume and await requests.

func NewController

func NewController(wfCtx engine.WorkflowContext) *Controller

NewController builds a controller wired to the workflow context signals.

func (*Controller) PollPause

func (c *Controller) PollPause() (PauseRequest, bool)

PollPause attempts to dequeue a pause request without blocking.

func (*Controller) WaitProvideClarification

func (c *Controller) WaitProvideClarification(ctx context.Context, timeout time.Duration) (ClarificationAnswer, error)

WaitProvideClarification blocks until a clarification answer is delivered or the timeout elapses.

When timeout is <= 0, WaitProvideClarification blocks until an answer is delivered or ctx is done.

func (*Controller) WaitProvideConfirmation

func (c *Controller) WaitProvideConfirmation(ctx context.Context, timeout time.Duration) (ConfirmationDecision, error)

WaitProvideConfirmation blocks until a confirmation decision is delivered or the timeout elapses.

When timeout is <= 0, WaitProvideConfirmation blocks until a decision is delivered or ctx is done.

func (*Controller) WaitProvideToolResults

func (c *Controller) WaitProvideToolResults(ctx context.Context, timeout time.Duration) (ToolResultsSet, error)

WaitProvideToolResults blocks until external tool results are delivered or the timeout elapses.

When timeout is <= 0, WaitProvideToolResults blocks until results are delivered or ctx is done.

func (*Controller) WaitResume

func (c *Controller) WaitResume(ctx context.Context, timeout time.Duration) (ResumeRequest, error)

WaitResume blocks until a resume request is delivered or the timeout elapses.

When timeout is <= 0, WaitResume blocks until a resume request is delivered or ctx is done.

type PauseRequest

type PauseRequest = *api.PauseRequest

PauseRequest carries metadata attached to a pause signal.

type ResumeRequest

type ResumeRequest = *api.ResumeRequest

ResumeRequest carries metadata attached to a resume signal.

type ToolResultsSet

type ToolResultsSet = *api.ToolResultsSet

ToolResultsSet carries results for an external tools await request.

Jump to

Keyboard shortcuts

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