Documentation
¶
Overview ¶
Package interrupt defines the [InterruptError] sentinel used by tools and middleware to signal that a tool call needs external input (human approval, clarification answer, etc.) before it can complete.
It lives in its own package — separate from toolwrap and clarify — to avoid import cycles. Both packages depend on this one, but neither depends on the other.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResumeValueFrom ¶
ResumeValueFrom extracts the resume value from ctx. Returns (nil, false) if this is a fresh (non-resumed) call.
func WithResumeValue ¶
WithResumeValue returns a child context carrying the given resume value. The executor calls this when re-invoking a tool after an interrupt, passing the human's answer (string for clarifications, *hitl.ApprovalRequest for approvals). Tool functions retrieve it via ResumeValueFrom.
Types ¶
type Error ¶
type Error struct {
// Kind distinguishes clarification pauses from approval pauses.
Kind Kind
// RequestID is the unique identifier of the pending request
// (clarification ID or approval ID).
RequestID string
// Payload carries kind-specific metadata:
// - Clarify: clarify.ClarificationEvent
// - Approval: hitl.ApprovalRequest
Payload any
}
Error signals that a tool call needs external input (human approval, clarification, etc.) before it can complete.
In the current in-process executor (blocking mode), the middleware catches this internally and blocks on the store's wait channel — callers never see it. In a future Temporal executor (non-blocking mode), the workflow propagates the interrupt upward so it can be modelled as a Temporal signal wait.
The API mirrors [graph.InterruptError] from trpc-agent-go so that the two can be bridged without conversion when Temporal is adopted.