Engines
Personaas runs personas on one of two engines:
v1runs the persona inside the Personaas server.v3runs the persona on a pool of separate, ready-to-go runners.
Each organisation uses one of them. The engine sets the version prefix of the paths your app uses to send a message and stop a run. Everything else is the same on both engines: personas, conversations, history, files, sign-in and the stream URL.
Find your organisation's engine
Ask once when your app starts, with the same key or token as every other call:
curl "$PERSONAAS_BASE_URL/api/v1/auth/me" \
-H "x-personaas-key: $PERSONAAS_API_KEY"
{
"username": "jdoe",
"active_organization": {
"slug": "org_acme",
"config": { "persona_executor": "v3" }
}
}
Read active_organization.config.persona_executor:
"v3": your engine isv3.- Missing, or any other value: your engine is
v1.
Put it in your app's configuration. These docs use it as an environment variable in every example:
export PERSONAAS_ENGINE="v3" # v3 if persona_executor is "v3", otherwise v1
Which path for which job
Only two paths depend on the engine: sending a message and stopping a run.
| Job | Path |
|---|---|
| Create a conversation | POST /api/v1/activity/ (the same on both engines) |
| Send a message (a question or a follow-up) | POST /api/{engine}/activity/{activity_id}/message |
| Stop a run | POST /api/{engine}/activity/{activity_id}/kill |
| Read the answer as it is written | GET /api/v2/activity/{activity_id}/stream (the same on both engines) |
| Check the conversation and read its messages | GET /api/v1/activity/{activity_id} and …/messages (the same on both engines) |
The request body is the same on both engines.
Stop a run on the engine that runs it. A kill sent to the other engine may
not stop the run.
When v3 has no free runner
v3 answers 503 with "detail": "No runner available" when every runner is
busy. The message was not run, so send the same request once on v1
instead, as the Personaas app does. The answer arrives on the same stream.
Remember that this run is on v1, so you stop it on v1.
Fall back only on that exact detail. Any other 503 may mean the run started
anyway: check the conversation before sending again.
What differs in the responses
Sending a message
v1 | v3 |
|---|---|
200, {"status": "success", …} | 202, {"status": "accepted", "activity_id": "…"} |
Treat any 2xx as "sent", then read the answer from the stream or by checking
the conversation; both work the same on either engine. Only v3 can answer
503 (see above).
The stream
The stream URL is the same on both engines, but some events differ. See Stream the answer.
In code
// Once, at start-up.
async function getEngine(baseUrl, headers) {
const res = await fetch(`${baseUrl}/api/v1/auth/me`, { headers });
if (!res.ok) throw new Error(`Personaas returned ${res.status}`);
const me = await res.json();
return me.active_organization?.config?.persona_executor === "v3" ? "v3" : "v1";
}