palbaseDocs

Palbase ai · API

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

Write to a subagent at work

A message for one of the agent's subagents, at its next step: a message of the chat like any other — its writer's (or the member's the server writes as) messages a minute (429 too_many_messages), the history the project keeps (409 history_full); a member whose AI is off in the project is refused (403 user_ai_blocked).

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 acts as: held to that member's rules — their messages a minute (429 too_many_messages) — and the message is theirs (the server's alone: a user sending it is answered 400; one who is not a member of the chat, 403 not_a_member). Left out, the server acts as itself.
client_idstring · requiredThe writer's id for it.
textstring · requiredThe message.
curl
curl -X POST "https://<your-ref>.palbase.studio/ai/chats/<chat_id>/runs/<run_id>/messages" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"client_id":"string","text":"string"}'

Responses

202The message, given

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

409The response's state refuses it

413The body is larger than the route takes

429The project's request rate, or the provider's for its connection, is used up — or the project holds as much as it may at once: 32 open streams at one of the module's servers (too_many_streams), 2 pictures being made (too_many_images), 512 MiB of pictures kept here for their day (image_storage_full), or the service — or the project's share of it — holds as much of its requests at once as it takes: their bodies, an embedding request's vectors, the pictures being made (busy). Retry-After says when to try again

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

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

Operation SendSubagentMessage of ai's contract.