v1.6.1

POST /v1/send Semantics

Last updated


The request body, permission mode and session handling of POST /v1/send.
The body is {content, stream?, session_id?, persist?, model?, reasoning?, skill?, work_dir?, rule?, task_hash?, exclude_tools?, enable_edit?, enable_markdown?}; content is required. Since v1.3.9 stream, rule and task_hash replace sse, system_prompt and pending_task; the old names are still accepted as aliases and will be removed later. Since v1.3.5 model and reasoning apply to this request only and never change the session default: an omitted model uses the session model, auto runs the dispatcher even when the session is pinned, and an omitted reasoning uses the session level. The web chat keeps its picks in browser cookies and sends them here. work_dir defaults to the home directory and must resolve to an existing directory (400 otherwise). rule adds extra system instructions for this run; enable_markdown:false (v1.3.9, default true) appends a rule asking for a plain-text reply without markdown syntax. task_hash resumes that pending task while it still has background jobs. A request that arrives while the session is still running is appended to that run as a steer message instead of starting a new one, and returns {session_id} at once (the steer:true field was removed in v1.3.9). Otherwise stream:true streams the run's events; without it the reply arrives when the run ends as {text, model, usage, session_id}, or {session_id, canceled:true} when it was canceled (500 with error when it failed).
Since v1.3.9 a request that sets enable_edit, or that arrives with no web confirmation listener open, runs in API auto mode: nothing prompts; the run is read-only unless enable_edit:true (writes and non-read-only commands); it always stays in the sandbox (paths outside $HOME, sudo and sandbox: false are refused); ask_user, store_secret and the background tools are unavailable; and the session's path grants are cleared at the start of the request. A blocked call returns [Denied] naming what would allow it (enable_edit: true, or agen -p --skip-sandbox for a sandbox block). Before v1.3.9 such a request approved writes and restricted access with nobody watching. The enable_sandbox field was Removed in v1.5.0 and is now ignored, because a sandboxed hook, script tool or network: true command can call the API from loopback; only agen -p --skip-sandbox in a terminal leaves the sandbox, and it runs the request in its own process through the same app.Send path the handler uses, never over HTTP.
persistsession_idResult
false (default)emptyCreates temp-<uuid>, removed after 30 min without changes
trueemptyCreates chat-<uuid>, retained
anyprovidedUses the supplied session_id (persist is ignored)

The chat flag was removed in v1.0.11 and the http- prefix with it: a persisted HTTP session now gets the same chat- prefix the dashboard uses, so one prefix covers every persisted non-CLI session. Existing http- sessions keep working when named explicitly through session_id.
  1. curl --fail-with-body -sS \
  2. -H 'Content-Type: application/json' \
  3. -d '{"content":"List the available tools","persist":false}' \
  4. http://127.0.0.1:17989/v1/send