palbaseDocs

Palbase ai · API

PUT/ai/chats/{chat_id}/goal

Set the chat's goal

Sets the chat's goal — replacing any it had: the engine works the chat toward the objective by itself, a turn at a time — each turn the chat's agent as it is defined now (a backend's agent is asked, told of the goal), judged when it ends, a claimed completion checked against the rubric — until it is met, or max_turns, the budget or a brake (turns that fail, that do nothing) stops it; its first turn opens at once when no turn of the chat is at work. The project's server's alone — as itself, or as a member (as: the goal is then theirs, as their message's turn is: they decide and answer its turns' approvals and app tools, and change and clear it — while they stand where they stood when it was set: in the chat, and, its agent defined for them alone, the chat theirs alone; taken out, or the chat given another member, the goal is paused with a reason saying why and its turn at work stopped). Each of its turns is the chat's: in its stream (a turn part that says the goal's, its role and number), billed, its tools served, stopped by a stop; a member's message goes before its next turn. Its status, each time it changes, is the event ai.goal.updated, and its words are goal parts of the chat's stream.

Called by a signed-in user of your app, with their token and the publishable key; or your server, with the project's secret key.

Path

chat_idstring · requiredThe chat's id.

Request body

asstring · optionalThe member the server sets it as: the goal and its turns are theirs (the server's alone: a user sending it is answered 403 server_only; one who is not a member of the chat, 403 not_a_member). Left out, the server's.
budgetobject · optionalWhat the turn a message starts may cost at most, its subagents' spend counted, their model calls and their web searches (the server's alone): past it the engine stops the turn. A message delivered into a turn already running takes that turn's.
max_turnsinteger · optionalThe most turns it opens (1 to 10000; left out: no limit).
objectivestring · requiredWhat the chat works toward, in words (4000 characters at most).
rubricstring · optionalWhat a claimed completion is checked against (8000 characters at most; left out: the objective itself).
curl
curl -X PUT "https://<your-ref>.palbase.studio/ai/chats/<chat_id>/goal" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"objective":"string"}'

Responses

200The goal

400The request is malformed, or names what this module does not offer (the error names which)

401No valid credential

403A publishable key or a user's session: everything here is the project's server's, called with the secret key

404No such response, job or provider in this project

413The body is larger than the route takes

503The model service or the database did not answer; retry shortly

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation SetChatGoal of ai's contract.