Read one run
curl --request GET \
--url https://api.example.com/sop/runs/{sop_run_id} \
--header 'x-user-id: <x-user-id>'import requests
url = "https://api.example.com/sop/runs/{sop_run_id}"
headers = {"x-user-id": "<x-user-id>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-user-id': '<x-user-id>'}};
fetch('https://api.example.com/sop/runs/{sop_run_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/sop/runs/{sop_run_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-user-id: <x-user-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/sop/runs/{sop_run_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-user-id", "<x-user-id>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/sop/runs/{sop_run_id}")
.header("x-user-id", "<x-user-id>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/sop/runs/{sop_run_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-user-id"] = '<x-user-id>'
response = http.request(request)
puts response.read_body{
"user_id": "<string>",
"sop_id": "<string>",
"definition": {
"name": "<string>",
"steps": [
{
"subject": "<string>",
"description": "<string>",
"executor": {
"agent_id": "<string>",
"session_key": "<string>"
},
"version": "v1",
"verifier": {
"agent": {
"agent_id": "<string>",
"session_key": "<string>"
},
"type": "agent",
"criteria": ""
},
"max_attempts": 3
}
],
"description": "",
"workspace_grain": "run",
"session_settings": {}
},
"id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"sessions": {},
"state": {
"phase": "pending",
"id": "<string>",
"inputs": [
{
"name": "<string>",
"content": [
{
"text": "<string>",
"type": "text",
"id": "<string>",
"created_at": "<string>",
"finished_at": "<string>"
}
],
"role": "user",
"id": "<string>",
"metadata": {},
"created_at": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_input_tokens": 0,
"cache_creation_input_tokens": 0
},
"finished_at": "<string>",
"finished_reason": "completed",
"structured_output": {},
"error": {
"message": "<string>",
"type": "unknown"
}
}
],
"steps": [
{
"phase": "pending",
"given": [
{
"name": "<string>",
"content": [
{
"text": "<string>",
"type": "text",
"id": "<string>",
"created_at": "<string>",
"finished_at": "<string>"
}
],
"role": "user",
"id": "<string>",
"metadata": {},
"created_at": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_input_tokens": 0,
"cache_creation_input_tokens": 0
},
"finished_at": "<string>",
"finished_reason": "completed",
"structured_output": {},
"error": {
"message": "<string>",
"type": "unknown"
}
}
],
"submission": [
{
"text": "<string>",
"type": "text",
"id": "<string>",
"created_at": "<string>",
"finished_at": "<string>"
}
],
"verifications": [
{
"passed": true,
"message": "",
"verifier": "",
"created_at": "<string>"
}
]
}
],
"created_at": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}sop
Read one run
Return one run and where it stands.
Args:
sop_run_id (str):
The run to read.
user_id (str):
Injected authenticated user id.
storage (StorageBase):
Injected storage backend.
Returns:
SOPRunRecord:
The run. Where it stands is its state’s phase.
GET
/
sop
/
runs
/
{sop_run_id}
Read one run
curl --request GET \
--url https://api.example.com/sop/runs/{sop_run_id} \
--header 'x-user-id: <x-user-id>'import requests
url = "https://api.example.com/sop/runs/{sop_run_id}"
headers = {"x-user-id": "<x-user-id>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-user-id': '<x-user-id>'}};
fetch('https://api.example.com/sop/runs/{sop_run_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/sop/runs/{sop_run_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-user-id: <x-user-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/sop/runs/{sop_run_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-user-id", "<x-user-id>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/sop/runs/{sop_run_id}")
.header("x-user-id", "<x-user-id>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/sop/runs/{sop_run_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-user-id"] = '<x-user-id>'
response = http.request(request)
puts response.read_body{
"user_id": "<string>",
"sop_id": "<string>",
"definition": {
"name": "<string>",
"steps": [
{
"subject": "<string>",
"description": "<string>",
"executor": {
"agent_id": "<string>",
"session_key": "<string>"
},
"version": "v1",
"verifier": {
"agent": {
"agent_id": "<string>",
"session_key": "<string>"
},
"type": "agent",
"criteria": ""
},
"max_attempts": 3
}
],
"description": "",
"workspace_grain": "run",
"session_settings": {}
},
"id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"sessions": {},
"state": {
"phase": "pending",
"id": "<string>",
"inputs": [
{
"name": "<string>",
"content": [
{
"text": "<string>",
"type": "text",
"id": "<string>",
"created_at": "<string>",
"finished_at": "<string>"
}
],
"role": "user",
"id": "<string>",
"metadata": {},
"created_at": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_input_tokens": 0,
"cache_creation_input_tokens": 0
},
"finished_at": "<string>",
"finished_reason": "completed",
"structured_output": {},
"error": {
"message": "<string>",
"type": "unknown"
}
}
],
"steps": [
{
"phase": "pending",
"given": [
{
"name": "<string>",
"content": [
{
"text": "<string>",
"type": "text",
"id": "<string>",
"created_at": "<string>",
"finished_at": "<string>"
}
],
"role": "user",
"id": "<string>",
"metadata": {},
"created_at": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_input_tokens": 0,
"cache_creation_input_tokens": 0
},
"finished_at": "<string>",
"finished_reason": "completed",
"structured_output": {},
"error": {
"message": "<string>",
"type": "unknown"
}
}
],
"submission": [
{
"text": "<string>",
"type": "text",
"id": "<string>",
"created_at": "<string>",
"finished_at": "<string>"
}
],
"verifications": [
{
"passed": true,
"message": "",
"verifier": "",
"created_at": "<string>"
}
]
}
],
"created_at": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
Caller's user ID. Temporary header-based identity; will be replaced by JWT auth.
Path Parameters
Response
Successful Response
One run of a procedure.
A procedure: its milestones, in order.
Show child attributes
Show child attributes
Unique identifier for the credential.
Show child attributes
Show child attributes
One execution of a SOP, and the whole of what is worth saving.
It covers the SOP's own state and nothing below it: an executor that
keeps state of its own (an :class:~..agent.Agent does) is persisted
by whoever built it, the same way it is built.
Show child attributes
Show child attributes