runner

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: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

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

Runner executes tasks by delegating to a configured LLMProvider. It merges tools from four sources:

  • MCP servers (discovered at startup)
  • Inline webhook tools (injected via AGENT_WEBHOOK_TOOLS env var)
  • Built-in tools (submit_subtask when a task queue is available)
  • Built-in tools (delegate when the agent is part of an ArkTeam)

func New

func New(cfg *config.Config, mcpManager *mcp.Manager, provider providers.LLMProvider, tq queue.TaskQueue, sc queue.StreamChannel, delegateQueues map[string]queue.TaskQueue) *Runner

New creates a Runner, builds the merged tool list, and wires up the task queue for the supervisor/worker submit_subtask built-in. delegateQueues is non-nil only when the agent is part of an ArkTeam; it maps role names to pre-connected TaskQueue instances for the delegate() built-in tool.

func (*Runner) AllTools

func (r *Runner) AllTools() []mcp.Tool

AllTools returns the merged tool list for use by the health probe and tests.

func (*Runner) CallTool

func (r *Runner) CallTool(ctx context.Context, toolName string, input json.RawMessage) (string, error)

CallTool dispatches a tool invocation to the correct handler. Priority: built-in → webhook → MCP.

func (*Runner) RunTask

func (r *Runner) RunTask(ctx context.Context, task queue.Task) (string, queue.TokenUsage, error)

RunTask executes a single task through the provider's agentic loop. Returns the text result, accumulated token usage, and any error. If task.Meta["stream_key"] is set and a task queue is available, each generated token chunk is published to that Redis List in real time.

func (*Runner) SetEventRecorder

func (r *Runner) SetEventRecorder(rec *observability.AgentEventRecorder)

SetEventRecorder wires in a Kubernetes event recorder for audit events. Called after New by the agent runtime; not used in tests or the CLI.

Jump to

Keyboard shortcuts

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