Operating your agent
Managing agents via API
Drive any agent programmatically with the OpenAI-compatible API — auth, requests, and code examples.
Every agent can also be driven programmatically. The API is OpenAI-compatible, so you can call it with a plain HTTP request or the standard OpenAI SDKs.
Endpoint & auth
- POST to your agent's endpoint with the path /api/v1/chat/completions
- Authenticate with a Bearer access key, scoped to that agent
- Send an OpenAI-style messages array; read the reply from choices[0].message.content
Example — cURL
curl -X POST "$AGENT_ENDPOINT/api/v1/chat/completions" -H "Content-Type: application/json" -H "Authorization: Bearer $AGENT_ACCESS_KEY" -d '{"messages":[{"role":"user","content":"Hello!"}]}'Example — Python
import os, requests
resp = requests.post(
os.environ["AGENT_ENDPOINT"] + "/api/v1/chat/completions",
headers={"Authorization": "Bearer " + os.environ["AGENT_ACCESS_KEY"]},
json={"messages": [{"role": "user", "content": "Hello!"}]},
)
print(resp.json()["choices"][0]["message"]["content"])Example — JavaScript
const res = await fetch(process.env.AGENT_ENDPOINT + "/api/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + process.env.AGENT_ACCESS_KEY,
},
body: JSON.stringify({ messages: [{ role: "user", content: "Hello!" }] }),
});
const data = await res.json();
console.log(data.choices[0].message.content);Good to know
- Keep your access key server-side — never expose it in the browser
- Put per-IP or per-user rate limits in front of the API
- Streaming is supported for token-by-token responses
Need a key or endpoint? We provision these with your agent — just ask.