Skip to content

Graphorin API reference v0.12.1


Graphorin API reference / @graphorin/agent / errors

errors

Typed error surface for @graphorin/agent.

Every error class extends the base AgentRuntimeError which is a thin wrapper around Error with a stable code discriminator so callers can switch on it without parsing messages.

Classes

ClassDescription
AgentBudgetExceededErrorThrown when a run crosses its RunBudget ceiling under onExceed: 'throw' (C5). The run's promise REJECTS with this error after an agent.error event; graceful finalization is skipped. The default onExceed: 'stop' never throws - it resolves the run as status: 'failed' with error.code: 'budget-exceeded' instead.
AgentResolutionErrorThrown by runStateFromJSON(...) when the agent name in the serialized state cannot be resolved against the supplied agent graph (renamed agent / removed handoff).
AgentRuntimeErrorBase class for every error thrown from @graphorin/agent.
ConcurrentRunErrorThrown when a second run() / stream() starts while another run is in flight on the same Agent instance (AG-11). The public surface (steer / followUp / abort / compact) addresses "the run" without a run handle, so overlapping runs would share the abort controller, steer queue, and executor bridge - start the second run on its own createAgent(...) instance instead.
EvaluatorOptimizerConfigErrorThrown by evaluatorOptimizer({...}) when maxIterations < 1 at construction time. The helper purposely surfaces the misuse early rather than failing on the first run.
InvalidAgentConfigErrorThrown by createAgent({...}) when the supplied options fail structural validation (missing provider, empty name, an outputType of kind 'text' carrying a schema, ...).
InvalidPreferredModelErrorThrown by createAgent({...}) when preferredModel carries an unknown literal (any value outside the `'fast'
MergeBlockedErrorThrown by Agent.fanOut(...) when the configured MergeAgentSidewaysInjectionGuard fires with strictness 'detect-and-block'.
MultipleHandoffsInStepErrorBase class for every error thrown from @graphorin/agent.
ProgressWriteErrorThrown by agent.progress.write(...) when the atomic write fails (disk full, permission denied, ...). The partial .tmp file is unlinked before the error propagates.
ProtocolInjectionRejectErrorThrown by the protocol-injection guard when the operator selected the strictest deployment posture (escapePolicy: 'reject') and a tool result body carries control characters at the corresponding outbound boundary.
ProviderMiddlewareOrderErrorThrown by createAgent({...}) when the supplied composeProviderMiddleware chain violates the canonical inside-out ordering (DEC-145 / ADR-039).
RunStateMalformedErrorThrown by runStateFromJSON(...) when the supplied JSON does not shape-match the documented SerializedRunState.
RunStateVersionUnsupportedErrorThrown by runStateFromJSON(...) when the version field in the serialized state is from a future major version of the framework.
SubAgentResumeTargetNotFoundErrorThrown when a resume directive routes a decision into a parked sub-agent run (W-001) but the resuming agent instance cannot resolve the target: the parked toolName matches neither a configured handoff target nor a toTool sub-agent tool. Resume a parked sub-run on the SAME parent instance (or an identically-configured one).
ToolNotFoundErrorThrown by the agent loop when the model emits a tool call referring to an unregistered tool (the model hallucinated a name).

Type Aliases

Type AliasDescription
AgentRuntimeErrorCodeStable code discriminator surfaced on every AgentRuntimeError.