@clearideas/agent-runtime-core
Executes agent manifests and manages state transitions, checkpoints, recovery,
cancellation, ordered events, output limits, and step dispatch. Applications
supply model, tool, persistence, artifact, approval, sandbox, sub-run,
workspace, run-sandbox, and telemetry adapters. ConnectionCredentialProvider
supplies host-managed connection headers and invalidates expired or
unauthorized credentials. WorkspaceProvider resolves manifest workspaces
bindings before a run is created, and RunSandboxProvider opens the per-run
sandbox lazily and closes it on every terminal path; resolved workspaces and
the session reach executors through StepExecutionContext.
Every resumed run receives an attempt number. Stores must use that attempt as a fencing token so
an older process cannot commit after a newer attempt takes ownership. Events are ordered by
(runId, attempt, sequence).
The runtime resolves manifest variable reads and outputs into dependency-aware execution waves. Runs are sequential by default. Parallel mode concurrently schedules eligible tool-free prompt branches and commits each wave in manifest order. Stateful steps and tool calls remain sequential.
Run requests may set budget.maxTotalTokens. The runtime checkpoints the
effective limit and cumulative provider-reported usage across attempts, and
suspends before another model or pending tool call when the limit is exhausted.
Resume may replace the limit with a higher value. Budgeted execution is
sequential.
Execution policies (context reduction, model retries, output repair, the
tool-call limit, and onError) are resolved from host defaults
(AgentRuntimeDependencies.policies), the manifest, and the step, and reach
executors as StepExecutionContext.policies. A step with onError: continue
records its error as its output and the run continues. Before a run is created,
preflight checks registered executors, executor-declared adapter
requirements, condition syntax, and tool names. Aborting a run's signal with
createRunPauseRequest() suspends it, with RunInterruptedError leaves it
interrupted and resumable, and with any other reason cancels it.