Skip to content

Contract reference

Agent manifest

The exported TypeScript type is AgentManifest; validate external input with agentManifestSchema or parseAgentManifest.

FieldTypeNotes
schemaVersion"1.0"required
id, name, descriptionstringoptional identity and documentation
modelexplicit reference or profiledefault for prompt steps
variablesvariable declaration arraytyped inputs, defaults, requirements, documentation
connectionsarrayhost connection bindings
stepsarrayordered execution plan
limitsobjectstep, output, tool-call, and provider bounds
metadataJSON objectinert application metadata
extensionsJSON objectnamespaced host extensions

Use metadata for descriptive application data that does not change execution. Use namespaced extensions for behavior interpreted by an application adapter. The agentRuntime namespace is reserved for runtime behavior. For example, extensions.agentRuntime.stateProjection: "step-output-state-v1" projects each step output into step-N, step-previous, and outputVariable state keys. A step can override step-N with extensions.agentRuntime.stateKey. This projection is sequential because step-previous is order-dependent.

Variable keys and outputVariable values are non-empty top-level names. They cannot contain dots or use __proto__, prototype, or constructor. Dot notation is reserved for reading properties from object values.

Final output selection is declared with includeInFinalOutput on top-level steps.

Agent variable declaration

Each entry in the agent manifest's variables array has this shape:

FieldTypeNotes
keystringexact top-level run input name
typestring, number, boolean, object, array, or jsonrequired; json accepts an object or array
valueJSON valueoptional agent-level default
requiresOverridebooleanwhen true, every new run must supply this key
descriptionstringoptional developer-facing documentation
metadataJSON objectoptional application metadata

The default value must match the declared type.

Agent run manifest

The exported TypeScript type is AgentRunManifest; validate external input with agentRunManifestSchema or parseAgentRunManifest.

An agent run references an agent and supplies runtime values:

yaml
schemaVersion: "1.0"
agent:
  ref: release-brief.agent.yaml
variables:
  - key: audience
    value: partners
execution:
  mode: parallel
  maxConcurrency: 4
FieldTypeNotes
schemaVersion"1.0"required
agent.refstringrequired host-resolved agent reference
runIdstringoptional caller-provided run identity
variablesvariable override arrayoptional runtime values
execution.modesequential or paralleloptional; defaults to sequential
execution.maxConcurrencyinteger from 1 to 64optional requested limit; the host may impose a cap

The TypeScript shape is:

ts
{
  schemaVersion: '1.0',
  agent: { ref: 'release-brief.agent.yaml' },
  execution: { mode: 'parallel', maxConcurrency: 4 },
  variables: [
    { key: 'audience', value: 'partners' },
    { key: 'style', value: { tone: 'direct', maxWords: 120 } },
  ],
}

Each override contains only key and value. Keys must match declarations exactly. Object overrides replace the complete declared object; values are not deep-merged. Resume requests restore checkpointed state and do not accept new overrides.

Model reference

ts
{ provider: string, model: string, options?: JsonObject }

or:

ts
{ ref: string, options?: JsonObject }

Runtime configuration

ts
{
  version: "1.0";
  providers: Record<string, ProviderDefinition>;
  models: Record<string, ConfiguredModelDefinition>;
  connections: Record<string, McpConnectionDefinition>;
}

Provider drivers: openai, anthropic, google, xai, groq, cohere, and openai-compatible.

MCP connection authentication:

auth.typeConfiguration
noneno additional fields
bearertoken environment reference
oauthoptional profile; requires ConnectionCredentialProvider
client_credentialsclientId, clientSecret, and optional scopes

bearerToken remains accepted as a deprecated alias for bearer authentication. A connection cannot combine auth with bearerToken or an Authorization entry in headers.

Adapter interfaces

Adapter interfaceResponsibility
AgentManifestSourceload an agent manifest by opaque reference
RunStoredurable lifecycle, checkpoints, and fencing
ModelAdaptergeneration and optional streaming
ToolAdapterlist and execute host-authorized tools
ConnectionCredentialProvidersupply and invalidate host-managed connection auth
EventSinkobserve ordered run events
ArtifactStoreput/get artifact bytes by reference
ApprovalAdapterresolve a human approval request
SandboxAdapterexecute a code step
SubRunAdapterinvoke an isolated child agent manifest
ConditionEvaluatorevaluate when, loop conditions, and goals

Execution interface

Local and remote compute adapters implement:

ts
interface ExecutionEngine {
  submit(request): Promise<ExecutionHandle>;
  resume(request): Promise<ExecutionHandle>;
  status(handle): Promise<ExecutionStatus>;
  events(handle, { after, signal }): AsyncIterable<RunEvent>;
  result(handle, { signal }): Promise<RunResult>;
  cancel(handle): Promise<void>;
}

ExecutionClient.follow() reconnects event streams using the last (attempt, sequence) cursor. wait() drains the stream until the execution reaches a terminal status.

Remote execution divides the implementation between RemoteExecutionControlPlane, which owns lifecycle state, and RemoteComputeLauncher, which starts and cancels compute.

Package map

PackagePurpose
@clearideas/agent-runtime-contractsmanifest schemas and TypeScript types
@clearideas/agent-runtime-corestep scheduling, state, checkpoints, recovery
@clearideas/agent-runtime-configproviders, model profiles, MCP composition
@clearideas/agent-runtime-model-ai-sdkAI SDK model adapter
@clearideas/agent-runtime-condition-jexlstandard condition evaluator
@clearideas/agent-runtime-step-promptprompt, streaming, and ordered tool calls
@clearideas/agent-runtime-step-loopcollection and goal loops
@clearideas/agent-runtime-step-standardwebhook, approval, code, and sub-run steps
@clearideas/agent-runtime-store-localmemory/file stores, JSONL, local artifacts
@clearideas/agent-runtime-store-sqlitetransactional local store
@clearideas/agent-runtime-executionengine lifecycle and worker protocol
@clearideas/agent-runtime-execution-modalModal compute adapter
@clearideas/agent-runtime-sandboxsandbox provider interface and Docker provider
@clearideas/agent-runtime-sandbox-modalModal sandbox provider
@clearideas/agent-runtime-artifactssandboxed artifact generation
@clearideas/agent-runtime-telemetry-otelOpenTelemetry event sink
@clearideas/agent-runtime-cliCLI host and worker command