Skip to content

Graphorin API reference v0.12.1


Graphorin API reference / @graphorin/agent / / Agent

Interface: Agent<TDeps, TOutput>

Defined in: packages/agent/src/types.ts:825

Public agent surface returned by createAgent.

Stable

Type Parameters

Type ParameterDefault type
TDepsunknown
TOutputstring

Properties

PropertyModifierTypeDescriptionDefined in
configreadonlyAgentConfig<TDeps, TOutput>-packages/agent/src/types.ts:827
idreadonlystring-packages/agent/src/types.ts:826
progressreadonlyAgentProgressIOStructured handoff-artifact APIs. Persists / reads UTF-8 text artifacts under the configured artifact root; cross-run reads require an explicit runId cursor on the read options.packages/agent/src/types.ts:863
registry?readonlyToolRegistryThe unified tool registry assembled at createAgent(...) warm-up (Principle #12): every first-party + skill tool, with cross-source name collisions resolved deterministically. Read-only and exposed for inspection; the run loop and tool_search consume it. Always present on agents built by createAgent(...).packages/agent/src/types.ts:871

Methods

abort()

ts
abort(options?): void;

Defined in: packages/agent/src/types.ts:838

Parameters

ParameterType
options?AbortOptions

Returns

void


compact()

ts
compact(options?): Promise<CompactionApiResult>;

Defined in: packages/agent/src/types.ts:847

Parameters

ParameterType
options?CompactOptions

Returns

Promise&lt;CompactionApiResult&gt;


deserializeState()

ts
deserializeState(serialized): RunState;

Defined in: packages/agent/src/types.ts:888

Rehydrate a RunState previously produced by Agent.serializeState (or the exported runStateToJSON). Throws RunStateMalformedError / RunStateVersionUnsupportedError on an unreadable payload. The result feeds straight back into agent.run(state, { directive }).

Parameters

ParameterType
serializedstring

Returns

RunState


fanOut()

ts
fanOut<TFanOutOutput>(options): Promise<FanOutResult<TFanOutOutput>>;

Defined in: packages/agent/src/types.ts:855

Convenience wrapper around the standalone runFanOut(...). The returned FanOutResult carries per-child status + the merged output. Per-child failures are captured in children[].status

  • this method never throws on a child failure (the merge strategy decides whether to propagate).

Type Parameters

Type ParameterDefault type
TFanOutOutputunknown

Parameters

ParameterType
optionsAgentFanOutOptions&lt;TFanOutOutput&gt;

Returns

Promise<FanOutResult&lt;TFanOutOutput&gt;>


followUp()

ts
followUp(message): void;

Defined in: packages/agent/src/types.ts:837

Parameters

ParameterType
messageAgentInput

Returns

void


isBusy()

ts
isBusy(): boolean;

Defined in: packages/agent/src/types.ts:845

C1: true while this instance has a run in flight (the same invariant that makes a second run() throw ConcurrentRunError). The public busy signal for proactive coordination - a heartbeat defers its beat instead of colliding with an interactive run.

Returns

boolean


run()

ts
run(input, options?): Promise<AgentResult<TOutput>>;

Defined in: packages/agent/src/types.ts:832

Parameters

ParameterType
input| RunState | AgentInput
options?AgentCallOptions&lt;TDeps&gt;

Returns

Promise<AgentResult&lt;TOutput&gt;>


serializeState()

ts
serializeState(state): string;

Defined in: packages/agent/src/types.ts:880

Render the canonical durable JSON form of a (typically suspended) RunState: version-stamped (graphorin-run-state/x.y), binary payloads projected to their wire envelopes, secret-named keys redacted. The @graphorin/server run tracker persists awaiting_approval runs through this codec so a resume survives a process restart; pairs with Agent.deserializeState.

Parameters

ParameterType
stateRunState

Returns

string


steer()

ts
steer(message): void;

Defined in: packages/agent/src/types.ts:836

Parameters

ParameterType
messageAgentInput

Returns

void


stream()

ts
stream(input, options?): AsyncIterable<AgentEvent<TOutput>>;

Defined in: packages/agent/src/types.ts:828

Parameters

ParameterType
input| RunState | AgentInput
options?AgentCallOptions&lt;TDeps&gt;

Returns

AsyncIterable<AgentEvent&lt;TOutput&gt;>


toTool()

ts
toTool(options?): Tool<{
  input: string;
}, TOutput, TDeps>;

Defined in: packages/agent/src/types.ts:846

Parameters

ParameterType
options?AgentToToolOptions

Returns

Tool<{ input: string; }, TOutput, TDeps>