Skip to main content
This guide assumes you already have a published agent in an Erstan workspace.
Using Node.js 22+? The JavaScript SDK quickstart covers @erstan/sdk, including its current private-beta installation path, typed run helpers, and handling of pauses. This page remains the direct HTTP alternative; no SDK is required.

1. Create an API key

In Erstan, open Settings -> API Keys -> Create Key. Select these scopes:
Agent access follows your current workspace and team permissions. Copy the ers_live_... secret when it is shown.

2. Set environment variables

3. List available agents

Response:
If defaultLaneId is present, the agent has one public lane and you can omit laneId when starting a run.

4. Inspect an agent

Use this endpoint when an agent has multiple lanes. The lane id returned here is the same lane ID used in the Erstan frontend.

5. Start a run

For a single-lane agent that accepts fields:
For a multi-lane agent, pass the selected laneId:
Response:

6. Poll for results

Runs execute durably in the background and may continue for hours. Closing the request, browser, or integration process does not stop the Agent. When the run completes, finalResponse contains the agent’s final output.

7. Cancel a run

Cancellation is an explicit, idempotent request. A run first reports cancelling; it becomes cancelled when the owning worker acknowledges the signal or its lease expires.
Do not treat a disconnected client as cancellation. Cancellation cannot roll back an external write that completed before the worker received the signal.

JavaScript without the SDK

The following is a direct fetch illustration. For bounded polling, typed errors, interactions, and continuation helpers, see the SDK reference. Select an Agent and lane explicitly; do not run the first discovered Agent automatically.
This minimal example returns control on any wait; it does not answer an approval or user-input interaction. A polling deadline or disconnected client does not cancel the remote run. Use the same creating key to resume observation, and reuse the launch key only for an identical logical request.