pub struct RunMeta {Show 32 fields
pub run_id: String,
pub agent_name: String,
pub agent_path: String,
pub task: String,
pub model: Option<String>,
pub pid: u32,
pub status: RunStatus,
pub current_stage: String,
pub stage_index: usize,
pub num_stages: usize,
pub iteration: usize,
pub prompt_tokens: usize,
pub completion_tokens: usize,
pub cached_tokens: usize,
pub cache_write_tokens: usize,
pub tool_calls: usize,
pub workdir: String,
pub started_at: i64,
pub updated_at: i64,
pub last_progress_at: Option<i64>,
pub error: Option<String>,
pub title: Option<String>,
pub metadata: HashMap<String, String>,
pub callback_url: Option<String>,
pub callback_secret: Option<String>,
pub parent_run_id: Option<String>,
pub children: Vec<String>,
pub depth: usize,
pub max_child_depth: usize,
pub flags: RunFlags,
pub yolo: bool,
pub read_paths: Option<ReadPathGrantCounts>,
}Expand description
Metadata for a single background agent run.
Fields§
§run_id: String§agent_name: String§agent_path: StringAbsolute path to the agent manifest directory
task: String§model: Option<String>§pid: u32Always 0. There is no worker process per run: the daemon hosts every run as an entity in one shared world, so no run has a pid of its own.
Kept because it is written into every meta.json there has ever been,
and served from GET /api/agents. Do not key liveness on it. pid == 0
is true of a run that is working, a run that has finished, and a run
nothing is driving, so a sweeper that reverts on it reverts everything.
Ask the daemon (lev ps) whether it is still hosting the run, and read
status and last_progress_at off disk for what became of it.
status: RunStatus§current_stage: String§stage_index: usize§num_stages: usize§iteration: usize§prompt_tokens: usize§completion_tokens: usize§cached_tokens: usizeCumulative tokens read from provider cache.
cache_write_tokens: usizeCumulative tokens written to provider cache.
tool_calls: usizeTotal number of tool calls made across all iterations.
workdir: StringAbsolute path to the working directory for tool execution
started_at: i64Unix timestamp (seconds)
updated_at: i64Unix timestamp (seconds)
last_progress_at: Option<i64>Unix seconds when this run last actually moved: a new iteration, a new
stage, or a change of status. None before the first snapshot lands, and
on runs written by a daemon older than this field.
Distinct from updated_at, which also advances on the 30-second
persistence heartbeat and so stays fresh on a run that is wedged. A fresh
updated_at is evidence the daemon is alive, and no evidence at all about
the run. Anything that ages a run must read this instead. Note that a
daemon restart resets it: a reloaded run really is re-driven from its
saved context, so it really has just moved.
error: Option<String>§title: Option<String>Short human-readable title generated from the task prompt (None until generated).
metadata: HashMap<String, String>Custom key-value pairs from the spawn request (API metadata).
callback_url: Option<String>Webhook URL to POST on agent completion/error.
callback_secret: Option<String>Optional shared secret used to HMAC-SHA256 sign the webhook body
(X-Leviath-Signature header) so the receiver can verify authenticity.
Persisted, because the daemon must still be able to sign a webhook for a
run it reloaded after a restart. Never serve it - strip it with
RunMeta::redacted before any of this struct leaves the process. See
that method for what went wrong.
parent_run_id: Option<String>Links sub-agent runs to their parent run.
children: Vec<String>Run-ids of this agent’s direct sub-agents (sub-agent-tool spawns and fan-out workers). Persisted so the daemon can rebuild the exact parent→children tree on restart rather than reload children as orphans.
depth: usizeThis agent’s depth in the sub-agent tree (0 for a top-level run). Persisted so a reloaded child enforces its remaining spawn-depth budget.
max_child_depth: usizeThe sub-agent depth cap this agent imposes on its own children
(0 when it has none). Restores SubAgentChildren::max_child_depth.
flags: RunFlagsWhy this run may have produced nothing useful - see RunFlags.
yolo: boolWhether the run was launched unattended (--yolo), so a daemon restart
resumes it the way it was started.
This used to be dropped on reload, on the reasoning that forgetting a launch override can only prompt more, never less. In practice it meant a restart silently converted an unattended run into one parked on a prompt nobody was watching for - the operator’s own consent, given at launch, discarded by an implementation detail they never saw. Runs written before this field existed default to attended, so nothing is escalated retroactively.
read_paths: Option<ReadPathGrantCounts>How much of the blueprint’s [read_paths] the config granted, as
resolved at spawn. None for a blueprint that declared none, and for
runs written before this field existed.
Implementations§
Source§impl RunMeta
impl RunMeta
Sourcepub fn redacted(&self) -> Self
pub fn redacted(&self) -> Self
This run’s metadata with the webhook signing secret removed, for anything that leaves the process.
GET /api/agents, /api/agents/{id} and /api/agents/{id}/children all
serialized RunMeta whole, so any holder of the API token could read
every run’s callback_secret - the key that authenticates Leviath’s
webhooks to their receivers. Mirrors the RedactedConfig pattern the
/api/config handler already uses correctly.
Returns an owned copy rather than mutating in place so a caller cannot accidentally redact the record the daemon still needs for signing.