Skip to main content
Use this walkthrough to start an Agent Builder session, poll until the build finishes, and run the saved Agent.
Agent Builder is currently single-shot. Put the full request in your first prompt: URL, fields, pagination, authentication needs, output shape, and anything to skip.

Before you start

Generate an API key from your Sequentum dashboard, then choose the prompt you want to send.
import os
os.environ["SEQUENTUM_API_KEY"] = "sk-..."

Start Agent Builder

Send your prompt to Agent Builder. Replace the URL and fields with your target; the response returns a sessionId.
import os
import requests

prompt = "Get the shoe information from https://training.sequentum.com/ShoeStore/product.html?id=1"

response = requests.post(
    "https://dashboard.sequentum.com/api/v1/agent-builder/start",
    headers={"Authorization": f"ApiKey {os.environ['SEQUENTUM_API_KEY']}"},
    json={"prompt": prompt},
)

session = response.json()
print(session["sessionId"])

Wait for the agent to build

Poll the session until status is completed. The completed response includes the saved Agent id.
import os
import time
import requests

session_id = "ab_123..."

while True:
    response = requests.get(
        f"https://dashboard.sequentum.com/api/v1/agent-builder/{session_id}/status",
        headers={"Authorization": f"ApiKey {os.environ['SEQUENTUM_API_KEY']}"},
    )
    body = response.json()

    if body["status"] == "completed":
        agent_id = body.get("agentId") or body["configId"]
        print(f"Agent built: {agent_id}")
        break

    if body["status"] == "error":
        raise RuntimeError(body.get("error", "build failed"))

    time.sleep(5)

Start a Run

Start the saved Agent asynchronously. The response returns a Run id you can poll.
import os
import requests

agent_id = "12345"

response = 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 = response.json()
run_id = run["id"]
print(run_id)

Wait for the Run

Poll run status until the Run is finished. Completed and Success mean the Run finished successfully.
import time

FINISHED = {6, 8, 9, 10, 11, "Failure", "Stopped", "Completed", "Success", "Skipped"}
SUCCESSFUL = {9, 10, "Completed", "Success"}

while True:
    response = 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 = response.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)

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"

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)
Runs can produce multiple output files. List files again if the Agent writes separate datasets or downloads source files.

What success looks like

When the build finishes, Agent Builder gives you a saved Agent. A good first build has:
  • A clear Agent name and description.
  • Fields that match your prompt.
  • A test run with records shaped like the entity you asked for.
For the ShoeStore prompt, the output file should contain records like this:
[
  {
    "name": "Trail running shoe",
    "price": "$89.99",
    "sku": "SHOE-001",
    "availability": "In stock",
    "productUrl": "https://training.sequentum.com/ShoeStore/product.html?id=1"
  }
]
If the records are missing a field or include the wrong items, start a new build with a tighter prompt. Mention the missing field, the page pattern, and the section or records to skip.

Write a good prompt

Start with the exact page or site section: “Extract product data from https://....”
Say “follow all paginated pages” or “first 50 pages only” — Agent Builder will scope the run.
Agent Builder can infer a schema, but naming fields gives you more predictable output. Ask for “one row per product” or “one row per invoice” when the page contains repeated records.

What’s next

Agent Builder sessions

Understand session status, stopping a build, and the handoff to the saved Agent.

Schedule recurring runs

Run the saved Agent automatically on a cadence you define.