Skip to main content
This guide assumes you already have a published agent in an Erstan workspace.

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 example