palbaseDocs

Palbase ai · API

POST/ai/chats/{chat_id}/runs/{run_id}/stop

Stop a subagent at work

Stops one subagent at work — with the subagents it started and its background work: the agent that started it is told a person stopped it, and not to start that work again unless asked, and the rest of the turn goes on. Any member stops it, as any member stops the turn, and the server — as itself, or as a member (as: the server's alone; a user sending it is answered 400; one who is not a member of the chat, 403 not_a_member). Asked again, the same stop answers as it did. A run that is not a subagent at work in this chat — ended, the agent itself, another chat's — is 404.

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.
run_idstring · requiredThe subagent's run (an agent event's run_id).

Request body

asstring · optionalThe member the project's server stops it as: a member of the chat (the server's alone: a user sending it is answered 400; one who is not a member, 403 not_a_member). Left out, the server stops it as itself.
curl
curl -X POST "https://<your-ref>.palbase.studio/ai/chats/<chat_id>/runs/<run_id>/stop" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"as":"string"}'

Responses

200The subagent stopped

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

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

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

Operation StopSubagent of ai's contract.