Agents API
Generated public TypeScript reference for @relkit/agents.
Common APIs
For configuration and examples, read approvals, agents, organization.
For a complete workflow, follow build an offline agent.
Frontend usage
Observe an agent and send controls shows the client side of this capability.
Public imports
@relkit/agents— 182 exports@relkit/agents/client-events— 5 exports
All exported APIs
Names link to their complete contracts. Re-exports share their original contract; legacy exports keep their separate identity. Examples link to the API’s inline sample, a maintained repository usage, or the shared module walkthrough.
agent-client-chat.ts
copyAgentChat
Copies a chat mapping for synchronous descriptor callers.
Throws
TypeError for a noncanonical mapping.
Example
import { copyAgentChat } from "@relkit/agents";
const chat = copyAgentChat({ input: "message", output: "answer" });
void chat;
Signature
declare const copyAgentChat: (value: unknown) => AgentChatMapping | undefined;
copyAgentChatEffect
Validates the fixed chat input and output mapping.
Example
import { Effect } from "effect";
import { copyAgentChatEffect } from "@relkit/agents";
const chat = Effect.runSync(copyAgentChatEffect({ input: "message", output: "answer" }));
void chat;
Signature
declare const copyAgentChatEffect: (
value: unknown,
) => Effect.Effect<
Readonly<{ input: "message"; output: "answer" }> | undefined,
AgentClientPolicyError,
never
>;
agent-client-controls.ts
copyAgentControls
Copies client controls for synchronous descriptor callers.
Throws
TypeError when an unsupported or duplicate control is present.
Example
import { copyAgentControls } from "@relkit/agents";
const controls = copyAgentControls(["stop"]);
void controls;
Signature
declare const copyAgentControls: (value: unknown) => readonly AgentControl[] | undefined;
copyAgentControlsEffect
Validates and freezes client control capabilities.
Example
import { Effect } from "effect";
import { copyAgentControlsEffect } from "@relkit/agents";
const controls = Effect.runSync(copyAgentControlsEffect(["stop"]));
void controls;
Signature
declare const copyAgentControlsEffect: (
value: unknown,
) => Effect.Effect<ReadonlyArray<AgentControl> | undefined, AgentClientPolicyError, never>;
agent-client-error.ts
AgentClientPolicyError (class)
Expected client configuration failure in the Effect error channel.
Signature
declare class AgentClientPolicyError
clientPolicyCount
Signature
declare const clientPolicyCount: Metric.Counter<number>;
clientPolicyFailures
Signature
declare const clientPolicyFailures: Metric.Counter<number>;
agent-client-policy.ts
copyAgentClientPolicy
Copies a client policy for synchronous descriptor callers.
Throws
TypeError for malformed access, state, or event declarations.
Example
import { copyAgentClientPolicy } from "@relkit/agents";
const policy = copyAgentClientPolicy({ public: true }, new Set<string>());
void policy;
Signature
declare const copyAgentClientPolicy: <StateKey extends string>(
value: unknown,
allowedStateKeys?: ReadonlySet<StateKey>,
) => AgentClientPolicy<(...args: any[]) => unknown, StateKey> | undefined;
copyAgentClientPolicyEffect
Validates and freezes client access, state keys, and event schemas.
Example
import { Effect } from "effect";
import { copyAgentClientPolicyEffect } from "@relkit/agents";
const policy = Effect.runSync(copyAgentClientPolicyEffect({ public: true }, new Set<string>()));
void policy;
Signature
declare const copyAgentClientPolicyEffect: <StateKey extends string>(
value: unknown,
allowedStateKeys?: ReadonlySet<StateKey> | undefined,
) => Effect.Effect<
| Readonly<{
events?: Readonly<Record<string, StandardSchemaV1<unknown, unknown>>>;
state?: ReadonlyArray<StateKey>;
public: true;
}>
| Readonly<{
events?: Readonly<Record<string, StandardSchemaV1<unknown, unknown>>>;
state?: ReadonlyArray<StateKey>;
authorize: (...args: any[]) => unknown;
}>
| undefined,
AgentClientPolicyError,
never
>;
agent-client.ts
“./agent-client-chat.js” (namespace export)
Re-exports all named exports from the “./agent-client-chat.js” module.
Signature
export * from "./agent-client-chat.js";
“./agent-client-controls.js” (namespace export)
Re-exports all named exports from the “./agent-client-controls.js” module.
Signature
export * from "./agent-client-controls.js";
“./agent-client-error.js” (namespace export)
Re-exports all named exports from the “./agent-client-error.js” module.
Signature
export * from "./agent-client-error.js";
“./agent-client-policy.js” (namespace export)
Re-exports all named exports from the “./agent-client-policy.js” module.
Signature
export * from "./agent-client-policy.js";
AgentChatMapping
Signature
declare const AgentChatMapping: AgentChatMapping;
AgentClientEvents
Signature
declare const AgentClientEvents: Readonly<Record<string, StandardSchemaV1<unknown, unknown>>>;
AgentClientPolicy
Signature
declare const AgentClientPolicy: AgentClientPolicy<Guard, StateKey, Events>;
AgentControl
Signature
declare const AgentControl: AgentControl;
agent-client.types.ts
AgentChatMapping (interface)
Fixed input and output field mapping for an agent chat client.
Example
const chat: AgentChatMapping = { input: "message", output: "answer" };
Signature
export interface AgentChatMapping {
readonly input: "message";
readonly output: "answer";
}
AgentClientEvents (type alias)
Named public events and their Standard Schema validators. Names must be nonempty before the policy is published.
Example
import { z } from "@relkit/schema";
const events: AgentClientEvents = { completed: z.string() };
Signature
type AgentClientEvents = Readonly<Record<string, StandardSchemaV1>>;
AgentClientPolicy (type alias)
Client visibility, selected state, and public event schemas. Exactly one of public access and an authorization guard must be supplied.
Example
const policy: AgentClientPolicy = { public: true, state: ["answer"] };
Signature
type AgentClientPolicy<
Guard = (...args: any[]) => unknown,
StateKey extends string = string,
Events extends AgentClientEvents = AgentClientEvents,
> = (
| { readonly public: true; readonly authorize?: never }
| { readonly authorize: Guard; readonly public?: never }
) & {
readonly state?: readonly StateKey[];
readonly events?: Events;
};
AgentControl (type alias)
Durable control capabilities that may be exposed to an agent client.
Example
const control: AgentControl = "stop";
Signature
type AgentControl = "steer" | "follow-up" | "stop" | "approve";
agent-telemetry.ts
AgentOperation
Signature
declare const AgentOperation: AgentOperation;
AgentTelemetry (class)
Injectable telemetry boundary for agent operations.
Example
Effect.provide(observeAgent("capture.policy", Effect.void), AgentTelemetryLive);
Signature
declare class AgentTelemetry
AgentTelemetryLive
Live metric observer for traced agent operations.
Example
Effect.runSync(Effect.provide(observeAgent("capture.policy", Effect.void), AgentTelemetryLive));
Signature
declare const AgentTelemetryLive: Layer.Layer<AgentTelemetry, never, never>;
AgentTelemetryService
Signature
declare const AgentTelemetryService: AgentTelemetryService;
observeAgent
Records a call, duration, and failure with a fixed operation label.
Example
observeAgent("capture.policy", Effect.succeed({ mode: "off" }));
Signature
declare const observeAgent: <A, E, R>(
operation: AgentOperation,
effect: Effect.Effect<A, E, R>,
) => Effect.Effect<A, E, R>;
agent-telemetry.types.ts
AgentOperation (type alias)
Fixed operation labels for agent telemetry; no user value is a label.
Example
const operation: AgentOperation = "runtime.invoke-tool";
Signature
type AgentOperation =
| "client.controls"
| "client.chat"
| "client.copy"
| "validation.schema"
| "validation.is-schema"
| "validation.positive-integer"
| "validation.is-positive-integer"
| "validation.is-record"
| "capture.policy"
| "capture.content"
| "capture.span"
| "client-schema.merge"
| "client-schema.select"
| "client-schema.project"
| "client-events.project"
| "graph-state.select"
| "graph-interruption.response"
| "graph-interruption.requests"
| "graph-interruption.is-error"
| "thread-transition.decide"
| "runtime.invoke"
| "runtime.create"
| "approval.requires"
| "approval.create"
| "approval.approve"
| "approval.deny"
| "approval.assert-granted"
| "approval.is-record"
| "model-selector.normalize"
| "model-selector.parse"
| "model-selector.resolve"
| "persistence.release"
| "persistence.resolve-graph"
| "persistence.resolve-agent"
| "bucket.list"
| "bucket.delete"
| "bucket.glob"
| "bucket.grep"
| "bucket.read-data"
| "bucket.write-data"
| "bucket.scoped-keys"
| "bucket.info"
| "bucket.read-raw"
| "bucket.read"
| "bucket.write"
| "bucket.edit"
| "bucket.upload"
| "bucket.download"
| "bucket.create"
| "bucket.thread"
| "definition.copy-instructions"
| "definition.is-instructions"
| "definition.is-descriptor"
| "definition.assert-descriptor"
| "definition.normalize-model"
| "definition.copy-deep"
| "definition.has-deep"
| "definition.is-model"
| "definition.copy-middleware"
| "definition.state-keys"
| "definition.copy-tools"
| "definition.tool-refs"
| "graph.validate-resume"
| "graph.waiting"
| "graph.config"
| "graph.resume-command"
| "graph-node.destinations"
| "graph-node.copy-ends"
| "graph-node.result"
| "graph-node.input"
| "graph-node.handle"
| "graph-node.define"
| "graph-node.is-descriptor"
| "definition.copy-limits"
| "definition.define"
| "generated.id"
| "generated.create"
| "generated.is-function"
| "persistence.is-resource"
| "persistence.assert-protocol"
| "persistence.define-checkpointer"
| "persistence.define-memory"
| "runtime.resolve-model"
| "runtime.content-limits"
| "graph.invoke"
| "graph.workflow"
| "graph.requires-persistence"
| "graph.define"
| "graph.execution"
| "graph.is-descriptor"
| "graph.subgraph-create"
| "graph.subgraph-is-node"
| "graph.subgraph-source"
| "native-hitl.response-schema"
| "native-hitl.is-request"
| "native-hitl.public-request"
| "native-hitl.is-decision"
| "native-hitl.is-record"
| "native-hitl.resume-command"
| "native-hitl.waiting"
| "native-hitl.validate-reply"
| "graph.compile"
| "graph.route"
| "graph.edge-builder"
| "graph.add-edge"
| "graph.add-conditional-edge"
| "graph.destination"
| "graph.validate-route"
| "graph.prepare-definition"
| "runtime.validate-value"
| "runtime.json-value"
| "runtime.model-failure"
| "runtime.selected-state-schemas"
| "graph-node.validate-destinations"
| "graph-node.command-update"
| "graph-node.validated-update"
| "graph-node.validated-value"
| "bucket.context"
| "bucket.virtual-path"
| "bucket.key"
| "bucket.file-path"
| "bucket.page"
| "bucket.control-failure"
| "bucket.error-message"
| "bucket.text-mime-type"
| "runtime.collect-native-events"
| "runtime.emit-native-tool-event"
| "runtime.selected-state"
| "runtime.select-state-fields"
| "runtime.native-public-event"
| "runtime.public-event-value"
| "runtime.public-tool-value"
| "runtime.message-update"
| "runtime.native-limits"
| "runtime.model-limit"
| "runtime.tool-limit"
| "runtime.combine-native-tools"
| "runtime.native-instructions"
| "runtime.load-deepagents"
| "runtime.assert-dependencies"
| "runtime.model-tool-name"
| "runtime.find-model-tool"
| "runtime.find-tool"
| "runtime.run-tool"
| "runtime.emit-tool"
| "runtime.resolve-approval"
| "runtime.create-tool-dispatcher"
| "runtime.invoke-tool"
| "graph.stream-compiled"
| "graph.run-compiled"
| "observability.emit-edge"
| "runtime.create-native-tools"
| "runtime.create-agent-tools"
| "runtime.response-format"
| "runtime.child-model"
| "runtime.create-subagents"
| "runtime.create-native-agent"
| "runtime.native-messages"
| "runtime.response-value"
| "runtime.unwrap-native-cause"
| "runtime.run-loop"
| "signal.failure"
| "signal.create"
| "signal.acquire"
| "signal.with-signal"
| "client.agent-metadata"
| "client.graph-metadata";
AgentTelemetryService (interface)
Replaceable observer used by Effect operations and deterministic tests.
Signature
export interface AgentTelemetryService {
/** Records an operation without changing its Effect channels.
* @param operation - Fixed agent operation name.
* @param effect - Work to instrument.
* @returns The same success, error, and dependency channels.
* @example telemetry.observe("capture.policy", Effect.succeed({ mode: "off" }));
*/
readonly observe: <A, E, R>(
operation: AgentOperation,
effect: Effect.Effect<A, E, R>,
) => Effect.Effect<A, E, R>;
}
agent-validation-error.ts
AgentValidationError (class)
Typed validation failure raised by an Effect agent-authoring operation.
Example
const error = new AgentValidationError({
operation: "positiveInteger",
message: "limit must be positive",
});
Signature
declare class AgentValidationError
validationCount
Signature
declare const validationCount: Metric.Counter<number>;
validationFailures
Signature
declare const validationFailures: Metric.Counter<number>;
agent-validation-schema.ts
assertAgentSchema
Throws for an invalid schema in existing synchronous authoring calls.
Throws
TypeError when the value is not a Standard Schema v1 validator.
Example
assertAgentSchema(z.string(), "input");
Signature
declare const assertAgentSchema: (
value: unknown,
name: string,
) => asserts value is StandardSchemaV1;
assertAgentSchemaEffect
Validates that a value implements the Standard Schema v1 protocol.
Example
const schema = Effect.runSync(assertAgentSchemaEffect(z.string(), "input"));
Signature
declare const assertAgentSchemaEffect: (
value: unknown,
name: string,
) => Effect.Effect<StandardSchemaV1<unknown, unknown>, AgentValidationError, never>;
isAgentSchema
Checks whether a candidate implements Standard Schema v1.
Example
if (isAgentSchema(value)) value["~standard"].validate(input);
Signature
declare const isAgentSchema: (value: unknown) => value is StandardSchemaV1;
isAgentSchemaEffect
Checks the Standard Schema v1 protocol without throwing.
Example
const valid = Effect.runSync(isAgentSchemaEffect(z.string()));
Signature
declare const isAgentSchemaEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
agent-validation-value.ts
isPositiveInteger
Checks a finite positive integer for existing synchronous callers.
Example
if (isPositiveInteger(value)) console.log(value + 1);
Signature
declare const isPositiveInteger: (value: unknown) => value is number;
isPositiveIntegerEffect
Checks for a finite positive integer without throwing.
Example
const valid = Effect.runSync(isPositiveIntegerEffect(3));
Signature
declare const isPositiveIntegerEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
isRecord
Checks a record for existing synchronous callers.
Example
if (isRecord(value)) console.log(value.id);
Signature
declare const isRecord: (value: unknown) => value is Record<PropertyKey, unknown>;
isRecordEffect
Checks a non-null, non-array record through an Effect operation.
Example
const valid = Effect.runSync(isRecordEffect({ id: "one" }));
Signature
declare const isRecordEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
positiveInteger
Validates a finite positive integer for existing synchronous callers.
Throws
TypeError when the value is not a finite positive integer.
Example
const limit = positiveInteger(3, "maxSteps");
Signature
declare const positiveInteger: (value: unknown, name: string) => number;
positiveIntegerEffect
Validates a finite positive integer with a typed Effect failure.
Example
const limit = Effect.runSync(positiveIntegerEffect(3, "maxSteps"));
Signature
declare const positiveIntegerEffect: (
value: unknown,
name: string,
) => Effect.Effect<number, AgentValidationError, never>;
agent-validation.ts
“./agent-validation-error.js” (namespace export)
Re-exports all named exports from the “./agent-validation-error.js” module.
Signature
export * from "./agent-validation-error.js";
“./agent-validation-schema.js” (namespace export)
Re-exports all named exports from the “./agent-validation-schema.js” module.
Signature
export * from "./agent-validation-schema.js";
“./agent-validation-value.js” (namespace export)
Re-exports all named exports from the “./agent-validation-value.js” module.
Signature
export * from "./agent-validation-value.js";
approval-core.ts
APPROVAL_STATES
Signature
declare const APPROVAL_STATES: readonly ["pending", "approved", "denied"];
approveApprovalValue
Grants a pending approval.
Throws
ApprovalStateError for an invalid transition.
Example
approveApprovalValue(pending);
Signature
declare const approveApprovalValue: (approval: ApprovalRecord) => ApprovedApproval;
assertApprovalGrantedValue
Checks whether execution is approved.
Throws
ApprovalRequiredError, ApprovalDeniedError, or ApprovalStateError.
Example
assertApprovalGrantedValue(approved);
Signature
declare const assertApprovalGrantedValue: (
approval: ApprovalRecord,
) => asserts approval is ApprovedApproval;
createApprovalValue
Constructs a canonical approval record.
Throws
TypeError or ApprovalStateError for invalid metadata.
Example
createApprovalValue(options);
Signature
declare const createApprovalValue: (options: ApprovalOptions) => ApprovalRecord;
denyApprovalValue
Denies a pending approval.
Throws
ApprovalStateError for an invalid transition.
Example
denyApprovalValue(pending);
Signature
declare const denyApprovalValue: (approval: ApprovalRecord) => DeniedApproval;
isApprovalRecordValue
Recognizes canonical approval records.
Example
isApprovalRecordValue(value);
Signature
declare const isApprovalRecordValue: (value: unknown) => value is ApprovalRecord;
requiresApprovalValue
Computes whether a policy requires approval.
Throws
TypeError for invalid inputs.
Example
requiresApprovalValue("always", "read");
Signature
declare const requiresApprovalValue: (
policy: ApprovalPolicy,
sideEffect: ApprovalSideEffect,
) => boolean;
approval-effect-error.ts
ApprovalEffectError (class)
Tagged failure for an invalid approval or denied execution.
Signature
declare class ApprovalEffectError
approvalEffectError
Preserves an approval error for typed Effect recovery and compatibility adapters.
Example
approvalEffectError(new ApprovalStateError("invalid state"));
Signature
declare const approvalEffectError: (cause: unknown) => ApprovalEffectError;
approval-error.ts
ApprovalDeniedError (class)
Execution was attempted after an approval was denied.
Example
throw new ApprovalDeniedError(denied);
Signature
declare class ApprovalDeniedError { constructor(readonly approval: DeniedApproval) }
code (property)
Signature
readonly code: "RELKIT_APPROVAL_DENIED"
ApprovalRequiredError (class)
Execution was attempted while an approval remains pending.
Example
throw new ApprovalRequiredError(pending);
Signature
declare class ApprovalRequiredError { constructor(readonly approval: PendingApproval) }
code (property)
Signature
readonly code: "RELKIT_APPROVAL_REQUIRED"
ApprovalStateError (class)
A malformed approval or invalid state transition.
Example
throw new ApprovalStateError("Cannot transition approved approval");
Signature
declare class ApprovalStateError {
constructor(message: string);
}
code (property)
Signature
readonly code: "RELKIT_APPROVAL_STATE_INVALID"
approval.ts
approveApproval
Moves a pending approval to the approved state.
Throws
ApprovalStateError for a malformed or final decision.
Example
import { approveApproval, createApproval } from "@relkit/app/agents";
const pending = createApproval({
invocationId: "run",
toolCallId: "call",
toolId: "send",
sideEffect: "write",
policy: "always",
});
const approved = approveApproval(pending);
void approved;
Signature
declare const approveApproval: (approval: ApprovalRecord) => ApprovedApproval;
Since v0.4.0
denyApproval
Moves a pending approval to the denied state.
Throws
ApprovalStateError for a malformed or final decision.
Example
import { createApproval, denyApproval } from "@relkit/app/agents";
const pending = createApproval({
invocationId: "run",
toolCallId: "call",
toolId: "send",
sideEffect: "write",
policy: "always",
});
const denied = denyApproval(pending);
void denied;
Signature
declare const denyApproval: (approval: ApprovalRecord) => DeniedApproval;
Since v0.4.0
“./approval.types.js” (namespace export)
Re-exports all named exports from the “./approval.types.js” module.
Signature
export * from "./approval.types.js";
APPROVAL_STATES
Signature
declare const APPROVAL_STATES: readonly ["pending", "approved", "denied"];
ApprovalDeniedError
Signature
declare const ApprovalDeniedError: typeof ApprovalDeniedError;
ApprovalEffectError
Signature
declare const ApprovalEffectError: typeof ApprovalEffectError;
ApprovalRequiredError
Signature
declare const ApprovalRequiredError: typeof ApprovalRequiredError;
ApprovalStateError
Signature
declare const ApprovalStateError: typeof ApprovalStateError;
approveApprovalEffect
Moves a pending approval to the approved state.
Example
Effect.runSync(approveApprovalEffect(pending));
Signature
declare const approveApprovalEffect: (
approval: ApprovalRecord,
) => Effect.Effect<ApprovedApproval, ApprovalEffectError, never>;
assertApprovalGranted
Rejects execution unless the record is approved.
Throws
ApprovalRequiredError, ApprovalDeniedError, or ApprovalStateError.
Example
assertApprovalGranted(approved);
Signature
declare const assertApprovalGranted: (
approval: ApprovalRecord,
) => asserts approval is ApprovedApproval;
assertApprovalGrantedEffect
Fails unless the record was approved.
Example
Effect.runSync(assertApprovalGrantedEffect(approved));
Signature
declare const assertApprovalGrantedEffect: (
approval: ApprovalRecord,
) => Effect.Effect<void, ApprovalEffectError, never>;
createApproval
Creates an immutable pending or policy-approved record.
Throws
TypeError or ApprovalStateError for invalid metadata.
Example
createApproval({
invocationId: "run",
toolCallId: "call",
toolId: "send",
sideEffect: "write",
policy: "always",
});
Signature
declare const createApproval: (options: ApprovalOptions) => ApprovalRecord;
createApprovalEffect
Creates an immutable pending or policy-approved record.
Example
Effect.runSync(createApprovalEffect(options));
Signature
declare const createApprovalEffect: (
options: ApprovalOptions,
) => Effect.Effect<ApprovalRecord, ApprovalEffectError, never>;
denyApprovalEffect
Moves a pending approval to the denied state.
Example
Effect.runSync(denyApprovalEffect(pending));
Signature
declare const denyApprovalEffect: (
approval: ApprovalRecord,
) => Effect.Effect<DeniedApproval, ApprovalEffectError, never>;
isApprovalRecord
Checks whether a value is a canonical approval record.
Example
if (isApprovalRecord(value)) console.log(value.state);
Signature
declare const isApprovalRecord: (value: unknown) => value is ApprovalRecord;
isApprovalRecordEffect
Checks whether a value is a canonical approval record.
Example
Effect.runSync(isApprovalRecordEffect(value));
Signature
declare const isApprovalRecordEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
requiresApproval
Tests whether a tool call needs an explicit approval decision.
Throws
TypeError for an invalid policy or side effect.
Example
requiresApproval("on-write", "write");
Signature
declare const requiresApproval: (policy: ApprovalPolicy, sideEffect: ApprovalSideEffect) => boolean;
requiresApprovalEffect
Tests whether a tool call needs an explicit approval decision.
Example
Effect.runSync(requiresApprovalEffect("on-write", "write"));
Signature
declare const requiresApprovalEffect: (
policy: FunctionToolApproval,
sideEffect: FunctionToolSideEffect,
) => Effect.Effect<boolean, ApprovalEffectError, never>;
approval.types.ts
ApprovalMetadata (interface)
Argument-free metadata for one invocation and tool-call decision.
Signature
export interface ApprovalMetadata extends ApprovalOptions {
readonly required: boolean;
readonly state: ApprovalState;
}
ApprovalOptions (interface)
Inputs used to create an approval record.
Signature
export interface ApprovalOptions {
readonly invocationId: string;
readonly toolCallId: string;
readonly toolId: string;
readonly sideEffect: ApprovalSideEffect;
readonly policy: ApprovalPolicy;
}
ApprovalPolicy (type alias)
Policy controlling which tool calls require approval.
Signature
type ApprovalPolicy = ToolApproval;
ApprovalRecord (type alias)
Canonical approval record in any valid state.
Signature
type ApprovalRecord = PendingApproval | ApprovedApproval | DeniedApproval;
ApprovalSideEffect (type alias)
Declared side effect of a tool call.
Signature
type ApprovalSideEffect = ToolSideEffect;
ApprovalState (type alias)
One canonical approval state.
Signature
type ApprovalState = "pending" | "approved" | "denied";
ApprovedApproval (interface)
Approval granted by policy or an explicit decision.
Signature
export interface ApprovedApproval extends ApprovalMetadata {
readonly state: "approved";
}
DeniedApproval (interface)
Approval explicitly denied.
Signature
export interface DeniedApproval extends ApprovalMetadata {
readonly state: "denied";
}
PendingApproval (interface)
Approval that must receive a decision before execution.
Signature
export interface PendingApproval extends ApprovalMetadata {
readonly state: "pending";
}
capture-content.ts
captureAgentContent
Captures redacted content for synchronous runtime callers.
Example
const record = captureAgentContent({ token: "secret" }, policy);
Signature
declare const captureAgentContent: (
value: unknown,
policy: AgentCapturePolicy,
) => AgentCaptureRecord | undefined;
captureAgentContentEffect
Redacts and bounds a JSON-compatible agent value.
Example
const record = Effect.runSync(captureAgentContentEffect({ token: "secret" }, policy));
Signature
declare const captureAgentContentEffect: (
value: unknown,
policy: AgentCapturePolicy,
) => Effect.Effect<AgentCaptureRecord | undefined, never, never>;
capture-policy.ts
AgentCapturePolicyError (class)
Invalid capture configuration in the Effect error channel.
Signature
declare class AgentCapturePolicyError
createAgentCapturePolicy
Creates a capture policy for synchronous descriptor callers.
Throws
TypeError when mode, size, or redaction keys are invalid.
Example
const policy = createAgentCapturePolicy({ mode: "development-redacted", maxBytes: 1024 });
Signature
declare const createAgentCapturePolicy: (
value: AgentCapturePolicy | undefined,
) => AgentCapturePolicy;
createAgentCapturePolicyEffect
Validates and freezes a content capture policy.
Example
const policy = Effect.runSync(createAgentCapturePolicyEffect({ mode: "off" }));
Signature
declare const createAgentCapturePolicyEffect: (
value: AgentCapturePolicy | undefined,
) => Effect.Effect<AgentCapturePolicy, AgentCapturePolicyError, never>;
capture-span.ts
createAgentSpanCapture
Combines captured input and output for synchronous runtime callers.
Example
const capture = createAgentSpanCapture(input, output);
Signature
declare const createAgentSpanCapture: (
input: AgentCaptureRecord | undefined,
output: AgentCaptureRecord | undefined,
) => AgentSpanCapture | undefined;
createAgentSpanCaptureEffect
Combines optional captured input and output for an agent span.
Example
const capture = Effect.runSync(createAgentSpanCaptureEffect(input, output));
Signature
declare const createAgentSpanCaptureEffect: (
input: AgentCaptureRecord | undefined,
output: AgentCaptureRecord | undefined,
) => Effect.Effect<
Readonly<{ output?: AgentCaptureRecord; input?: AgentCaptureRecord }> | undefined,
never,
never
>;
capture.ts
“./capture-content.js” (namespace export)
Re-exports all named exports from the “./capture-content.js” module.
Signature
export * from "./capture-content.js";
“./capture-policy.js” (namespace export)
Re-exports all named exports from the “./capture-policy.js” module.
Signature
export * from "./capture-policy.js";
“./capture-span.js” (namespace export)
Re-exports all named exports from the “./capture-span.js” module.
Signature
export * from "./capture-span.js";
AgentCapturePolicy
Signature
declare const AgentCapturePolicy: AgentCapturePolicy;
AgentCaptureRecord
Signature
declare const AgentCaptureRecord: AgentCaptureRecord;
AgentSpanCapture
Signature
declare const AgentSpanCapture: AgentSpanCapture;
capture.types.ts
AgentCapturePolicy (interface)
Controls whether an agent may retain redacted content in its spans. Development capture requires a positive byte limit; off ignores the other fields.
Example
const policy: AgentCapturePolicy = { mode: "development-redacted", maxBytes: 1024 };
Signature
export interface AgentCapturePolicy {
readonly mode: "off" | "development-redacted";
readonly maxBytes?: number;
readonly redactKeys?: readonly string[];
}
AgentCaptureRecord (interface)
Captured JSON and its encoded size, or a marker when capture was truncated. The content property is absent whenever truncated is true.
Example
const record: AgentCaptureRecord = { mode: "development-redacted", bytes: 0, truncated: true };
Signature
export interface AgentCaptureRecord {
readonly mode: "development-redacted";
readonly bytes: number;
readonly truncated: boolean;
readonly content?: JsonValue;
}
AgentSpanCapture (interface)
Optional input and output captures attached to one agent span. Absent fields were disabled or unavailable at capture time.
Example
const capture: AgentSpanCapture = {
input: { mode: "development-redacted", bytes: 0, truncated: true },
};
Signature
export interface AgentSpanCapture {
readonly input?: AgentCaptureRecord;
readonly output?: AgentCaptureRecord;
}
client-contract-metadata.ts
Projects generic RELKIT tool references and public event schemas into client metadata. Native middleware, graph state and SDK schema projection remain in @relkit/langchain.
“./client-contract-metadata.types.js” (namespace export)
Re-exports all named exports from the “./client-contract-metadata.types.js” module.
Signature
export * from "./client-contract-metadata.types.js";
agentClientContractMetadata
Projects generic metadata for synchronous authoring.
Throws
The original metadata projection error.
Signature
declare const agentClientContractMetadata: (
options: AgentClientMetadataOptions,
) => AgentClientContractMetadata;
agentClientContractMetadataEffect
Projects an ordinary agent’s public contract without evaluating native schemas.
Signature
declare const agentClientContractMetadataEffect: (
options: AgentClientMetadataOptions,
) => Effect.Effect<AgentClientContractMetadata, AgentDefinitionFailure, never>;
client-contract-metadata.types.ts
Declares serializable agent client contract metadata shared by SDK-free authoring, graph normalization and runtime client projections. This companion contains the shared planning contracts without executing work.
AgentClientContractMetadata (interface)
Complete metadata needed to generate an agent client contract.
Signature
export interface AgentClientContractMetadata {
readonly tools: readonly ClientToolMetadata[];
readonly state: readonly ClientTypeField[];
readonly events: readonly ClientEventMetadata[];
readonly scopes: readonly ClientScopeMetadata[];
readonly waiting: readonly ClientWaitingMetadata[];
}
AgentClientMetadataOptions (interface)
Inputs for native agent client metadata.
Signature
export interface AgentClientMetadataOptions {
readonly id: string;
readonly tools: readonly ToolRefAny[];
readonly middleware?: readonly [];
readonly client?: AgentClientPolicy;
readonly subagents?: readonly SubagentMetadataSource[];
readonly interruptOn?: Readonly<Record<string, unknown>>;
}
ClientEventMetadata (type alias)
Client visible event schema or dynamic event marker.
Signature
type ClientEventMetadata = ClientTypeField | { readonly kind: "dynamic" };
ClientScopeMetadata (interface)
Client visible agent, subagent, or graph node scope.
Signature
export interface ClientScopeMetadata {
readonly kind: "agent" | "subagent" | "node" | "dynamic";
readonly id?: string;
}
ClientToolMetadata (type alias)
Client visible tool schema or dynamic tool marker.
Signature
type ClientToolMetadata =
| {
readonly id: string;
readonly input: ClientSchemaMetadata;
readonly output: ClientSchemaMetadata;
}
| { readonly kind: "dynamic" };
ClientWaitingMetadata (interface)
Client visible continuation response schema.
Signature
export interface ClientWaitingMetadata {
readonly scope: ClientScopeMetadata;
readonly response: ClientSchemaMetadata;
}
SubagentMetadataSource (interface)
Source of nested subagent scope identities.
Signature
export interface SubagentMetadataSource {
readonly id: string;
readonly subagents?: readonly SubagentMetadataSource[];
}
client-contract-schema.ts
Describes Standard Schema input and output contracts for generic agent clients without importing a native model or graph SDK.
ClientSchemaMetadata
Signature
declare const ClientSchemaMetadata: ClientSchemaMetadata;
ClientTypeField
Signature
declare const ClientTypeField: ClientTypeField;
clientSchemaMetadata
Synchronously projects schema metadata for existing descriptor callers.
Example
const metadata = clientSchemaMetadata({ type: "string" });
Signature
declare const clientSchemaMetadata: (value: unknown) => ClientSchemaMetadata;
clientSchemaMetadataEffect
Projects a schema-like value to safe client metadata.
Example
const metadata = Effect.runSync(clientSchemaMetadataEffect({ type: "string" }));
Signature
declare const clientSchemaMetadataEffect: (
value: unknown,
) => Effect.Effect<ClientSchemaMetadata, never, never>;
dynamicClientSchema
Marker for a schema that cannot be represented in the client contract.
Signature
declare const dynamicClientSchema: Readonly<{ kind: "dynamic" }>;
mergeClientSchemas
Synchronously merges client schemas for existing descriptor callers.
Example
const schema = mergeClientSchemas([{ type: "object" }]);
Signature
declare const mergeClientSchemas: (values: readonly unknown[]) => ClientSchemaMetadata;
mergeClientSchemasEffect
Merges projected object schemas while preserving input order.
Example
const schema = Effect.runSync(mergeClientSchemasEffect([{ type: "object" }]));
Signature
declare const mergeClientSchemasEffect: (
values: ReadonlyArray<unknown>,
) => Effect.Effect<JsonValue, never, never>;
selectedClientFields
Synchronously selects client fields for existing descriptor callers.
Example
const fields = selectedClientFields({ type: "object" }, ["name"]);
Signature
declare const selectedClientFields: (
schema: ClientSchemaMetadata,
keys?: readonly string[],
) => readonly ClientTypeField[];
selectedClientFieldsEffect
Selects named client state fields from a projected object schema.
Example
const fields = Effect.runSync(selectedClientFieldsEffect({ type: "object" }, ["name"]));
Signature
declare const selectedClientFieldsEffect: (
schema: ClientSchemaMetadata,
keys?: ReadonlyArray<string> | undefined,
) => Effect.Effect<ReadonlyArray<ClientTypeField>, never, never>;
client-contract-schema.types.ts
ClientSchemaMetadata (type alias)
A projected JSON Schema fragment or an intentionally dynamic field.
Signature
type ClientSchemaMetadata = JsonValue | { readonly kind: "dynamic" };
ClientTypeField (interface)
One client-visible state field with its projected schema.
Signature
export interface ClientTypeField {
readonly name: string;
readonly schema: ClientSchemaMetadata;
readonly optional?: true;
}
client-events.ts
Projects durable agent journal records into bounded client lifecycle events while preserving tool identity and declared public values.
AgentClientEvent
Signature
declare const AgentClientEvent: AgentClientEvent;
AgentProgressEvent
Signature
declare const AgentProgressEvent: AgentProgressEvent;
AgentToolEvent
Signature
declare const AgentToolEvent: AgentToolEvent;
agentClientEvents
Projects a journal record for existing synchronous client callers.
Example
const events = agentClientEvents(record);
Signature
declare const agentClientEvents: (record: JournalRecord) => readonly AgentClientEvent[];
agentClientEventsEffect
Projects one journal record into ordered, public client events.
Example
const events = Effect.runSync(agentClientEventsEffect(record));
Signature
declare const agentClientEventsEffect: (
record: JournalRecord,
) => Effect.Effect<ReadonlyArray<AgentClientEvent>, never, never>;
client-tool-events.ts
Projects tool message parts into stable public event identities in authored order.
toolClientEvents
Signature
declare const toolClientEvents: (
base: ClientEventBase,
message: BrowserMessage,
) => readonly AgentClientEvent[];
define-agent-build.ts
Validates generic authoring inputs before binding a descriptor identity. Native fields are rejected with their integration import so no capability is silently ignored.
prepareAgentDescriptor
Prepares immutable generic metadata before applying its stable identity.
Throws
TypeError for unsupported native fields or invalid generic inputs.
Signature
declare const prepareAgentDescriptor: <
const Id extends string,
const InputSchema extends StandardSchemaV1,
const OutputSchema extends StandardSchemaV1,
const Tools extends readonly ToolRefAny[],
>(
options: DefineAgentOptions<Id, InputSchema, OutputSchema, Tools>,
) => (
id: Id,
) => AgentDescriptor<
Id,
InferInput<InputSchema>,
InferOutput<OutputSchema>,
InputSchema,
OutputSchema,
Tools
>;
define-agent-error.ts
AgentDefinitionFailure (class)
Tagged validation failure while copying an agent definition.
Signature
declare class AgentDefinitionFailure
agentDefinitionFailure
Preserves the original authoring error in a tagged Effect failure.
Example
agentDefinitionFailure(new TypeError("invalid"));
Signature
declare const agentDefinitionFailure: (cause: unknown) => AgentDefinitionFailure;
define-agent-limits.ts
copyAgentLimits
Copies limits for existing synchronous authoring callers.
Throws
The original invalid limits TypeError.
Example
const limits = copyAgentLimits({ maxSteps: 3, maxToolCalls: 2, timeoutMs: 1000 });
Signature
declare const copyAgentLimits: (value: unknown) => AgentLimits;
copyAgentLimitsEffect
Validates and freezes an agent’s execution limits.
Example
Effect.runSync(copyAgentLimitsEffect({ maxSteps: 3, maxToolCalls: 2, timeoutMs: 1000 }));
Signature
declare const copyAgentLimitsEffect: (
value: unknown,
) => Effect.Effect<
Readonly<{ maxSteps: number; maxToolCalls: number; timeoutMs: number }>,
AgentDefinitionFailure,
never
>;
define-agent-support.ts
copyAgentInstructions
Copies instructions for existing synchronous authoring callers.
Throws
The original invalid instruction error.
Example
const instructions = copyAgentInstructions("Answer clearly");
Signature
declare const copyAgentInstructions: (value: unknown) => AgentInstructions;
copyAgentInstructionsEffect
Validates and freezes agent instructions.
Example
Effect.runSync(copyAgentInstructionsEffect("Answer clearly"));
Signature
declare const copyAgentInstructionsEffect: (
value: unknown,
) => Effect.Effect<AgentInstructions, AgentDefinitionFailure, never>;
isAgentInstructions
Checks instructions for existing synchronous authoring callers.
Example
if (isAgentInstructions(value)) use(value);
Signature
declare const isAgentInstructions: (value: unknown) => value is AgentInstructions;
isAgentInstructionsEffect
Checks whether a value is an agent instruction descriptor.
Example
Effect.runSync(isAgentInstructionsEffect("Answer clearly"));
Signature
declare const isAgentInstructionsEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
define-agent-validation.ts
Validates generic agent descriptors and selector models before assembly, rejecting native execution options with an explicit integration import diagnostic.
assertAgentDescriptor
Requires a descriptor for existing synchronous authoring callers.
Throws
TypeError when the descriptor is invalid.
Example
assertAgentDescriptor(candidate);
Signature
declare const assertAgentDescriptor: (value: unknown) => asserts value is AgentAny;
assertAgentDescriptorEffect
Requires a valid agent descriptor.
Example
Effect.runSync(assertAgentDescriptorEffect(agent));
Signature
declare const assertAgentDescriptorEffect: (
value: unknown,
) => Effect.Effect<void, AgentDefinitionFailure, never>;
isAgentDescriptor
Checks a descriptor for existing synchronous authoring callers.
Example
if (isAgentDescriptor(candidate)) use(candidate);
Signature
declare const isAgentDescriptor: (value: unknown) => value is AgentAny;
isAgentDescriptorEffect
Checks the complete runtime shape of an agent descriptor.
Example
Effect.runSync(isAgentDescriptorEffect(candidate));
Signature
declare const isAgentDescriptorEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
normalizeAgentModel
Normalizes a model for existing synchronous authoring callers.
Throws
The original invalid selector error.
Example
const model = normalizeAgentModel("openai:gpt");
Signature
declare const normalizeAgentModel: (value: string | undefined) => string | undefined;
normalizeAgentModelEffect
Normalizes the selector of a string model definition.
Example
Effect.runSync(normalizeAgentModelEffect("openai:gpt"));
Signature
declare const normalizeAgentModelEffect: (
value: string | undefined,
) => Effect.Effect<string | undefined, AgentDefinitionFailure, never>;
define-agent.ts
Builds plain agent descriptors without loading an execution SDK. The compiler selects native execution when an application actually declares agents.
defineAgent
Defines an SDK-independent agent using validated schemas and RELKIT tool references.
Throws
The original authoring validation or identity error.
Example
import { defineAgent } from "@relkit/app/agents";
import { z } from "@relkit/app/schema";
const support = defineAgent({
id: "support",
input: z.object({ message: z.string() }),
output: z.object({ answer: z.string() }),
instructions: "Reply briefly.",
tools: [],
limits: { maxSteps: 4, maxToolCalls: 2, timeoutMs: 30_000 },
});
void support;
Signature
declare const defineAgent: <
const Id extends string,
const InputSchema extends StandardSchemaV1,
const OutputSchema extends StandardSchemaV1,
const Tools extends readonly ToolRefAny[],
>(
options: DefineAgentOptions<Id, InputSchema, OutputSchema, Tools>,
) => AgentDescriptor<
Id,
InferInput<InputSchema>,
InferOutput<OutputSchema>,
InputSchema,
OutputSchema,
Tools
>;
Since v0.4.0
Backend and frontend example
This SDK-independent factory describes the client contract. The runnable example below uses defineAgent from @relkit/langchain to supply native execution; see agent setup for the required integration and runtime bindings.
Backend — these maintained files define the operation used by the frontend below.
/** Runs an offline greeting agent with RELKIT/native tools, todo middleware and public state observation. */
import { defineAgent } from "@relkit/langchain";
import { z } from "@relkit/app/schema";
import { FakeToolCallingModel, todoListMiddleware, tool } from "langchain";
import lookup from "@app/services/hello/tools/lookup.tool.js";
export const uppercase = tool(async ({ text }: { readonly text: string }) => text.toUpperCase(), {
name: "uppercase",
description: "Uppercase text without leaving the process",
schema: z.object({ text: z.string() }),
});
export default defineAgent({
id: "hello.assistant",
input: z.object({ message: z.string().min(1) }),
output: z.object({ answer: z.string() }),
model: new FakeToolCallingModel({
toolCalls: [
[
{
name: "write_todos",
args: { todos: [{ content: "Answer the greeting", status: "completed" }] },
id: "todo-1",
},
],
[
{
name: "relkit_output",
args: { value: { answer: "Hello from the offline LangChain model." } },
id: "output-1",
},
],
],
}),
instructions: "Answer greeting questions with the available tools.",
tools: [lookup, uppercase],
middleware: [todoListMiddleware()],
stateProfile: "default",
client: {
public: true,
state: ["todos"],
events: { notice: z.object({ message: z.string() }) },
},
chat: { input: "message", output: "answer" },
controls: ["stop"],
limits: {
maxSteps: 4,
maxToolCalls: 4,
timeoutMs: 10_000,
},
});
Frontend
After frontend setup and pulling the greeting agent’s contract,
render this component under the provider. Supply a stable business threadId owned by your
application, such as the ID of the conversation the user opened:
"use client";
/** Sends one greeting to the documented hello.assistant agent and observes its typed answer. */
import { useAgent, useRelkitClient } from "@relkit/client/react";
import { useState } from "react";
/** Keeps the application-owned thread identity stable across rendering and observation.
* @param props - Authorized conversation identity retained by the application.
* @returns A greeting action, the observed answer, and explicit submission failure. */
export function Assistant({ threadId }: { readonly threadId: string }) {
const { status } = useRelkitClient();
const assistant = useAgent("hello.assistant");
const [failure, setFailure] = useState("");
/** Submits once and preserves uncertain outcomes for explicit recovery.
* @returns Completion after acceptance or displaying the failure. */
async function sendGreeting() {
try {
await assistant.send("Hello, RELKIT!", { threadId });
} catch (error) {
setFailure(String(error));
}
}
return (
<section>
<button
disabled={status !== "ready" || assistant.status !== "idle" || failure !== ""}
onClick={sendGreeting}
>
Say hello
</button>
<p role="status">{assistant.output?.answer ?? assistant.status}</p>
{failure && <p role="alert">{failure}. Check this thread before submitting again.</p>}
</section>
);
}
This is the same hello.assistant declaration: client.public exposes it, chat.input: "message"
makes send accept a string, and chat.output: "answer" selects its typed answer. Mounting
useAgent does not start a run. The backend owns models, credentials, tools, and authorization.
Reference: useAgent.
Continue with streaming and controls or
thread recovery.
“./define-agent.types.js” (namespace export)
Re-exports all named exports from the “./define-agent.types.js” module.
Signature
export * from "./define-agent.types.js";
AgentChatMapping
Signature
declare const AgentChatMapping: AgentChatMapping;
AgentClientPolicy
Signature
declare const AgentClientPolicy: AgentClientPolicy<Guard, StateKey, Events>;
AgentControl
Signature
declare const AgentControl: AgentControl;
assertAgentDescriptor
Signature
declare const assertAgentDescriptor: (value: unknown) => asserts value is AgentAny;
copyAgentLimits
Signature
declare const copyAgentLimits: (value: unknown) => AgentLimits;
copyAgentLimitsEffect
Signature
declare const copyAgentLimitsEffect: (
value: unknown,
) => Effect.Effect<
Readonly<{ maxSteps: number; maxToolCalls: number; timeoutMs: number }>,
AgentDefinitionFailure,
never
>;
defineAgentEffect
Validates plain authoring inputs and preserves source identity generation.
Signature
declare const defineAgentEffect: <
const Id extends string,
const InputSchema extends StandardSchemaV1,
const OutputSchema extends StandardSchemaV1,
const Tools extends readonly ToolRefAny[],
>(
options: DefineAgentOptions<Id, InputSchema, OutputSchema, Tools>,
) => Effect.Effect<
AgentDescriptor<
Id,
InferInput<InputSchema>,
InferOutput<OutputSchema>,
InputSchema,
OutputSchema,
Tools
>,
AgentDefinitionFailure,
never
>;
isAgentDescriptor
Signature
declare const isAgentDescriptor: (value: unknown) => value is AgentAny;
define-agent.types.ts
Defines the SDK-independent agent contract used by generic application authoring. Native model, middleware, graph and persistence APIs are owned by @relkit/langchain.
AgentDescriptor (interface)
Plain agent metadata; no execution SDK is evaluated by this declaration.
Signature
export interface AgentDescriptor<
Id extends string,
Input,
Output,
InputSchema extends StandardSchemaV1 = StandardSchemaV1,
OutputSchema extends StandardSchemaV1 = StandardSchemaV1,
Tools extends readonly ToolRefAny[] = readonly ToolRefAny[],
>
extends DescriptorBase<"agent", Id>, AgentRef<Id, InputSchema, OutputSchema> {
readonly model?: string;
readonly instructions: AgentInstructions;
readonly tools: AgentToolReferences<Tools>;
readonly middleware: readonly [];
readonly limits: AgentLimits;
readonly stateProfile?: string;
readonly client?: AgentClientPolicy<NonNullable<AgentClientPolicy["authorize"]>, never>;
readonly chat?: AgentChatMapping;
readonly controls?: readonly AgentControl[];
readonly clientContract: AgentClientContractMetadata;
}
AgentInstructions (type alias)
Signature
type AgentInstructions = string | PromptTemplate | PromptInstructions;
AgentLimits (interface)
Limits retained by the selected execution integration.
Signature
export interface AgentLimits {
readonly maxSteps: number;
readonly maxToolCalls: number;
readonly timeoutMs: number;
}
AgentToolReferences (type alias)
Handler-free tool identities retaining each authored literal reference.
Signature
type AgentToolReferences<Tools extends readonly ToolRefAny[]> = {
readonly [Index in keyof Tools]: Pick<Tools[Index], "ref">;
};
DefineAgentOptions (interface)
Generic agent inputs; native capabilities use the explicit integration facade.
Signature
export interface DefineAgentOptions<
Id extends string,
InputSchema extends StandardSchemaV1,
OutputSchema extends StandardSchemaV1,
Tools extends readonly ToolRefAny[],
> extends DescriptorMetadata {
readonly id?: Id;
readonly input: InputSchema;
readonly output: OutputSchema;
readonly model?: string;
readonly instructions: AgentInstructions;
readonly tools: Tools;
readonly middleware?: readonly [];
readonly limits: AgentLimits;
readonly stateProfile?: string;
readonly client?: AgentClientPolicy<NonNullable<AgentClientPolicy["authorize"]>, never>;
readonly chat?: AgentChatMapping;
readonly controls?: readonly AgentControl[];
}
PromptInstructions (interface)
Signature
export interface PromptInstructions {
readonly kind: "prompt";
readonly id: string;
readonly ref: { readonly kind: "prompt"; readonly id: string };
readonly value: string | readonly string[];
}
PromptTemplate (interface)
Signature
export interface PromptTemplate {
readonly template: string;
readonly variables?: readonly string[];
}
generated-function-error.ts
GeneratedAgentFunctionFailure (class)
Tagged invalid generated function identity or executor.
Signature
declare class GeneratedAgentFunctionFailure
generatedAgentFunctionFailure
Preserves an invalid generated function error for Effect callers.
Example
generatedAgentFunctionFailure(new TypeError("invalid"));
Signature
declare const generatedAgentFunctionFailure: (cause: unknown) => GeneratedAgentFunctionFailure;
generated-function.ts
“./generated-function.types.js” (namespace export)
Re-exports all named exports from the “./generated-function.types.js” module.
Signature
export * from "./generated-function.types.js";
GENERATED_AGENT_FUNCTION_PREFIX
Signature
declare const GENERATED_AGENT_FUNCTION_PREFIX: "relkit.agent.";
GENERATED_AGENT_FUNCTION_SUFFIX
Signature
declare const GENERATED_AGENT_FUNCTION_SUFFIX: ".invoke";
GeneratedAgentFunctionUnboundError (class)
Raised when a generated identity is registered before the agent runtime binds an executor.
Signature
declare class GeneratedAgentFunctionUnboundError {
constructor(functionId: string);
}
code (property)
Signature
readonly code: "RELKIT_GENERATED_FUNCTION_UNBOUND"
createGeneratedAgentFunction
Creates a marked handler for existing synchronous callers.
Throws
The original invalid identity or executor error.
Example
createGeneratedAgentFunction("support", executor);
Signature
declare const createGeneratedAgentFunction: (
agentId: unknown,
executor?: GeneratedAgentExecutor,
) => GeneratedAgentFunction;
createGeneratedAgentFunctionEffect
Creates a marked function handler for a compiler-generated agent identity.
Example
Effect.runSync(createGeneratedAgentFunctionEffect("support", executor));
Signature
declare const createGeneratedAgentFunctionEffect: (
agentId: unknown,
executor?: GeneratedAgentExecutor | undefined,
) => Effect.Effect<GeneratedAgentFunction, GeneratedAgentFunctionFailure, never>;
generatedAgentFunctionId
Derives the generated function ID for existing synchronous callers.
Throws
The original invalid identity error.
Example
generatedAgentFunctionId("support");
Signature
declare const generatedAgentFunctionId: (agentId: unknown) => string;
generatedAgentFunctionIdEffect
Derives the stable generated function ID without using the source path.
Example
Effect.runSync(generatedAgentFunctionIdEffect("support"));
Signature
declare const generatedAgentFunctionIdEffect: (
agentId: unknown,
) => Effect.Effect<string, GeneratedAgentFunctionFailure, never>;
isGeneratedAgentFunction
Checks a generated marker for existing synchronous callers.
Example
if (isGeneratedAgentFunction(candidate)) use(candidate);
Signature
declare const isGeneratedAgentFunction: (value: unknown) => value is GeneratedAgentFunction;
isGeneratedAgentFunctionEffect
Checks whether a callable has a valid generated agent marker.
Example
Effect.runSync(isGeneratedAgentFunctionEffect(candidate));
Signature
declare const isGeneratedAgentFunctionEffect: (
value: unknown,
) => Effect.Effect<boolean, never, never>;
generated-function.types.ts
GeneratedAgentExecutor (type alias)
Optional executor bound when the generated function is registered.
Signature
type GeneratedAgentExecutor = (input: unknown, context: unknown) => MaybePromise<unknown>;
GeneratedAgentFunction (type alias)
Callable handler with a compiler-visible agent identity marker.
Signature
type GeneratedAgentFunction = ((...arguments_: readonly unknown[]) => MaybePromise<unknown>) &
GeneratedAgentFunctionMarker;
GeneratedAgentFunctionMarker (interface)
Serializable identity attached to an agent-generated function.
Signature
export interface GeneratedAgentFunctionMarker {
readonly generated: true;
readonly generatedBy: "agent";
readonly agentId: string;
readonly functionId: string;
}
index.ts
Exposes generic agent authoring, client events and state contracts. Native models, graphs, middleware and execution are selected through @relkit/langchain.
“./agent-client.js” (namespace export)
Re-exports all named exports from the “./agent-client.js” module.
Signature
export * from "./agent-client.js";
“./agent-telemetry.js” (namespace export)
Re-exports all named exports from the “./agent-telemetry.js” module.
Signature
export * from "./agent-telemetry.js";
“./approval.js” (namespace export)
Re-exports all named exports from the “./approval.js” module.
Signature
export * from "./approval.js";
“./client-events.js” (namespace export)
Re-exports all named exports from the “./client-events.js” module.
Signature
export * from "./client-events.js";
“./define-agent.js” (namespace export)
Re-exports all named exports from the “./define-agent.js” module.
Signature
export * from "./define-agent.js";
“./generated-function.js” (namespace export)
Re-exports all named exports from the “./generated-function.js” module.
Signature
export * from "./generated-function.js";
“./model-selection.js” (namespace export)
Re-exports all named exports from the “./model-selection.js” module.
Signature
export * from "./model-selection.js";
“./observability.js” (namespace export)
Re-exports all named exports from the “./observability.js” module.
Signature
export * from "./observability.js";
“./runtime-contract.types.js” (namespace export)
Re-exports all named exports from the “./runtime-contract.types.js” module.
Signature
export * from "./runtime-contract.types.js";
“./runtime-events.js” (namespace export)
Re-exports all named exports from the “./runtime-events.js” module.
Signature
export * from "./runtime-events.js";
“./state-control-requests.types.js” (namespace export)
Re-exports all named exports from the “./state-control-requests.types.js” module.
Signature
export * from "./state-control-requests.types.js";
“./state-provider.types.js” (namespace export)
Re-exports all named exports from the “./state-provider.types.js” module.
Signature
export * from "./state-provider.types.js";
“./state-receipts.types.js” (namespace export)
Re-exports all named exports from the “./state-receipts.types.js” module.
Signature
export * from "./state-receipts.types.js";
“./state-thread-requests.types.js” (namespace export)
Re-exports all named exports from the “./state-thread-requests.types.js” module.
Signature
export * from "./state-thread-requests.types.js";
“./state.types.js” (namespace export)
Re-exports all named exports from the “./state.types.js” module.
Signature
export * from "./state.types.js";
“./thread-transition.js” (namespace export)
Re-exports all named exports from the “./thread-transition.js” module.
Signature
export * from "./thread-transition.js";
model-selection-core.ts
normalizeModelSelectorValue
Canonicalizes a selector after validating its syntax.
Throws
ModelSelectionError for malformed selectors.
Example
normalizeModelSelectorValue("openai:gpt");
Signature
declare const normalizeModelSelectorValue: (value: unknown) => string | undefined;
parseModelProviderConfigurationValue
Validates and freezes provider defaults.
Throws
ModelSelectionError for missing or malformed settings.
Example
parseModelProviderConfigurationValue(config);
Signature
declare const parseModelProviderConfigurationValue: (value: unknown) => ModelProviderConfiguration;
resolveModelSelectorValue
Selects a provider and model from validated configuration.
Throws
ModelSelectionError when a provider or model is unavailable.
Example
resolveModelSelectorValue("openai", config);
Signature
declare const resolveModelSelectorValue: (
selector: unknown,
configuration: ModelProviderConfiguration,
) => ResolvedModelSelection;
model-selection-error.ts
ModelSelectionEffectError (class)
Recoverable Effect failure for invalid model selection.
Signature
declare class ModelSelectionEffectError
ModelSelectionError (class)
Compatible synchronous error for invalid model selection.
Example
throw new ModelSelectionError("RELKIT_MODEL_SELECTOR_INVALID", "Invalid selector");
Signature
declare class ModelSelectionError { constructor(
readonly code: ModelSelectionErrorCode,
message: string,
) }
name (property)
Signature
readonly name: "ModelSelectionError"
modelSelectionEffectError
Captures a selector error for Effect recovery and public compatibility.
Example
modelSelectionEffectError(new ModelSelectionError("RELKIT_MODEL_SELECTOR_INVALID", "Invalid"));
Signature
declare const modelSelectionEffectError: (cause: unknown) => ModelSelectionEffectError;
model-selection.ts
“./model-selection.types.js” (namespace export)
Re-exports all named exports from the “./model-selection.types.js” module.
Signature
export * from "./model-selection.types.js";
ModelSelectionEffectError
Signature
declare const ModelSelectionEffectError: typeof ModelSelectionEffectError;
ModelSelectionError
Signature
declare const ModelSelectionError: typeof ModelSelectionError;
normalizeModelSelector
Normalizes an optional provider or provider:model selector.
Throws
ModelSelectionError for an invalid selector.
Example
normalizeModelSelector("openai:gpt");
Signature
declare const normalizeModelSelector: (value: unknown) => string | undefined;
normalizeModelSelectorEffect
Normalizes an optional provider or provider:model selector.
Example
Effect.runSync(normalizeModelSelectorEffect("openai:gpt"));
Signature
declare const normalizeModelSelectorEffect: (
value: unknown,
) => Effect.Effect<string | undefined, ModelSelectionEffectError, never>;
parseModelProviderConfiguration
Parses and validates configured model providers.
Throws
ModelSelectionError for missing or invalid settings.
Example
parseModelProviderConfiguration(config);
Signature
declare const parseModelProviderConfiguration: (value: unknown) => ModelProviderConfiguration;
parseModelProviderConfigurationEffect
Parses and validates configured model providers.
Example
Effect.runSync(parseModelProviderConfigurationEffect(config));
Signature
declare const parseModelProviderConfigurationEffect: (
value: unknown,
) => Effect.Effect<ModelProviderConfiguration, ModelSelectionEffectError, never>;
resolveModelSelector
Resolves a selector against provider defaults.
Throws
ModelSelectionError for missing providers or defaults.
Example
resolveModelSelector("openai", config);
Signature
declare const resolveModelSelector: (
selector: unknown,
configuration: ModelProviderConfiguration,
) => ResolvedModelSelection;
resolveModelSelectorEffect
Resolves a selector against provider defaults.
Example
Effect.runSync(resolveModelSelectorEffect("openai", config));
Signature
declare const resolveModelSelectorEffect: (
selector: unknown,
configuration: ModelProviderConfiguration,
) => Effect.Effect<ResolvedModelSelection, ModelSelectionEffectError, never>;
model-selection.types.ts
Stable error codes for model selector and provider configuration failures.
ModelProviderConfiguration (interface)
Normalized provider defaults used to resolve a model selector.
Signature
export interface ModelProviderConfiguration {
readonly defaultProvider: string;
readonly defaultModel: string;
readonly providers: Readonly<Record<string, { readonly defaultModel?: string }>>;
}
ModelSelectionErrorCode (type alias)
Stable error codes for model selector and provider configuration failures.
Signature
type ModelSelectionErrorCode =
| "RELKIT_MODEL_PROVIDER_CONFIGURATION_INVALID"
| "RELKIT_MODEL_SELECTOR_INVALID"
| "RELKIT_MODEL_PROVIDER_UNKNOWN"
| "RELKIT_MODEL_PROVIDER_DEFAULT_MISSING";
ResolvedModelSelection (interface)
Selected provider, model, and combined stable identifier.
Signature
export interface ResolvedModelSelection {
readonly provider: string;
readonly model: string;
readonly id: string;
}
observability.ts
“./observability.types.js” (namespace export)
Re-exports all named exports from the “./observability.types.js” module.
Signature
export * from "./observability.types.js";
AGENT_OBSERVABILITY_PROTOCOL
Signature
declare const AGENT_OBSERVABILITY_PROTOCOL: "relkit.observability.hooks";
AGENT_OBSERVABILITY_VERSION
Signature
declare const AGENT_OBSERVABILITY_VERSION: 1;
AgentCapturePolicy
Signature
declare const AgentCapturePolicy: AgentCapturePolicy;
AgentCapturePolicyError
Signature
declare const AgentCapturePolicyError: typeof AgentCapturePolicyError;
AgentCaptureRecord
Signature
declare const AgentCaptureRecord: AgentCaptureRecord;
AgentSpanCapture
Signature
declare const AgentSpanCapture: AgentSpanCapture;
captureAgentContent
Signature
declare const captureAgentContent: (
value: unknown,
policy: AgentCapturePolicy,
) => AgentCaptureRecord | undefined;
captureAgentContentEffect
Signature
declare const captureAgentContentEffect: (
value: unknown,
policy: AgentCapturePolicy,
) => Effect.Effect<AgentCaptureRecord | undefined, never, never>;
createAgentCapturePolicy
Signature
declare const createAgentCapturePolicy: (
value: AgentCapturePolicy | undefined,
) => AgentCapturePolicy;
createAgentCapturePolicyEffect
Signature
declare const createAgentCapturePolicyEffect: (
value: AgentCapturePolicy | undefined,
) => Effect.Effect<AgentCapturePolicy, AgentCapturePolicyError, never>;
createAgentSpanCapture
Signature
declare const createAgentSpanCapture: (
input: AgentCaptureRecord | undefined,
output: AgentCaptureRecord | undefined,
) => AgentSpanCapture | undefined;
createAgentSpanCaptureEffect
Signature
declare const createAgentSpanCaptureEffect: (
input: AgentCaptureRecord | undefined,
output: AgentCaptureRecord | undefined,
) => Effect.Effect<
Readonly<{ output?: AgentCaptureRecord; input?: AgentCaptureRecord }> | undefined,
never,
never
>;
emitAgentEdge
Emits an observed relationship for existing synchronous tracing callers.
Example
emitAgentEdge(hooks, { relationship: "uses-tool", from: "agent", to: "tool" });
Signature
declare const emitAgentEdge: (
hooks: AgentRuntimeHooks | undefined,
edge: AgentObservedEdge,
) => void;
emitAgentEdgeEffect
Best-effort emission of an observed relationship. The sink is intentionally detached because the caller’s synchronous tracing path cannot await it.
Example
Effect.runSync(emitAgentEdgeEffect(hooks, edge));
Signature
declare const emitAgentEdgeEffect: (
hooks: AgentRuntimeHooks | undefined,
edge: AgentObservedEdge,
) => Effect.Effect<void, never, never>;
observability.types.ts
AgentEdgeRelationship (type alias)
Relationships reported by an agent’s runtime hooks.
Example
const relationship: AgentEdgeRelationship = "uses-tool";
Signature
type AgentEdgeRelationship =
| "targets-function"
| "calls-function"
| "enqueues-job"
| "publishes-event"
| "listens-to-event"
| "uses-bucket"
| "uses-cache"
| "invokes-agent"
| "exposes-as-tool"
| "uses-tool"
| "uses-provider-profile";
AgentObservabilitySink (interface)
Optional external sink for observed agent relationships.
Example
const sink: AgentObservabilitySink = { emit: (event) => send(event) };
Signature
export interface AgentObservabilitySink {
/** Accepts a public relationship event.
* @param event - Versioned observed edge.
* @returns Completion of best-effort sink delivery.
* @example sink.emit({ protocol: "relkit.observability.hooks", version: 1, type: "edge.observed", edge });
*/
readonly emit: (event: {
readonly protocol: typeof AGENT_OBSERVABILITY_PROTOCOL;
readonly version: typeof AGENT_OBSERVABILITY_VERSION;
readonly type: "edge.observed";
readonly edge: AgentObservedEdge;
}) => MaybePromise<void>;
}
AgentObservedEdge (interface)
Directed relationship between two stable descriptors.
Example
const edge: AgentObservedEdge = { relationship: "uses-tool", from: "agent", to: "tool" };
Signature
export interface AgentObservedEdge {
readonly relationship: AgentEdgeRelationship;
readonly from: string;
readonly to: string;
}
AgentRuntimeHooks (interface)
Optional synchronous and asynchronous relationship observers.
Example
const hooks: AgentRuntimeHooks = { onObservedEdge: console.log };
Signature
export interface AgentRuntimeHooks {
/** Receives one immutable edge synchronously.
* @param edge - Observed relationship.
* @returns Nothing.
* @example hooks.onObservedEdge?.(edge);
*/
readonly onObservedEdge?: (edge: AgentObservedEdge) => void;
readonly observability?: AgentObservabilitySink;
}
runtime-contract.types.ts
Carries SDK-independent conversation, approval and content callbacks between native execution and transports; callbacks retain the caller’s signal ownership.
AgentApprovalHandler (type alias)
Resolves a pending tool approval for an invocation.
Signature
type AgentApprovalHandler = (
approval: import("./approval.js").PendingApproval,
) => MaybePromise<ApprovalDecision>;
AgentContentSink (interface)
Sends agent output and events to the surrounding runtime.
Signature
export interface AgentContentSink {
readonly emitOutput: (value: unknown, signal: AbortSignal) => MaybePromise<void>;
readonly finishOutput?: (signal: AbortSignal) => MaybePromise<void>;
readonly progressSinkForTool?: (tool: {
readonly toolCallId: string;
readonly toolId: string;
}) => import("@relkit/invocation").ProgressSink;
readonly emitTool?: (
value: {
readonly toolCallId: string;
readonly toolId: string;
readonly state: import("./state.types.js").ToolPartState;
readonly value?: unknown;
},
signal: AbortSignal,
) => MaybePromise<void>;
readonly emitEvent?: (
value: import("./runtime-events.js").AgentExecutionEvent,
signal: AbortSignal,
) => MaybePromise<void>;
readonly emitMessage?: (
value: import("@relkit/contracts").BrowserMessage,
signal: AbortSignal,
) => MaybePromise<void>;
readonly emitWaiting?: (
value: Omit<import("./state.types.js").AgentWaitingState, "revision" | "runId">,
signal: AbortSignal,
) => MaybePromise<void>;
}
AgentConversationMessage (interface)
One user or assistant message in a native agent conversation.
Signature
export interface AgentConversationMessage {
readonly role: "user" | "assistant";
readonly content: string;
}
AgentSteeringSource (interface)
Supplies queued steering messages to a running agent.
Signature
export interface AgentSteeringSource {
readonly drain: () => MaybePromise<readonly string[]>;
}
runtime-events.ts
AgentExecutionEvent
Signature
declare const AgentExecutionEvent: AgentExecutionEvent;
AgentExecutionSnapshot
Signature
declare const AgentExecutionSnapshot: AgentExecutionSnapshot;
state-control-requests.types.ts
Shared state contracts live below execution and provider implementations.
AcceptControlRequest
Signature
declare const AcceptControlRequest: AcceptControlRequest;
AdmitContinuationRequest
Signature
declare const AdmitContinuationRequest: AdmitContinuationRequest;
ClaimControlRequest
Signature
declare const ClaimControlRequest: ClaimControlRequest;
ContinuationIdentity
Signature
declare const ContinuationIdentity: ContinuationIdentity;
ControlLimits
Signature
declare const ControlLimits: ControlLimits;
ControlPage
Signature
declare const ControlPage: ControlPage;
LookupContinuationReceiptRequest
Signature
declare const LookupContinuationReceiptRequest: LookupContinuationReceiptRequest;
LookupControlReceiptRequest
Signature
declare const LookupControlReceiptRequest: LookupControlReceiptRequest;
MarkControlEffectStartedRequest
Signature
declare const MarkControlEffectStartedRequest: MarkControlEffectStartedRequest;
ReadControlsRequest
Signature
declare const ReadControlsRequest: ReadControlsRequest;
RecoverAbandonedControlRequest
Signature
declare const RecoverAbandonedControlRequest: RecoverAbandonedControlRequest;
RenewControlClaimRequest
Signature
declare const RenewControlClaimRequest: RenewControlClaimRequest;
SettleControlRequest
Signature
declare const SettleControlRequest: SettleControlRequest;
WaitForControlsRequest
Signature
declare const WaitForControlsRequest: WaitForControlsRequest;
state-provider.types.ts
Shared state contracts live below execution and provider implementations.
AgentStateProvider
Signature
declare const AgentStateProvider: AgentStateProvider;
state-receipts.types.ts
Shared state contracts live below execution and provider implementations.
AcceptRunReceipt
Signature
declare const AcceptRunReceipt: AcceptRunReceipt;
CompletionReceipt
Signature
declare const CompletionReceipt: CompletionReceipt;
ContinuationReceipt
Signature
declare const ContinuationReceipt: ContinuationReceipt;
ContinuationReceiptLookup
Signature
declare const ContinuationReceiptLookup: ContinuationReceiptLookup;
ControlReceipt
Signature
declare const ControlReceipt: ControlReceipt;
ControlReceiptLookup
Signature
declare const ControlReceiptLookup: ControlReceiptLookup;
CreateThreadReceipt
Signature
declare const CreateThreadReceipt: CreateThreadReceipt;
InterruptionReceipt
Signature
declare const InterruptionReceipt: InterruptionReceipt;
JournalReceipt
Signature
declare const JournalReceipt: JournalReceipt;
RunReceiptLookup
Signature
declare const RunReceiptLookup: RunReceiptLookup;
SuspensionReceipt
Signature
declare const SuspensionReceipt: SuspensionReceipt;
state-thread-requests.types.ts
Shared state contracts live below execution and provider implementations.
AcceptRunRequest
Signature
declare const AcceptRunRequest: AcceptRunRequest;
AgentStateLimits
Signature
declare const AgentStateLimits: AgentStateLimits;
AppendJournalRequest
Signature
declare const AppendJournalRequest: AppendJournalRequest;
ClaimRunRequest
Signature
declare const ClaimRunRequest: ClaimRunRequest;
CompleteRunRequest
Signature
declare const CompleteRunRequest: CompleteRunRequest;
CreateThreadRequest
Signature
declare const CreateThreadRequest: CreateThreadRequest;
InterruptOwnedRunRequest
Signature
declare const InterruptOwnedRunRequest: InterruptOwnedRunRequest;
JournalPage
Signature
declare const JournalPage: JournalPage;
ListThreadsRequest
Signature
declare const ListThreadsRequest: ListThreadsRequest;
LoadThreadRequest
Signature
declare const LoadThreadRequest: LoadThreadRequest;
LookupRunReceiptRequest
Signature
declare const LookupRunReceiptRequest: LookupRunReceiptRequest;
ReadJournalRequest
Signature
declare const ReadJournalRequest: ReadJournalRequest;
ReadSnapshotHistoryRequest
Signature
declare const ReadSnapshotHistoryRequest: ReadSnapshotHistoryRequest;
RenewRunClaimRequest
Signature
declare const RenewRunClaimRequest: RenewRunClaimRequest;
SnapshotHistoryPage
Signature
declare const SnapshotHistoryPage: SnapshotHistoryPage;
SuspendRunRequest
Signature
declare const SuspendRunRequest: SuspendRunRequest;
ThreadList
Signature
declare const ThreadList: ThreadList;
WaitForJournalRequest
Signature
declare const WaitForJournalRequest: WaitForJournalRequest;
state.types.ts
AgentObservation
Signature
declare const AgentObservation: AgentObservation;
AgentProgressScope
Signature
declare const AgentProgressScope: AgentProgressScope;
AgentRequestScope
Signature
declare const AgentRequestScope: AgentRequestScope;
AgentWaitingRequest
Signature
declare const AgentWaitingRequest: AgentWaitingRequest;
AgentWaitingState
Signature
declare const AgentWaitingState: AgentWaitingState;
BrowserMessage
Signature
declare const BrowserMessage: BrowserMessage;
BrowserMessagePart
Signature
declare const BrowserMessagePart: BrowserMessagePart;
ControlClaim
Signature
declare const ControlClaim: ControlClaim;
ControlEffectOutcome
Signature
declare const ControlEffectOutcome: ControlEffectOutcome;
ControlRecord
Signature
declare const ControlRecord: ControlRecord;
ControlStatus
Signature
declare const ControlStatus: ControlStatus;
ExecutionClaim
Signature
declare const ExecutionClaim: ExecutionClaim;
JournalCheckpoint
Signature
declare const JournalCheckpoint: JournalCheckpoint;
JournalRecord
Signature
declare const JournalRecord: JournalRecord;
RunOwner
Signature
declare const RunOwner: RunOwner;
RunStatus
Signature
declare const RunStatus: RunStatus;
StoredApproval
Signature
declare const StoredApproval: StoredApproval;
StoredRun
Signature
declare const StoredRun: StoredRun;
StoredRunRouting
Signature
declare const StoredRunRouting: StoredRunRouting;
StoredThread
Signature
declare const StoredThread: StoredThread;
ThreadListItem
Signature
declare const ThreadListItem: ThreadListItem;
ThreadSnapshot
Signature
declare const ThreadSnapshot: ThreadSnapshot;
ThreadStatus
Signature
declare const ThreadStatus: ThreadStatus;
ToolPartState
Signature
declare const ToolPartState: ToolPartState;
thread-transition.ts
Exposes the shared durable thread transition table through the existing agent telemetry boundary; provider implementations call the lower contracts owner.
AgentTransitionError
Signature
declare const AgentTransitionError: AgentTransitionError;
ThreadAction
Signature
declare const ThreadAction: ThreadAction;
ThreadTransition
Signature
declare const ThreadTransition: ThreadTransition;
decideThreadTransition
Decides a thread action for synchronous framework callers.
Signature
declare const decideThreadTransition: (
status: ThreadStatus,
action: ThreadAction,
) => ThreadTransition;
decideThreadTransitionEffect
Observes a shared thread decision without duplicating its state machine.
Signature
declare const decideThreadTransitionEffect: (
status: ThreadStatus,
action: ThreadAction,
) => Effect.Effect<ThreadTransition, never, never>;
thread-transition.types.ts
Shared state contracts live below execution and provider implementations.
AgentTransitionError
Signature
declare const AgentTransitionError: AgentTransitionError;
ThreadAction
Signature
declare const ThreadAction: ThreadAction;
ThreadTransition
Signature
declare const ThreadTransition: ThreadTransition;