Skip to content

Graphorin API reference v0.1.0


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
AgentResolutionErrorThrown by RunState.fromJSON(...) 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.
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, both outputType: 'text' and outputSchema declared, ...).
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'.
MultipleHandoffsInStepErrorThrown when the model invokes more than one handoff (transfer_to_*) tool in a single response. Per the agent-loop documentation this is an error rather than a silent drop.
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 RunState.fromJSON(...) when the supplied JSON does not shape-match the documented SerializedRunState.
RunStateVersionUnsupportedErrorThrown by RunState.fromJSON(...) when the version field in the serialized state is from a future major version of the framework.
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.