Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 1.15 KB

File metadata and controls

43 lines (33 loc) · 1.15 KB

Quickstart

Start the reference server:

pnpm install
pnpm dev

Create a conversation:

conversation_id=$(curl -s -X POST http://127.0.0.1:4310/v1/conversations \
  -H 'content-type: application/json' \
  -d '{"metadata":{"source":"quickstart"}}' | node -pe \
  'JSON.parse(require("fs").readFileSync(0, "utf8")).id')

Start an execution:

execution_id=$(curl -s -X POST http://127.0.0.1:4310/v1/executions \
  -H 'content-type: application/json' \
  -d "{\"conversationId\":\"$conversation_id\",\"providerId\":\"mock\",\"input\":\"hello runtime\",\"idempotencyKey\":\"quickstart-1\"}" | node -pe \
  'JSON.parse(require("fs").readFileSync(0, "utf8")).id')

Follow the event stream:

curl -N -H 'accept: text/event-stream' \
  "http://127.0.0.1:4310/v1/executions/$execution_id/events?after=0"

To exercise approval, add "config":{"requireApproval":true} to the execution request, read the action ID from action.required.data.id, and respond:

curl -s -X POST \
  "http://127.0.0.1:4310/v1/executions/$execution_id/actions/$action_id:respond" \
  -H 'content-type: application/json' \
  -d '{"approved":true}'