Help us shape the future of Go! Take the 2026 Go Developer Survey

executor

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package executor provides tool execution for the model-router sidecar. The router invokes Executor.Dispatch in-process (no separate HTTP listener). The executor dispatches to the correct backend:

  • regular (pod): spawns a fresh pod per invocation via the Kubernetes API
  • regular (sidecar): forwards to a sidecar container via unix socket
  • agent: creates a child AgentRun CRD and waits for completion
  • mcp: calls the MCP client (running in the model-router sidecar)
  • wasm: runs a WASM module embedded in the executor process

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

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

Executor handles tool dispatch requests from the model-router sidecar.

func New

func New(namespace, runName, agentSA, operatorAPIURL, saTokenFile string) (*Executor, error)

New creates an Executor using in-cluster Kubernetes credentials.

func (*Executor) Dispatch

Dispatch executes a tool request in-process (used by the model-router sidecar). MCP tools must be invoked via the router's MCP client; this path returns an error for backendType=mcp.

func (*Executor) ServeHTTP

func (e *Executor) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler for the executor service.

func (*Executor) WithStore

func (e *Executor) WithStore(s state.Store)

WithStore enables real-time token forwarding from child AgentRuns into the parent's token stream. When set, tokens produced by child agents are forwarded to the parent's Redis token stream so the UI sees streaming output during sub-agent execution rather than waiting for completion.

type ToolExecuteRequest

type ToolExecuteRequest struct {
	Tool        string          `json:"tool"`
	BackendType string          `json:"backendType"`
	Arguments   string          `json:"arguments"` // JSON-encoded
	RunName     string          `json:"runName"`
	Namespace   string          `json:"namespace"`
	SecretRefs  []ToolSecretRef `json:"secretRefs,omitempty"`
	Command     []string        `json:"command,omitempty"`
	Args        []string        `json:"args,omitempty"`
}

ToolExecuteRequest is the JSON body sent to localhost:8081/execute.

type ToolExecuteResponse

type ToolExecuteResponse struct {
	Result        string `json:"result"`
	Error         string `json:"error,omitempty"`
	ChildSpendUSD string `json:"childSpendUSD,omitempty"`
}

ToolExecuteResponse is the JSON body returned by localhost:8081/execute.

type ToolSecretRef

type ToolSecretRef struct {
	SecretName string `json:"secretName"`
	MountPath  string `json:"mountPath,omitempty"`
}

ToolSecretRef describes a Secret to inject into a tool pod.

Jump to

Keyboard shortcuts

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