Expand description
SDK-facing typed mirror of the engine’s Runtime* events.
These five variants describe the lifecycle of a runtime block — Akribes’s
first-class construct for running AI-generated code inside a sandboxed
container (Python, Bash, Node, Rust, Java). They flow alongside the
wrapping task’s TaskStart / TaskEnd so reducers that group by task
continue to work.
Wire shape uses the engine’s standard tagged envelope
{"type": "<Variant>", "payload": {...}} — same as TaskStart, TaskEnd,
ToolCallStart. See crates/akribes-core/src/event.rs for the
source-of-truth EngineEvent enum.
{"type": "RuntimeStart", "payload": {"task_name": "t", "runtime_name": "run_py", "language": "python"}}
{"type": "RuntimeStdout", "payload": {"task_name": "t", "chunk": "hello\n"}}
{"type": "RuntimeStderr", "payload": {"task_name": "t", "chunk": "warn\n"}}
{"type": "RuntimeEnd", "payload": {"task_name": "t", "exit_code": 0, "duration_ms": 1234}}
{"type": "RuntimeError", "payload": {"task_name": "t", "kind": "Timeout", "message": "..."}}RuntimeError.kind is a free-form string mirroring the engine’s
RuntimeError enum names (NotConfigured, Timeout, SandboxUnavailable,
OomKilled, Cancelled, Internal). Consumers that want a typed match
should use RuntimeErrorKind::from_wire.
Structs§
- Runtime
EndPayload RuntimeEnd— emitted exactly once when the runtime invocation finished successfully (the executor returned anExecResult).exit_code == 0is the conventional success signal but the engine surfaces non-zero codes here too — only true infrastructure failures (timeout, OOM, sandbox unreachable) emitRuntimeErrorPayloadinstead.- Runtime
Error Payload RuntimeError— emitted instead ofRuntimeEndwhen the runtime invocation could not complete (timeout, OOM, sandbox unavailable, configuration missing, …).kindis a stable string tag mirroring the engine’sRuntimeErrorenum;messageis human-readable.- Runtime
Start Payload RuntimeStart— emitted once when the engine dispatches aruntimeblock to the executor. Carries the wrapping task’s name, the runtime block’s declared name, and the language tag.- Runtime
Stderr Payload RuntimeStderr— one chunk of stderr from the running container.- Runtime
Stdout Payload RuntimeStdout— one chunk of stdout from the running container. Many of these may fire per invocation; consumers should accumulate.
Enums§
- Runtime
Error Kind - Typed mirror of the engine’s
RuntimeErrorenum for thekindfield onRuntimeErrorPayload. UseRuntimeErrorKind::from_wireto dispatch; unknown strings surface asRuntimeErrorKind::Unknownso the SDK stays forward-compatible. - Runtime
Event - Tagged-envelope decoder for the five
Runtime*events. Matches the engine’s#[serde(tag = "type", content = "payload")]shape so a raw JSON envelope decodes cleanly. The SDK uses this for the JSON-bypass path incrate::events::WorkflowEvent::from_envelope_json.