Skip to content

Quickstart

You will run the assistant locally, talk to it through the API, and give it one tool. Then you will see what changes on AWS.

You need Docker and the sandbox bundle we send you (a compose file and the images). The sandbox uses a local model and a stand-in identity endpoint, so no cloud account is needed.

1. Start the sandbox

docker compose up --wait
curl localhost:8002/api/v1/health

The API is now on http://localhost:8002. The sandbox accepts tokens such as dev-acme-member (see Identity endpoint).

2. Ask a question

quickstart.sh
BASE=${BASE:-http://localhost:8002}
AUTH="Authorization: Bearer dev-acme-member"
JSON="content-type: application/json"

THREAD=$(curl -sf -X POST $BASE/api/v1/threads -H "$AUTH" -H "$JSON" -d '{}' \
  | python3 -c 'import json,sys; print(json.load(sys.stdin)["thread_id"])')

RUN=$(curl -sf -X POST $BASE/api/v1/threads/$THREAD/messages -H "$AUTH" -H "$JSON" \
  -d '{"message": "Hello! What can you do?"}' \
  | python3 -c 'import json,sys; print(json.load(sys.stdin)["run_id"])')

# A run is submit-and-poll: ask until it has finished.
for _ in $(seq 1 60); do
  BODY=$(curl -sf $BASE/api/v1/runs/$RUN -H "$AUTH")
  STATUS=$(echo "$BODY" | python3 -c 'import json,sys; print(json.load(sys.stdin)["status"])')
  case "$STATUS" in queued|running|requires_action) ;; *) break ;; esac
  sleep 2
done
echo "$STATUS"; echo "$BODY"
case "$STATUS" in queued|running|requires_action) echo "run did not finish"; exit 1 ;; esac

A run ends as completed (the answer is in answer), failed (error says why), cancelled, expired (nobody answered a confirmation in time) or stopped_by_limit (a hard token cap). requires_action means it is waiting for your page: see step 3.

3. Add a tool

Tools are actions in your product. The simplest is a function your page runs itself, declared with each message:

curl -X POST $BASE/api/v1/threads/$THREAD/messages -H "$AUTH" -H "content-type: application/json" \
  -d '{"message": "Show task T-1", "client_tools": [
    {"name": "open_task", "description": "Show a task on the user screen", "mode": "read",
     "input_schema": {"type": "object", "properties": {"task_id": {"type": "string"}}, "required": ["task_id"]}}]}'

The run stops with status: requires_action and required_action.kind: client_tool. Your page runs the function and answers with POST /api/v1/runs/{run_id}/resume and {"action_id": "...", "result": {...}}. Tools that change data ask the user to confirm first. More in Tools.

4. Embed it

Add the assistant to a page of your app, passing the user's token: Embedding.

5. Move to AWS

Nothing in your code changes. You swap the stand-ins for the real services:

Sandbox Your AWS account
Local model Amazon Bedrock
Stand-in identity Your identity endpoint
Compose The Terraform stack