Skip to main content
In this quickstart you’ll:
  1. Authenticate API requests with your Sequentum API key.
  2. Open an Agent Builder session and describe the data you want.
  3. Poll until the build completes.
  4. Run the agent and download extracted data.
You’ll need a Sequentum account and an API key. Generate an API key from your Sequentum dashboard. Keys start with sk-.

1. Set your API key

import os
os.environ["SEQUENTUM_API_KEY"] = "sk-..."

2. Start an Agent Builder session

Describe the agent you want in plain language. Agent Builder will plan, build, and test it for you.
import os, requests

r = requests.post(
    "https://dashboard.sequentum.com/api/v1/agent-builder/start",
    headers={"Authorization": f"ApiKey {os.environ['SEQUENTUM_API_KEY']}"},
    json={
        "prompt": "Pull product name, price, and SKU from https://example-store.com/products/",
    },
)
session = r.json()
session_id = session["sessionId"]
print(session_id)
The response gives you a sessionId. Agent Builder is now planning, executing, and testing on Sequentum’s side.
{
  "sessionId": "ab_123..."
}

3. Wait for the build

Poll GET /agent-builder/{sessionId}/status every few seconds until status is completed. The response then carries agentId — that’s your new Agent’s id.
import os
import time
import requests

while True:
    r = requests.get(
        f"https://dashboard.sequentum.com/api/v1/agent-builder/{session_id}/status",
        headers={"Authorization": f"ApiKey {os.environ['SEQUENTUM_API_KEY']}"},
    )
    body = r.json()
    if body["status"] == "completed":
        agent_id = body["agentId"]
        break
    if body["status"] == "error":
        raise RuntimeError(body.get("error", "build failed"))
    time.sleep(5)
When the build succeeds, the status response includes the new Agent id:
{
  "status": "completed",
  "agentId": 12345
}
Builds typically complete in one to two minutes for simple sites. Complex sites with auth, pagination, or anti-bot challenges can take longer. You can manually monitor the progress in your organization’s AI Agents page https://dashboard.sequentum.com/org/ai-agents. If the build returns an error, inspect the response body — most failures are due to a vague prompt; revise and start a new session.

4. Start a run

Start the agent asynchronously. The response returns a Run id you can poll.
r = requests.post(
    f"https://dashboard.sequentum.com/api/v1/agent/{agent_id}/start",
    headers={"Authorization": f"ApiKey {os.environ['SEQUENTUM_API_KEY']}"},
    json={"isRunSynchronously": False},
)
run = r.json()
run_id = run["id"]
print(run_id)

5. Wait for the run

Poll run status until the Run is finished. Completed and Success mean the Run finished successfully.
FINISHED = {6, 8, 9, 10, 11, "Failure", "Stopped", "Completed", "Success", "Skipped"}
SUCCESSFUL = {9, 10, "Completed", "Success"}

while True:
    r = requests.get(
        f"https://dashboard.sequentum.com/api/v1/agent/{agent_id}/run/{run_id}/status",
        headers={"Authorization": f"ApiKey {os.environ['SEQUENTUM_API_KEY']}"},
    )
    run = r.json()
    if run["status"] in FINISHED:
        if run["status"] not in SUCCESSFUL:
            raise RuntimeError(f"Run did not complete successfully: {run}")
        break
    time.sleep(5)

6. List output files

After the Run finishes, list its output files and choose a file to download.
files_response = requests.get(
    f"https://dashboard.sequentum.com/api/v1/agent/{agent_id}/run/{run_id}/files",
    headers={"Authorization": f"ApiKey {os.environ['SEQUENTUM_API_KEY']}"},
)
files = files_response.json()
file_id = files[0]["id"]
file_name = files[0].get("name") or f"run-{run_id}-output"

7. Download an output file

Download endpoints redirect to the file content. Follow redirects when saving the file.
download_response = requests.get(
    f"https://dashboard.sequentum.com/api/v1/agent/{agent_id}/run/{run_id}/file/{file_id}/download",
    headers={"Authorization": f"ApiKey {os.environ['SEQUENTUM_API_KEY']}"},
)

with open(file_name, "wb") as f:
    f.write(download_response.content)

What’s next

Agent Builder sessions

Status polling, the agentId handoff, and stopping a build.

Schedule recurring runs

Attach a run-once, interval, or advanced schedule to any agent.

Run lifecycle

Statuses, stopping runs, and what every run produces.