temporal

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package temporal provides a backend that treats snippet execution as a Temporal workflow/activity. Useful for long-running or resumable executions. Note: Temporal is orchestration, not isolation - must compose with sandbox backends.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTemporalNotAvailable is returned when Temporal is not available.
	ErrTemporalNotAvailable = errors.New("temporal not available")

	// ErrWorkflowCreationFailed is returned when workflow creation fails.
	ErrWorkflowCreationFailed = errors.New("workflow creation failed")

	// ErrWorkflowExecutionFailed is returned when workflow execution fails.
	ErrWorkflowExecutionFailed = errors.New("workflow execution failed")

	// ErrMissingSandboxBackend is returned when no sandbox backend is configured.
	ErrMissingSandboxBackend = errors.New("temporal backend requires a sandbox backend for isolation")
)

Errors for Temporal backend operations.

Functions

This section is empty.

Types

type Backend

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

Backend executes code as Temporal workflows/activities.

func New

func New(cfg Config) *Backend

New creates a new Temporal backend with the given configuration.

func (*Backend) Execute

Execute runs code as a Temporal workflow. The actual code execution is delegated to the configured sandbox backend.

func (*Backend) Kind

func (b *Backend) Kind() runtime.BackendKind

Kind returns the backend kind identifier.

type Config

type Config struct {
	// HostPort is the Temporal server address.
	// Default: localhost:7233
	HostPort string

	// Namespace is the Temporal namespace.
	// Default: default
	Namespace string

	// TaskQueue is the task queue for execution activities.
	// Default: toolruntime-execution
	TaskQueue string

	// SandboxBackend is the backend used for actual code execution.
	// Temporal provides orchestration; this backend provides isolation.
	// Required for secure execution.
	SandboxBackend runtime.Backend

	// WorkflowIDPrefix is the prefix for workflow IDs.
	// Default: toolruntime-
	WorkflowIDPrefix string

	// Logger is an optional logger for backend events.
	Logger Logger
}

Config configures a Temporal backend.

type Logger

type Logger interface {
	Info(msg string, args ...any)
	Warn(msg string, args ...any)
	Error(msg string, args ...any)
}

Logger is the interface for logging.

Contract: - Concurrency: implementations must be safe for concurrent use. - Errors: logging must be best-effort and must not panic.

Jump to

Keyboard shortcuts

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