Skip to main content

new SovaraClient(options)

Creates a project-bound client. Project identity and connection configuration belong to the client, not to individual runs.

sovara_client.run(name, fn, options?)

Creates and finalizes a top-level run around a synchronous or asynchronous callback.
Returns Promise<T> for the callback result and rethrows callback errors after finalization. For a remote agent host, keep the token in its secret manager or an excluded .env file and configure the client once. A custom fetch is optional:

sovara_client.subrun(name, fn, options?)

Creates a child run under the active run. The optional lessonScope replaces the inherited lesson scope for that child.
Returns Promise<T> for the callback result and throws when no run is active.

trace(fn, options?)

Wraps a synchronous or asynchronous function as a step, recording arguments, return values, latency, status, and exceptions.
name defaults to the function or method name. meta adds step metadata. Stage 3 method-decorator use is also supported when the TypeScript compiler is configured for decorators.

sovara_client.lessonScope(scope, fn)

Temporarily replaces the active lesson scope. Paths include descendants; null or a root marker selects all lessons, and [] disables retrieval.

sovara_client.injectLessons(context)

Retrieves a prompt-ready lesson block for the active run. Returns Promise<string> and resolves to "" outside a run or when nothing matches.

sovara_client.logInput(value)

Stores the latest user-visible input on the active run. This value appears in the Input column of the Runs table and replaces the previously logged input. Objects and arrays are serialized as JSON.
Returns Promise<void>. Outside an active run, it warns once and does nothing.

sovara_client.logOutput(value)

Stores the latest user-visible output on the active run. This value appears in the Output column of the Runs table and replaces the previously logged output. Objects and arrays are serialized as JSON.
Returns Promise<void>. Outside an active run, it warns once and does nothing.

sovara_client.logMetrics(metrics)

Adds filterable custom metrics to the active run. Values must be booleans or finite numbers; keys must be lower snake case and at most 32 characters.
Returns Promise<void>. Logging the same key again updates its latest value. Outside an active run, it warns once and does nothing.

sovara_client.getRunId()

Returns the current run or subrun ID as a string, or undefined when called outside an active run.