Skip to content

Local conversation context ​

Clients that run a conversation on a person's own machine, such as the Chainabit CLI, start each turn with POST /ai/conversation-runs. Two things on that path let a client check what the server accepts and carry the privacy of earlier conversations into a new one: the context endpoint, and the inheritAudienceFrom field.

Base path ​

/api/v1/ai/conversation-runs

Auth: Bearer token. Every conversation named belongs to the caller's account and selected workspace.

Endpoints ​

MethodPathDescription
GET/ai/conversation-runs/contextThe caller's scope and what this server accepts on a turn
POST/ai/conversation-runsStart a turn; this page documents the inheritAudienceFrom field

GET /ai/conversation-runs/context ​

Returns the scope a turn runs in and the capabilities this server advertises. A client reads it before it sends an optional field, because the server refuses fields it does not know.

Response ​

json
{
  "data": {
    "accountId": "00000000-0000-4000-8000-000000000031",
    "chainerId": "00000000-0000-4000-8000-000000000032",
    "workspaceId": "00000000-0000-4000-8000-000000000033",
    "capabilities": {
      "inheritAudienceFrom": { "maxSources": 20 }
    }
  }
}
FieldTypeDescription
accountId, chainerId, workspaceIdstringThe account, person and workspace a turn runs in.
capabilities.inheritAudienceFrom.maxSourcesintegerHow many source conversations one turn may name. When the capability is missing, the server does not accept the field.

Code Example ​

curl https://api.chainabit.com/api/v1/ai/conversation-runs/context \
  -H "Authorization: Bearer $TOKEN"

The inheritAudienceFrom field ​

When a turn carries content from other conversations, such as the result of a helper conversation attached to your next message, that content may have been private. Send the IDs of those conversations in inheritAudienceFrom and the run starts under the audience ceiling computed over this conversation and all of its sources, so the new content is never visible to a wider audience than the sources allowed.

FieldTypeDescription
inheritAudienceFromarray of UUIDsOptional. At most maxSources distinct conversation IDs; the turn's own conversation ID is ignored. Absent or empty, admission is unchanged.

Rules:

  • Every ID must be a conversation of the same person, account and workspace. Another person's conversation and a conversation that never existed are refused the same way, so the answer reveals nothing about either.
  • The check happens before a run starts or any credits or quota are used, so a refused turn costs nothing.
  • The server records the source IDs with the run for audit.
  • More than maxSources IDs, or an ID that is not a UUID, returns 400 Bad Request.
StatusCodeMeaning
404local_conversation_audience_source_not_foundAn ID is not a conversation of yours.
400bad_requestToo many IDs (inheritAudienceFrom must contain no more than 20 elements), or an ID is not a UUID.

Check capabilities.inheritAudienceFrom first. A server that does not advertise it rejects the unknown field; the CLI then stops the helper agent with the reason This API cannot carry context between conversations yet. rather than sending it.

Code Example ​

The IDs below are placeholders; use conversation IDs you created.

curl -X POST https://api.chainabit.com/api/v1/ai/conversation-runs \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "version": 1,
    "conversationId": "NEW_CONVERSATION_UUID",
    "turnId": "NEW_TURN_UUID",
    "history": [],
    "content": "Use the attached review result.",
    "inheritAudienceFrom": ["SOURCE_CONVERSATION_UUID"]
  }'

A turn that is accepted returns 201 Created with runId, rootRunId, status and model. See AI runs and Streaming for following the run.

Built with purpose. chainabit.com