Keep a chat turn's agent trace
curl --request POST \
--url https://patch.gg/api/v1/me/agent-traces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"trace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"size": 134217728,
"sha256": "<string>",
"started_at": "2023-11-07T05:31:56Z"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
trace_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
size: 134217728,
sha256: '<string>',
started_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://patch.gg/api/v1/me/agent-traces', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://patch.gg/api/v1/me/agent-traces"
payload = {
"trace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"size": 134217728,
"sha256": "<string>",
"started_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"key": "<string>",
"upload": {
"method": "PUT",
"url": "<string>",
"headers": {},
"expires_at": "<string>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}Chats
Keep a chat turn's agent trace
Patch Desktop calls this after each turn of a chat, to keep the turn’s whole trace: what the agent was sent, every model call and tool call, and how it ended. It answers with a URL to PUT the gzipped trace to, which takes only those bytes. Traces are kept under your account.
POST
/
me
/
agent-traces
Keep a chat turn's agent trace
curl --request POST \
--url https://patch.gg/api/v1/me/agent-traces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"trace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"size": 134217728,
"sha256": "<string>",
"started_at": "2023-11-07T05:31:56Z"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
trace_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
size: 134217728,
sha256: '<string>',
started_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://patch.gg/api/v1/me/agent-traces', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://patch.gg/api/v1/me/agent-traces"
payload = {
"trace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"size": 134217728,
"sha256": "<string>",
"started_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"key": "<string>",
"upload": {
"method": "PUT",
"url": "<string>",
"headers": {},
"expires_at": "<string>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}Authorizations
An API key (pch_...) or the token from pch login.
Body
application/json