Documentation
¶
Overview ¶
Package agent runs the COREMETRY_MODE=agent role: it claims automated runbook steps (http / javascript / bash) from the API, executes them in an isolated pod, and posts the result back. Arbitrary operator-authored code runs HERE — never in the api/ingest/worker roles — so the blast radius is a dedicated, non-root, restricted pod the operator controls. (v0.7.4)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutomatedStep ¶
type AutomatedStep struct {
Kind string `json:"kind"` // http | javascript | bash
URL string `json:"url,omitempty"`
Method string `json:"method,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Body string `json:"body,omitempty"`
Script string `json:"script,omitempty"`
Command string `json:"command,omitempty"`
TimeoutMs int `json:"timeoutMs,omitempty"`
}
AutomatedStep is the minimal payload an agent needs to run one step. It is the agent-facing projection of a runbook StepState (kind + the kind's payload), decoupled from the chstore type so the agent package stays dependency-light.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner is the COREMETRY_MODE=agent loop. It polls running runbook executions for a claimable automated step (the next non-terminal step, when its kind is http/javascript/bash), claims it via a Redis lock so only one agent pod runs it (HA-safe), executes it in-process (sandboxed), and writes the result back — advancing the execution. Multiple agent pods parallelize across executions; each runs at most one step per tick.
type StepResult ¶
type StepResult struct {
Output string `json:"output"` // stdout / return value / HTTP status+body (truncated)
Error string `json:"error,omitempty"` // empty = success
}
StepResult is the outcome of executing one automated step.
func Execute ¶
func Execute(ctx context.Context, s AutomatedStep) StepResult
Execute dispatches a step to the right executor. Unknown kinds return an error result (never panic) so a malformed step can't wedge the agent.