local

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package local provides a flow/team executor that runs pipeline steps directly in the current process — no Kubernetes cluster or Redis required. It reuses runtime/agent's Runner (MCP, tool dispatch, provider loop) and internal/flow's DAG logic unchanged.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor struct {
	// Provider returns the LLMProvider to use for a given model name.
	// Each step calls Provider(agent.Spec.Model), so a flow can mix models
	// from different backends (e.g. claude-* and gpt-*) in the same run.
	Provider func(model string) (providers.LLMProvider, error)

	// NoMCP disables all MCP tool connections. When false (the default),
	// unreachable MCP servers are silently skipped.
	NoMCP bool

	// SemanticValidateFn makes a direct single-turn LLM call for semantic validation.
	// When nil, semantic validation is skipped with a warning printed to stderr.
	SemanticValidateFn func(ctx context.Context, model, prompt string) (string, error)

	// CostProvider is used to estimate USD cost for each step's token usage.
	// When nil, CostUSD fields are left at zero.
	CostProvider costs.CostProvider

	// ArtifactStore is the backend where step-produced file artifacts are stored.
	// When nil, artifact declarations on pipeline steps are silently ignored.
	ArtifactStore artifacts.Store

	// ArtifactBaseDir is the local base directory scanned for artifacts after each step.
	// Each step writes files to <ArtifactBaseDir>/<stepName>/<artifactName>.
	// When empty and ArtifactStore is set, a temporary directory is created automatically.
	ArtifactBaseDir string
}

Executor drives ArkTeam pipelines locally without a Kubernetes cluster or Redis.

func (*Executor) RunTeam

func (e *Executor) RunTeam(
	ctx context.Context,
	t *arkonisv1alpha1.ArkTeam,
	agents map[string]*arkonisv1alpha1.ArkAgent,
	onEvent func(StepEvent),
) (*arkonisv1alpha1.ArkRun, error)

RunTeam executes an ArkTeam pipeline to completion, calling onEvent on each step transition. Only pipeline mode (spec.pipeline set) is supported locally. Dynamic mode requires a cluster. Returns the ArkRun execution record populated with step statuses and final output.

type StepEvent

type StepEvent struct {
	Step    string
	Phase   arkonisv1alpha1.ArkFlowStepPhase
	Output  string
	Tokens  queue.TokenUsage
	CostUSD float64
	Elapsed time.Duration
	Err     error
	// Validated is true when a validate block was configured and all checks passed.
	Validated bool
	// RetryCount is the current validation retry attempt number (> 0 on retry events).
	RetryCount int
}

StepEvent is emitted by the executor on each step state transition. Callers use it to render --watch output or collect --output json results.

Jump to

Keyboard shortcuts

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