Unified Agent method execution
- Web UI
POST /api/function/{name}, thendispatch_forced_tool_call - Model tool callno REST endpoint, dispatcher tool execution
- Runtime-block wrapperboth land here: Agent method wrapper,
runtime.exec(...)
Code: routes/chat.py post_function; turn_runtime/forced_tool.py; turn_runtime/runtime_attach.py _wrap_agentic_runtime_block.
REST endpoint
POST /api/function/{name}
{"session_id": "...", "project_id": "...", "kwargs": {"task": "..."}}
{"session_id": "...", "msg_id": "..."}
| Field | Rule |
|---|---|
session_id | Optional. Omitted: the server creates a session. |
project_id | Optional for an existing session; required when a pending Project selection must be bound before the first call. Execution uses the selected Project directory, else the configured default Project. |
| Flat parameters | Older callers may post function parameters at the top level. The server moves them into kwargs and ignores control keys such as session_id and project_id. |
No /run API
| Name | State |
|---|---|
Typed /run ... | Stays plain user text; never becomes action="run" |
/api/run/{name}, WebSocket action="run" | Do not exist |
| React function calls and the retry UI | Call POST /api/function/{name} |
Leftover wording
Some comments and type names still say /run or runtime block because a UI component name predates the endpoint. They do not define a second path. To find them:
rg "/run|api/run|action=run|action=\"run\"" openprogram apps/web rg "runtime block|RuntimeBlock" apps/web openprogram
Last updated · 2026-11-25