IndeRun
The advanced task API. IndeRun implements IndeRunApi; constructing one by
hand takes a ProviderRegistry and HostServices from
@independo/inderun-web/provider.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new IndeRun(
registry,hostServices,options?):IndeRun
Initializes the IndeRun instance.
Parameters
Section titled “Parameters”registry
Section titled “registry”ProviderRegistry
Registry filled with active providers.
hostServices
Section titled “hostServices”HostServices
Services wrapping OS interfaces and indicators.
options?
Section titled “options?”Optional telemetry listener and model profiles.
Returns
Section titled “Returns”IndeRun
Throws
Section titled “Throws”If a model profile is malformed (see validateModelProfiles).
Methods
Section titled “Methods”checkCapabilities()
Section titled “checkCapabilities()”checkCapabilities():
Promise<ProviderCapabilitySnapshot[]>
Returns a live snapshot of every registered provider’s static descriptor and current dynamic availability, without executing a task or producing any side effects. Call this before run() when you need to show which providers/models are currently available — for example a settings screen or provider picker. Availability can change between calls (a local model can unload, cloud credentials can expire), so don’t cache the result across a run() call.
Returns
Section titled “Returns”Promise<ProviderCapabilitySnapshot[]>
Implementation of
Section titled “Implementation of”close()
Section titled “close()”close():
Promise<void>
Closes the engine. In order: refuses new work, cancels in-flight streams and prepares,
waits for them and for in-flight run() calls (Mode 1 has no cancel path, so those are
awaited, not cancelled), disposes the engine’s artifacts, and closes the resources the
engine’s creator handed over. Idempotent: later and concurrent calls await the first.
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”disposeArtifact()
Section titled “disposeArtifact()”disposeArtifact(
artifact):Promise<void>
Releases the bytes of an engine-owned media artifact. Idempotent: disposing an artifact twice, or one the engine does not hold, does nothing. After disposal readArtifact reports ‘artifact_not_found’. An artifact outlives the run that produced it, so an application that keeps none should dispose each one it receives.
Parameters
Section titled “Parameters”artifact
Section titled “artifact”Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”prepare()
Section titled “prepare()”prepare(
request?):Promise<StreamRun>
Makes registered providers ready ahead of a run (ADR 019). Optional: without it, the first run of a task does the part that does not need the application’s say. Repeating it is cheap, because what is ready is skipped. Providers go one at a time, and one failing does not stop the rest: the terminal outcome lists each item.
Parameters
Section titled “Parameters”request?
Section titled “request?”Optional scope. An empty one covers every provider and task.
Returns
Section titled “Returns”Promise<StreamRun>
Throws
Section titled “Throws”If validation fails.
Implementation of
Section titled “Implementation of”readArtifact()
Section titled “readArtifact()”readArtifact(
request):Promise<ArtifactChunk>
Reports each registered provider’s static descriptor and current dynamic capability check, without executing a task. Useful for UI that shows live provider availability before a run.
Parameters
Section titled “Parameters”request
Section titled “request”Returns
Section titled “Returns”Promise<ArtifactChunk>
Implementation of
Section titled “Implementation of”run(
request):Promise<TaskResult>
Orchestrates the execution of a TaskRequest. Performs JSON Schema validation, selects a provider via routing rules, measures total execution time, and attaches telemetry metadata to the outcome.
Parameters
Section titled “Parameters”request
Section titled “request”The canonical task request containing prompts, tasks, and constraints.
Returns
Section titled “Returns”Promise<TaskResult>
Canonical task output containing output details and telemetry metadata.
Throws
Section titled “Throws”Standardized error indicating validation, connection, or provider failures.
Implementation of
Section titled “Implementation of”stream()
Section titled “stream()”stream(
request):Promise<StreamRun>
Orchestrates a Mode 2 streaming execution of a TaskRequest.
Routes through the same planner as run(), asking it for a stream route: the
planner rejects providers that do not declare supports.streaming or whose
dynamic capability snapshot says they cannot stream here, and reports why. The
whole returned chain is therefore mode-compatible and subject to the same
privacy, locality, availability, and policy constraints as a Mode 1 route.
Fallback to the next provider is allowed only before the first content event has been admitted for the run; once one has been delivered, the run is committed to that provider and any later provider failure becomes a terminal error outcome rather than a silent provider swap — partial output spliced from two providers is undetectable to the caller. Cancellation always forecloses fallback, regardless of commit state, and is idempotent.
Parameters
Section titled “Parameters”request
Section titled “request”The canonical task request containing prompts, tasks, and constraints.
Returns
Section titled “Returns”Promise<StreamRun>
Throws
Section titled “Throws”If validation fails or no eligible streaming provider exists.
Implementation of
Section titled “Implementation of”IndeRun — open-source AI execution for cross-platform apps. Built and maintained by Independo GmbH (opens in new tab), supported by netidee (opens in new tab).
MIT-licensed SDK · No SDK usage telemetry.
© 2025–2026 Independo GmbH