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 (*Executor) Dispatch ¶
func (e *Executor) Dispatch(ctx context.Context, req ToolExecuteRequest) (ToolExecuteResponse, error)
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 ¶
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.