@erstan/sdk is the JavaScript ESM client for Erstan, with TypeScript declarations.
Use Node.js 22 or later. Agents execute in Erstan with their saved connections,
permissions, and approval policies; the SDK is not an offline Agent engine.
You do not need a CLI, repository template, test runner, or backend checkout.
Install the beta package
Install the reviewed archive into your existing Node.js project, using its actual local path:Configure a run
Create a key using API Keys. Starting and observing a run requiresagents:run and runs:read; discovery also requires agents:list.
The key creator must retain access to the Agent.
Configure these values in your trusted local or server environment:
Use the same SDK package for either environment, with that environment’s
credential and Agent IDs. Do not fall back from QA to production when a request
fails. Keep secrets and sensitive results out of Git and unreviewed CI jobs.
Run a published Agent
Save this asrun.mjs. The example deliberately selects a chat lane; structured
lanes require an input object matching their own advertised schema.
runAndWait returns completed, failed, cancelled, interaction, waiting,
or unknown_status as its reason. An Agent failure is a result, not necessarily
an HTTP exception. Validate the shape of finalResponse before using it in
application logic. Use runs.wait(runId) to resume observation with the exact
key that started the run. A rotated or replacement key cannot read its runs.
Continue with the SDK reference for methods,
configuration, authoring, and recovery, or optional examples
for human review and keeping Agent/Skill files in your own repository.