diff --git a/.claude/skills/openbot-copy/SKILL.md b/.claude/skills/openbot-copy/SKILL.md
index 231b0263f2..1219a78057 100644
--- a/.claude/skills/openbot-copy/SKILL.md
+++ b/.claude/skills/openbot-copy/SKILL.md
@@ -23,6 +23,7 @@ One word for one thing, everywhere a person can see it.
|---|---|---|
| **Bot**, **Bots** (capitalised) | What a person creates, talks to and gives work to. | agent, coworker, assistant, AI |
| **agent** | Only an outside framework's program, in the places that are about connecting one: "an agent you already run", "AG-UI agent". | Bot, when the thing is a Bot |
+| **agent**, **Agents** | What a Bot hands work to, listed on the Agents page: OpenBot's own, a framework OpenBot runs, or one you run. Never for the Bot itself. | Bot, worker, subagent |
| **app** | A service a Bot uses: Gmail, Google Drive, Notion. | connector, integration, plugin |
| **Connections** | The page that lists the apps and accounts every Bot uses as you: the every-Bot page of Apps. On a Bot's page the same thing is the **Apps** row. | connected accounts, linked accounts |
| **connect / disconnect / reconnect** | What a person does to their own account. | link (except GitHub and Slack identity, where "link" is the vendor's own word) |
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d36f230750..da856ba559 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -195,7 +195,8 @@ jobs:
# one color in the sidebar, on its page and at the top of its conversation, Record on
# screen with a Bot's page in a window of any width, the team screens and a Bot's
# Publish dialog holding their layout wide, narrow and on a phone, and the Admin screens
- # where a rule or a grant names a team holding theirs wide and on a phone, which only a
+ # where a rule or a grant names a team holding theirs wide and on a phone, a Needs you row read
+ # whole at a phone's width and a chat's with its answers on a line of their own, which only a
# browser's layout, cascade
# and paint resolve, and the app following the system's light or dark, which only a
# browser's `prefers-color-scheme` reports, with what OpenBot Desktop's window is told of
@@ -204,7 +205,7 @@ jobs:
# test script's pretest does).
- run: |
bun run generate:app-config
- bun test app/tests/tool-line-reduced-motion.test.tsx app/tests/onboarding-window-buttons.test.tsx app/tests/onboarding-orb-room.test.tsx app/tests/transcript-rail-clearance.test.tsx app/tests/a2ui-frame.test.tsx app/tests/update-banner-layout.test.tsx app/tests/composer-dictation-notice-layout.test.tsx app/tests/conversation-intro-halo.test.tsx app/tests/transcript-room.test.tsx app/tests/skins-window-buttons.test.tsx app/tests/opendots-rail-badge.test.tsx app/tests/account-version-layout.test.tsx app/tests/organization-menu-names.test.tsx app/tests/bot-orb-one-color.test.tsx app/tests/theme-follows-system.test.tsx app/tests/desktop-window-theme.test.tsx app/tests/bot-screen-record-layout.test.tsx app/tests/teams-screens-layout.test.tsx app/tests/team-grants-screens-layout.test.tsx
+ bun test app/tests/tool-line-reduced-motion.test.tsx app/tests/onboarding-window-buttons.test.tsx app/tests/onboarding-orb-room.test.tsx app/tests/transcript-rail-clearance.test.tsx app/tests/a2ui-frame.test.tsx app/tests/update-banner-layout.test.tsx app/tests/composer-dictation-notice-layout.test.tsx app/tests/conversation-intro-halo.test.tsx app/tests/transcript-room.test.tsx app/tests/skins-window-buttons.test.tsx app/tests/opendots-rail-badge.test.tsx app/tests/account-version-layout.test.tsx app/tests/organization-menu-names.test.tsx app/tests/bot-orb-one-color.test.tsx app/tests/theme-follows-system.test.tsx app/tests/desktop-window-theme.test.tsx app/tests/bot-screen-record-layout.test.tsx app/tests/teams-screens-layout.test.tsx app/tests/team-grants-screens-layout.test.tsx app/tests/needs-you-board-layout.test.tsx
env:
OPENBOT_APP_BROWSER: '1'
# The desktop setup window's, for the same reason: the AI step's form holding still while the
diff --git a/api/README.md b/api/README.md
index 2d6ec188f2..26d16a0e05 100644
--- a/api/README.md
+++ b/api/README.md
@@ -32,6 +32,7 @@ not touch the same lines:
| `passwords-and-recorder.yaml` | Sign-in requests, saved logins and the Recorder |
| `learning.yaml` | OpenBot's side of Automatic learning: Learning settings, each person's spaces and sharing choices, sharing requests, and the skills delivered to Bots |
| `memory.yaml` | A person's memories and memory sources |
+| `agents.yaml` | The agents Bots hand work to (`bot-agents`), their callback tokens, and each Bot's delegation |
An area file holds its operations under `paths`, and under `components` the schemas, parameters,
responses and examples only it uses. Inside the file, refer to them as usual
diff --git a/api/openapi-harnesses.test.ts b/api/openapi-harnesses.test.ts
index 9b39d6aafc..b3290a5c77 100644
--- a/api/openapi-harnesses.test.ts
+++ b/api/openapi-harnesses.test.ts
@@ -9,24 +9,30 @@ import { declaredHarness, HARNESSES } from "../shared/harnesses";
* checks every create against the harness catalogue. The two are one list: a framework added to the
* catalogue without the spec is refused by every generated client before it is sent, and one left in
* the spec after the catalogue drops it is refused by the server. Empty is how a create says it named
- * none.
+ * none. A Bot made with its own address names one (CreateBotRequest), and so does an agent added to
+ * the organization's list (BotAgentHarness).
*/
-test("the spec's harness enum is exactly the frameworks the server accepts", () => {
- const spec = parse(
- readFileSync(join(import.meta.dir, "openapi.yaml"), "utf8"),
- ) as {
- components: {
- schemas: Record<
- string,
- { properties?: Record }
- >;
- };
+const spec = parse(
+ readFileSync(join(import.meta.dir, "openapi.yaml"), "utf8"),
+) as {
+ components: {
+ schemas: Record<
+ string,
+ { enum?: string[]; properties?: Record }
+ >;
};
- const harness = spec.components.schemas.CreateBotRequest?.properties?.harness;
- const accepted = HARNESSES.filter((entry) => declaredHarness(entry.id)).map(
- (entry) => entry.id,
- );
+};
+const accepted = HARNESSES.filter((entry) => declaredHarness(entry.id)).map(
+ (entry) => entry.id,
+);
+test("the spec's harness enum is exactly the frameworks the server accepts", () => {
+ const harness = spec.components.schemas.CreateBotRequest?.properties?.harness;
expect(accepted.length).toBeGreaterThan(0);
expect([...(harness?.enum ?? [])].sort()).toEqual(["", ...accepted].sort());
});
+
+test("an agent's harness enum is the same list", () => {
+ const harness = spec.components.schemas.BotAgentHarness;
+ expect([...(harness?.enum ?? [])].sort()).toEqual(["", ...accepted].sort());
+});
diff --git a/api/openapi.yaml b/api/openapi.yaml
index 6b3ed60cbb..e713c6daf2 100644
--- a/api/openapi.yaml
+++ b/api/openapi.yaml
@@ -115,6 +115,8 @@ tags:
description: 'Automatic learning: the skills Learning proposed, the evidence behind them, approving and rejecting them, and its runs, in the organization''s spaces and each person''s own; which space each Bot learns into, who reviews what people''s recordings propose, each person''s sharing choices, requests to share a skill with every Bot, and the skills delivered to Bots.'
- name: Memory
description: 'The facts a person''s Bots remember about them, and the app actions those facts are read in from. Each person''s are theirs alone: an administrator can''t read them either.'
+ - name: Agents
+ description: 'The agents an organization''s Bots hand work to: OpenBot''s own, a framework OpenBot runs, or an agent somebody runs at its own address. An administrator adds the organization''s, and anybody may add a private one for their own Bots. A Bot''s delegation says whether it works on one agent or hands work to several, and which.'
paths:
/api/v2/organizations/{organizationId}/reactions:
parameters:
@@ -3753,6 +3755,51 @@ paths:
$ref: '#/components/responses/ServiceUnavailable'
default:
$ref: '#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/tasks/{taskId}/turns:
+ parameters:
+ - $ref: '#/components/parameters/OrganizationId'
+ - $ref: '#/components/parameters/TaskId'
+ get:
+ tags:
+ - Tasks
+ operationId: listTaskTurns
+ summary: List a task's turns
+ description: 'Return one page of the turns a task has finished, oldest first: each time its Bot worked on something it was asked in the task''s conversation, the Bot''s brief or a line the person said there. Each says how long the Bot worked on it, counting only the time its runs took, never the time it waited on the person, and which model answered. A turn still running is not listed until it ends. Another person''s task is not found. A missing cursor starts at the first page and nextCursor null ends the list.'
+ security:
+ - webSession: []
+ - appOAuth:
+ - tasks:read
+ - apiKey: []
+ parameters:
+ - $ref: '#/components/parameters/Limit'
+ - $ref: '#/components/parameters/Cursor'
+ responses:
+ '200':
+ description: One page of the task's turns.
+ headers:
+ Cache-Control:
+ $ref: '#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/TaskTurnPage'
+ examples:
+ example:
+ $ref: '#/components/examples/TaskTurnPageExample'
+ '400':
+ $ref: '#/components/responses/InvalidRequest'
+ '401':
+ $ref: '#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '404':
+ $ref: '#/components/responses/TaskNotFound'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ '503':
+ $ref: '#/components/responses/ServiceUnavailable'
+ default:
+ $ref: '#/components/responses/UnexpectedError'
/api/v2/organizations/{organizationId}/tasks/{taskId}/resolve:
parameters:
- $ref: '#/components/parameters/OrganizationId'
@@ -3891,6 +3938,52 @@ paths:
$ref: '#/components/responses/ServiceUnavailable'
default:
$ref: '#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/tasks/{taskId}/stop:
+ parameters:
+ - $ref: '#/components/parameters/OrganizationId'
+ - $ref: '#/components/parameters/TaskId'
+ post:
+ tags:
+ - Tasks
+ operationId: stopTask
+ summary: Stop a task
+ description: Stop the task's work, as Stop in its conversation does. A step it is in the middle of is cut off; the steps it finished stay done, and its conversation and the one that asked for it say how far it got. What it waits on the person for is no longer asked. Only a task that is working or waiting on the person can be stopped. The answer is the task as it stands now, which is stopped.
+ security:
+ - webSession: []
+ - appOAuth:
+ - tasks:write
+ - apiKey: []
+ parameters:
+ - $ref: '#/components/parameters/IdempotencyKey'
+ responses:
+ '200':
+ description: The task as it stands now.
+ headers:
+ Cache-Control:
+ $ref: '#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/TaskResponse'
+ examples:
+ example:
+ $ref: '#/components/examples/TaskResponseExample'
+ '400':
+ $ref: '#/components/responses/InvalidRequest'
+ '401':
+ $ref: '#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '404':
+ $ref: '#/components/responses/TaskNotFound'
+ '409':
+ $ref: '#/components/responses/TaskConflict'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ '503':
+ $ref: '#/components/responses/ServiceUnavailable'
+ default:
+ $ref: '#/components/responses/UnexpectedError'
/api/v2/organizations/{organizationId}/transcriptions:
parameters:
- $ref: '#/components/parameters/OrganizationId'
@@ -19401,6 +19494,443 @@ paths:
$ref: '#/components/responses/ServerError'
default:
$ref: '#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/bot-agents:
+ parameters:
+ - $ref: '#/components/parameters/OrganizationId'
+ get:
+ tags:
+ - Agents
+ operationId: listBotAgents
+ summary: List agents
+ description: 'Return one page of the agents the caller can see: the organization''s public agents and the caller''s own private ones, oldest first, and by id among agents made at the same moment. Somebody else''s private agent is never among them. scope=organization lists every agent in the organization, people''s private ones included, for an admin''s screens; it is refused to anybody who is not an admin of the organization. A missing cursor starts at the first page and nextCursor null ends the list.'
+ security:
+ - webSession: []
+ - appOAuth:
+ - bot-agents:read
+ - apiKey: []
+ parameters:
+ - name: scope
+ in: query
+ description: 'Whose agents: caller, the agents the caller can see; organization, every agent in the organization, for an admin of it only.'
+ schema:
+ type: string
+ enum:
+ - caller
+ - organization
+ default: caller
+ - $ref: '#/components/parameters/Limit'
+ - $ref: '#/components/parameters/Cursor'
+ responses:
+ '200':
+ description: One page of agents.
+ headers:
+ Cache-Control:
+ $ref: '#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotAgentPage'
+ examples:
+ lastPage:
+ $ref: '#/components/examples/BotAgentPageLast'
+ '400':
+ $ref: '#/components/responses/InvalidRequest'
+ '401':
+ $ref: '#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '404':
+ $ref: '#/components/responses/OrganizationNotFound'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ default:
+ $ref: '#/components/responses/UnexpectedError'
+ post:
+ tags:
+ - Agents
+ operationId: createBotAgent
+ summary: Add an agent
+ description: Add an agent for Bots to hand work to. kind openbot runs inside OpenBot, on the model given or the organization's default. kind address runs at an AG-UI address, which the server checks before saving; a key, when given, is stored encrypted and never returned. Anybody may add a private agent, for their own Bots; only an admin of the organization may add a public one, which every member's Bots may use. A repeated request with the same Idempotency-Key and body returns the first result.
+ security:
+ - webSession: []
+ - appOAuth:
+ - bot-agents:write
+ - apiKey: []
+ parameters:
+ - $ref: '#/components/parameters/IdempotencyKey'
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CreateBotAgentRequest'
+ examples:
+ openbot:
+ summary: OpenBot's own agent, on a model of its own.
+ value:
+ name: Researcher
+ description: Deep research on the web and in the person's apps, with sources.
+ visibility: public
+ kind: openbot
+ model: null
+ address:
+ summary: An agent somebody runs themselves, behind a key.
+ value:
+ name: Pipeline analyst
+ description: Reads the sales pipeline and forecasts the quarter.
+ visibility: private
+ kind: address
+ endpoint: https://agents.example.com/ag-ui
+ auth:
+ header: Authorization
+ value: Bearer example-key
+ harness: langgraph
+ skills:
+ - name: Forecast
+ description: Forecasts the quarter from the open deals.
+ examples:
+ - What will we close this quarter?
+ responses:
+ '201':
+ description: The agent was added.
+ headers:
+ Cache-Control:
+ $ref: '#/components/headers/PrivateNoStore'
+ Location:
+ description: The new agent's address.
+ schema:
+ type: string
+ example: /api/v2/organizations/default/bot-agents/bag_4f7c1e2a9d0b4c63
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotAgentResponse'
+ examples:
+ created:
+ $ref: '#/components/examples/CreatedBotAgent'
+ '400':
+ $ref: '#/components/responses/InvalidBotAgent'
+ '401':
+ $ref: '#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/BotAgentForbidden'
+ '404':
+ $ref: '#/components/responses/OrganizationNotFound'
+ '409':
+ $ref: '#/components/responses/IdempotencyConflict'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ default:
+ $ref: '#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/bot-agents/{botAgentId}:
+ parameters:
+ - $ref: '#/components/parameters/OrganizationId'
+ - $ref: '#/components/parameters/BotAgentId'
+ get:
+ tags:
+ - Agents
+ operationId: getBotAgent
+ summary: Read one agent
+ description: Return one agent the caller can see. An agent that does not exist, was deleted, or is private to somebody else is not found.
+ security:
+ - webSession: []
+ - appOAuth:
+ - bot-agents:read
+ - apiKey: []
+ responses:
+ '200':
+ description: The agent.
+ headers:
+ Cache-Control:
+ $ref: '#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotAgentResponse'
+ examples:
+ openbot:
+ $ref: '#/components/examples/OpenBotAgent'
+ '400':
+ $ref: '#/components/responses/InvalidRequest'
+ '401':
+ $ref: '#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '404':
+ $ref: '#/components/responses/BotAgentNotFound'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ default:
+ $ref: '#/components/responses/UnexpectedError'
+ patch:
+ tags:
+ - Agents
+ operationId: updateBotAgent
+ summary: Change an agent
+ description: 'Replace an agent''s name, description and visibility, which are all required, and change any optional field that is present. An absent endpoint, key, model or skills leaves that setting as it is, so an edit to a name never drops a key. Only whoever may manage the agent may change it: its owner for a private one, an admin for a public one. Only an admin may make an agent public. kind cannot change. Every Bot that uses the agent runs on the change from its next turn.'
+ security:
+ - webSession: []
+ - appOAuth:
+ - bot-agents:write
+ - apiKey: []
+ parameters:
+ - $ref: '#/components/parameters/IdempotencyKey'
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/UpdateBotAgentRequest'
+ examples:
+ rename:
+ value:
+ name: Research desk
+ description: Deep research on the web and in the person's apps, with sources.
+ visibility: public
+ responses:
+ '200':
+ description: The changed agent.
+ headers:
+ Cache-Control:
+ $ref: '#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotAgentResponse'
+ examples:
+ renamed:
+ $ref: '#/components/examples/CreatedBotAgent'
+ '400':
+ $ref: '#/components/responses/InvalidBotAgent'
+ '401':
+ $ref: '#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/BotAgentForbidden'
+ '404':
+ $ref: '#/components/responses/BotAgentNotFound'
+ '409':
+ $ref: '#/components/responses/IdempotencyConflict'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ default:
+ $ref: '#/components/responses/UnexpectedError'
+ delete:
+ tags:
+ - Agents
+ operationId: deleteBotAgent
+ summary: Delete an agent
+ description: 'Delete an agent and retire its key and callback token. It is taken off every Bot that may use it. Refused, with BOT_AGENT_IN_USE, while it is the only agent of any Bot, deleted Bots aside: give that Bot another agent first. The refusal names those Bots the caller can see and only counts the rest. Only whoever may manage the agent may delete it. Task threads it worked in stay readable. An agent that is already deleted is not found.'
+ security:
+ - webSession: []
+ - appOAuth:
+ - bot-agents:write
+ - apiKey: []
+ parameters:
+ - $ref: '#/components/parameters/IdempotencyKey'
+ responses:
+ '204':
+ description: The agent was deleted.
+ '400':
+ $ref: '#/components/responses/InvalidRequest'
+ '401':
+ $ref: '#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/BotAgentForbidden'
+ '404':
+ $ref: '#/components/responses/BotAgentNotFound'
+ '409':
+ $ref: '#/components/responses/BotAgentInUse'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ default:
+ $ref: '#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/bot-agents/{botAgentId}/issue-callback-token:
+ parameters:
+ - $ref: '#/components/parameters/OrganizationId'
+ - $ref: '#/components/parameters/BotAgentId'
+ post:
+ tags:
+ - Agents
+ operationId: issueBotAgentCallbackToken
+ summary: Issue an agent's callback token
+ description: 'Give an agent at an address a new credential for calling OpenBot''s tools back, and return it this once: it is never returned again, and the audit trail records that one was issued, never what it is. Issuing one for an agent that has one replaces it, which is how a leaked token is retired. A call made with it is allowed only for a run of a Bot that may use this agent, as the person that run is for. Only whoever may manage the agent may issue one. An agent that runs inside OpenBot, or at an address OpenBot runs itself, needs none and is refused.'
+ security:
+ - webSession: []
+ - appOAuth:
+ - bot-agents:write
+ - apiKey: []
+ parameters:
+ - $ref: '#/components/parameters/IdempotencyKey'
+ responses:
+ '200':
+ description: The new token, shown once.
+ headers:
+ Cache-Control:
+ $ref: '#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotAgentCallbackToken'
+ examples:
+ issued:
+ $ref: '#/components/examples/BotAgentCallbackTokenExample'
+ '400':
+ $ref: '#/components/responses/InvalidBotAgent'
+ '401':
+ $ref: '#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/BotAgentForbidden'
+ '404':
+ $ref: '#/components/responses/BotAgentNotFound'
+ '409':
+ $ref: '#/components/responses/IdempotencyConflict'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ default:
+ $ref: '#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/bot-agents/{botAgentId}/revoke-callback-token:
+ parameters:
+ - $ref: '#/components/parameters/OrganizationId'
+ - $ref: '#/components/parameters/BotAgentId'
+ post:
+ tags:
+ - Agents
+ operationId: revokeBotAgentCallbackToken
+ summary: Revoke an agent's callback token
+ description: Take away an agent's credential for calling OpenBot's tools back. It still answers in a conversation; it can't reach anything outside one. Only whoever may manage the agent may revoke it. Revoking a token that is not there changes nothing.
+ security:
+ - webSession: []
+ - appOAuth:
+ - bot-agents:write
+ - apiKey: []
+ parameters:
+ - $ref: '#/components/parameters/IdempotencyKey'
+ responses:
+ '200':
+ description: The agent, with no callback token.
+ headers:
+ Cache-Control:
+ $ref: '#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotAgentResponse'
+ examples:
+ revoked:
+ $ref: '#/components/examples/CreatedBotAgent'
+ '400':
+ $ref: '#/components/responses/InvalidRequest'
+ '401':
+ $ref: '#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/BotAgentForbidden'
+ '404':
+ $ref: '#/components/responses/BotAgentNotFound'
+ '409':
+ $ref: '#/components/responses/IdempotencyConflict'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ default:
+ $ref: '#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/bots/{botId}/delegation:
+ parameters:
+ - $ref: '#/components/parameters/OrganizationId'
+ - $ref: '#/components/parameters/BotId'
+ get:
+ tags:
+ - Agents
+ operationId: getBotDelegation
+ x-openbot-singleton: true
+ summary: Read a Bot's delegation
+ description: 'Return how a Bot the caller can see works: on its own agent (mode self, every Bot made before agents were a list), or handing work to the agents it may use (mode orchestrate). The first agent is its default: a Bot in mode self runs on it, and a Bot in mode orchestrate hands it work the Bot names no agent for and every run nobody is waiting on (a routine, a check-in, a goal, another Bot''s hand-off, a group conversation). Whoever uses a Bot uses its agents: an agent that is private to the Bot''s owner still does the work for everybody the Bot is shared with, and to anybody else it is named Private agent, with its description withheld. An agent that was deleted, or that the Bot''s owner can no longer use, is listed with available false, and the Bot hands it nothing.'
+ security:
+ - webSession: []
+ - appOAuth:
+ - bots:read
+ - apiKey: []
+ responses:
+ '200':
+ description: The Bot's delegation.
+ headers:
+ Cache-Control:
+ $ref: '#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotDelegation'
+ examples:
+ self:
+ $ref: '#/components/examples/SelfBotDelegation'
+ orchestrate:
+ $ref: '#/components/examples/OrchestratingBotDelegation'
+ '400':
+ $ref: '#/components/responses/InvalidRequest'
+ '401':
+ $ref: '#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '404':
+ $ref: '#/components/responses/BotNotFound'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ default:
+ $ref: '#/components/responses/UnexpectedError'
+ put:
+ tags:
+ - Agents
+ operationId: replaceBotDelegation
+ summary: Set a Bot's delegation
+ description: 'Replace how a Bot works. Mode self takes exactly one agent, which the Bot runs on with its apps, as every Bot did before agents were a list. Mode orchestrate takes one to twenty agents, in order, the first being the default: the Bot then answers on its own model with only the tools for replying, reacting, finding a task''s thread and handing work to an agent, plus reading the person''s memory, and each agent works with the Bot''s apps as the person who asked. model and effort are the Bot''s own when it orchestrates, one the model catalogue offers, or null for the organization''s default; they are ignored in mode self. instructions steer how it hands work out and answers, and are read only in mode orchestrate. Every agent named must be one the caller can see, or one the Bot already has. Only whoever may manage the Bot may change it, and a Bot that comes with OpenBot cannot be changed.'
+ security:
+ - webSession: []
+ - appOAuth:
+ - bots:write
+ - apiKey: []
+ parameters:
+ - $ref: '#/components/parameters/IdempotencyKey'
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ReplaceBotDelegationRequest'
+ examples:
+ orchestrate:
+ value:
+ mode: orchestrate
+ model: null
+ effort: null
+ instructions: Hand research to Researcher and anything about the pipeline to Pipeline analyst. Answer greetings yourself.
+ agentIds:
+ - bag_4f7c1e2a9d0b4c63
+ - bag_9a2d7e1c3b5f4086
+ responses:
+ '200':
+ description: The Bot's delegation after the change.
+ headers:
+ Cache-Control:
+ $ref: '#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotDelegation'
+ examples:
+ orchestrate:
+ $ref: '#/components/examples/OrchestratingBotDelegation'
+ '400':
+ $ref: '#/components/responses/InvalidBotDelegation'
+ '401':
+ $ref: '#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/BotForbidden'
+ '404':
+ $ref: '#/components/responses/BotNotFound'
+ '409':
+ $ref: '#/components/responses/IdempotencyConflict'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ default:
+ $ref: '#/components/responses/UnexpectedError'
components:
securitySchemes:
webSession:
@@ -19511,6 +20041,8 @@ components:
learning:write: Approve and reject what Learning proposed and start Learning in the signed-in person's own spaces, change their Learning choices, and for an administrator change the organization's Learning settings and decide sharing requests.
memories:read: Read the signed-in person's memories and memory sources.
memories:write: Write, change and forget the signed-in person's memories, and add, change, sync and remove their memory sources.
+ bot-agents:read: Read the agents the signed-in person's Bots may hand work to, and for an administrator every agent in the organization.
+ bot-agents:write: Add, change and delete the signed-in person's own agents and their callback tokens, and for an administrator the organization's.
apiKey:
type: http
scheme: bearer
@@ -20234,6 +20766,17 @@ components:
maxLength: 200
pattern: \S
example: 0f3a9c2e-7b1d-4e8a-a6c5-2d9e4f1b8c70
+ BotAgentId:
+ name: botAgentId
+ in: path
+ required: true
+ description: The agent's id.
+ schema:
+ type: string
+ minLength: 1
+ maxLength: 200
+ pattern: \S
+ example: bag_4f7c1e2a9d0b4c63
headers:
PrivateNoStore:
description: A Bot is private to the caller.
@@ -23889,6 +24432,22 @@ components:
botId:
type: string
description: The Bot doing it.
+ agent:
+ type:
+ - object
+ - 'null'
+ description: The agent doing the work, when the Bot handed it to one of the agents it may use. Null for a task the Bot does itself, which is every task before agents were a list. Absent from a server that does not name it.
+ additionalProperties: false
+ required:
+ - id
+ - name
+ properties:
+ id:
+ type: string
+ description: The agent's id.
+ name:
+ type: string
+ description: What the agent is called. An agent private to somebody other than the caller is named Private agent.
conversationId:
type: string
description: The task's own conversation, where the person reads it and replies.
@@ -24017,6 +24576,58 @@ components:
properties:
task:
$ref: '#/components/schemas/Task'
+ TaskTurn:
+ type: object
+ description: One finished turn of a task's work, answering one thing it was asked in its conversation.
+ required:
+ - askId
+ - startedAt
+ - endedAt
+ - workedSeconds
+ - runs
+ - model
+ properties:
+ askId:
+ type: string
+ description: The id of the message the turn answered, as the conversation's history names it.
+ startedAt:
+ type: string
+ format: date-time
+ description: When its first run began.
+ endedAt:
+ type: string
+ format: date-time
+ description: When its last run ended.
+ workedSeconds:
+ type: integer
+ minimum: 0
+ description: How long its runs took, added up. A wait on the person between two runs (an approval, a question) is not counted.
+ runs:
+ type: integer
+ minimum: 1
+ description: How many runs it took. More than one when it stopped for the person and carried on after.
+ model:
+ type:
+ - string
+ - 'null'
+ description: The model its last run used. Null when the Bot chooses its own model and did not name it.
+ TaskTurnPage:
+ type: object
+ required:
+ - turns
+ - nextCursor
+ properties:
+ turns:
+ type: array
+ items:
+ $ref: '#/components/schemas/TaskTurn'
+ nextCursor:
+ type:
+ - string
+ - 'null'
+ maxLength: 4096
+ pattern: ^[A-Za-z0-9_-]+$
+ description: Pass as cursor for the next page. Null ends the list. Written in URL-safe base64, the only form the cursor parameter accepts.
TranscriptionUpload:
type: object
required:
@@ -35038,6 +35649,390 @@ components:
maxLength: 4096
pattern: ^[A-Za-z0-9_-]+$
description: Pass as cursor for the next page. Null ends the list. Written in URL-safe base64, the only form the cursor parameter accepts.
+ BotAgentKind:
+ type: string
+ enum:
+ - openbot
+ - address
+ description: 'openbot: runs inside OpenBot. address: runs at an AG-UI address, somebody''s own or a framework OpenBot runs itself.'
+ BotAgentVisibility:
+ type: string
+ enum:
+ - public
+ - private
+ description: 'public: every member''s Bots may use it, and only an admin may make one. private: only its owner''s Bots may use it.'
+ BotAgentSkill:
+ type: object
+ description: One thing the agent is good at, in the shape of an A2A Agent Card's skill. A Bot reads its agents' skills when it decides which to hand work to.
+ additionalProperties: false
+ required:
+ - name
+ - description
+ properties:
+ name:
+ type: string
+ minLength: 1
+ maxLength: 80
+ pattern: \S
+ description: The skill's name, 1 to 80 characters once trimmed.
+ description:
+ type: string
+ minLength: 1
+ maxLength: 500
+ pattern: \S
+ description: What it does, 1 to 500 characters once trimmed.
+ examples:
+ type: array
+ maxItems: 5
+ description: Up to five things a person might ask for that it handles.
+ items:
+ type: string
+ minLength: 1
+ maxLength: 200
+ pattern: \S
+ BotAgent:
+ type: object
+ description: 'An agent as the caller sees it. canManage, mine and builtIn are the server''s verdicts for this caller; a client renders them and never recomputes them. No secret is ever part of an agent: hasAuth and hasCallbackToken say whether one is set.'
+ required:
+ - id
+ - name
+ - description
+ - kind
+ - visibility
+ - endpoint
+ - model
+ - skills
+ - hasAuth
+ - hasCallbackToken
+ - builtIn
+ - canManage
+ - mine
+ - botCount
+ - createdAt
+ - updatedAt
+ properties:
+ id:
+ type: string
+ description: The agent's id.
+ name:
+ type: string
+ description: What the agent is called.
+ description:
+ type: string
+ description: What it is good at, in its owner's words. A Bot reads it when it decides which agent to hand work to.
+ kind:
+ $ref: '#/components/schemas/BotAgentKind'
+ visibility:
+ $ref: '#/components/schemas/BotAgentVisibility'
+ endpoint:
+ type:
+ - string
+ - 'null'
+ description: The AG-UI address it runs at, as it was stored. Null for an agent that runs inside OpenBot.
+ framework:
+ type: string
+ description: What runs it, by the name a person reads ("LangChain", "OpenBot"). Absent when OpenBot doesn't know.
+ model:
+ type:
+ - string
+ - 'null'
+ description: The model it runs on, for an agent whose model is OpenBot's to choose. Null for the organization's default, or for an agent that picks its own.
+ skills:
+ type: array
+ items:
+ $ref: '#/components/schemas/BotAgentSkill'
+ hasAuth:
+ type: boolean
+ description: Whether a key is set for its address. Never the key.
+ hasCallbackToken:
+ type: boolean
+ description: Whether it holds a credential for calling OpenBot's tools back. Never the credential.
+ builtIn:
+ type: boolean
+ description: Whether OpenBot runs it, inside OpenBot or at an address OpenBot started, so it needs no callback token of its own.
+ canManage:
+ type: boolean
+ description: Whether the caller may change and delete it.
+ mine:
+ type: boolean
+ description: Whether the caller added it.
+ botCount:
+ type: integer
+ minimum: 0
+ description: 'How many of the Bots the caller can see may use it, deleted Bots aside. A count only: which Bots is not said. With scope=organization, every Bot in the organization.'
+ createdAt:
+ type: string
+ format: date-time
+ description: When it was added.
+ updatedAt:
+ type: string
+ format: date-time
+ description: When it last changed.
+ BotAgentPage:
+ type: object
+ required:
+ - agents
+ - nextCursor
+ properties:
+ agents:
+ type: array
+ items:
+ $ref: '#/components/schemas/BotAgent'
+ nextCursor:
+ type:
+ - string
+ - 'null'
+ maxLength: 4096
+ pattern: ^[A-Za-z0-9_-]+$
+ description: Pass as cursor for the next page. Null ends the list. Written in URL-safe base64, the only form the cursor parameter accepts.
+ BotAgentName:
+ type: string
+ minLength: 1
+ maxLength: 80
+ pattern: \S
+ description: What the agent is called, 1 to 80 characters once trimmed.
+ BotAgentDescription:
+ type: string
+ minLength: 1
+ maxLength: 1000
+ pattern: \S
+ description: What it is good at, 1 to 1000 characters once trimmed. A Bot reads it when it decides which agent to hand work to, so say what to send it.
+ BotAgentEndpoint:
+ type: string
+ description: 'The AG-UI address it runs at: an absolute http or https address. An address that fits can still be refused: the server refuses one this organization may not reach, and one that does not answer a real AG-UI run.'
+ maxLength: 2048
+ format: uri
+ pattern: ^[Hh][Tt][Tt][Pp][Ss]?://
+ BotAgentKey:
+ type: object
+ description: 'A key the agent''s address sits behind. Write-only: stored encrypted and never returned. A blank value sets no key.'
+ additionalProperties: false
+ required:
+ - value
+ properties:
+ header:
+ type: string
+ maxLength: 200
+ pattern: ^[A-Za-z0-9-]*$
+ description: The header it is sent in. Blank or absent means Authorization.
+ value:
+ type: string
+ maxLength: 8000
+ writeOnly: true
+ description: The header's value.
+ BotAgentHarness:
+ type: string
+ description: The framework an agent at an address is built on, by its id in OpenBot's harness list (shared/harnesses.json). Empty means none was named. Kept only for kind address.
+ enum:
+ - ''
+ - crewai
+ - llamaindex
+ - agno
+ - langgraph
+ - google-adk
+ - antigravity
+ - pydantic-ai
+ - microsoft-agent-framework
+ - claude-agent-sdk
+ - strands
+ - ag2
+ - langroid
+ - mastra
+ BotAgentModel:
+ type:
+ - string
+ - 'null'
+ minLength: 1
+ maxLength: 500
+ pattern: \S
+ description: A model the catalogue offers, or null for the organization's default. Read only for an agent whose model is OpenBot's to choose.
+ BotAgentSkills:
+ type: array
+ maxItems: 20
+ description: Up to twenty things it is good at. Absent on a change leaves them as they are.
+ items:
+ $ref: '#/components/schemas/BotAgentSkill'
+ CreateBotAgentRequest:
+ type: object
+ description: A new agent. endpoint is required for kind address and refused for kind openbot.
+ additionalProperties: false
+ required:
+ - name
+ - description
+ - visibility
+ - kind
+ properties:
+ name:
+ $ref: '#/components/schemas/BotAgentName'
+ description:
+ $ref: '#/components/schemas/BotAgentDescription'
+ visibility:
+ $ref: '#/components/schemas/BotAgentVisibility'
+ kind:
+ $ref: '#/components/schemas/BotAgentKind'
+ endpoint:
+ $ref: '#/components/schemas/BotAgentEndpoint'
+ auth:
+ $ref: '#/components/schemas/BotAgentKey'
+ harness:
+ $ref: '#/components/schemas/BotAgentHarness'
+ model:
+ $ref: '#/components/schemas/BotAgentModel'
+ skills:
+ $ref: '#/components/schemas/BotAgentSkills'
+ BotAgentResponse:
+ type: object
+ required:
+ - agent
+ properties:
+ agent:
+ $ref: '#/components/schemas/BotAgent'
+ UpdateBotAgentRequest:
+ type: object
+ description: An agent's fields after the change. Absent optional fields stay as they are.
+ additionalProperties: false
+ required:
+ - name
+ - description
+ - visibility
+ properties:
+ name:
+ $ref: '#/components/schemas/BotAgentName'
+ description:
+ $ref: '#/components/schemas/BotAgentDescription'
+ visibility:
+ $ref: '#/components/schemas/BotAgentVisibility'
+ endpoint:
+ $ref: '#/components/schemas/BotAgentEndpoint'
+ auth:
+ $ref: '#/components/schemas/BotAgentKey'
+ model:
+ $ref: '#/components/schemas/BotAgentModel'
+ skills:
+ $ref: '#/components/schemas/BotAgentSkills'
+ BotAgentCallbackToken:
+ type: object
+ required:
+ - token
+ properties:
+ token:
+ type: string
+ minLength: 1
+ description: The agent's credential for calling OpenBot's tools back. Returned this once and never again.
+ BotDelegationMode:
+ type: string
+ enum:
+ - self
+ - orchestrate
+ description: 'self: the Bot runs on its one agent with its apps. orchestrate: the Bot answers on its own model and hands work to the agents it may use.'
+ BotDelegationAgent:
+ type: object
+ description: One agent a Bot may use, as the caller sees it.
+ required:
+ - id
+ - name
+ - description
+ - kind
+ - available
+ properties:
+ id:
+ type: string
+ description: The agent's id.
+ name:
+ type: string
+ description: What the agent is called. An agent private to somebody other than the caller is named Private agent.
+ description:
+ type: string
+ description: What it is good at. Empty for an agent private to somebody other than the caller.
+ kind:
+ $ref: '#/components/schemas/BotAgentKind'
+ framework:
+ type: string
+ description: What runs it, by the name a person reads. Absent when OpenBot doesn't know.
+ available:
+ type: boolean
+ description: 'Whether the Bot may still hand it work: false once the agent is deleted, or private to somebody other than the Bot''s owner.'
+ BotDelegation:
+ type: object
+ description: How a Bot works, and the agents it may use, the first being its default.
+ required:
+ - botId
+ - mode
+ - model
+ - effort
+ - instructions
+ - agents
+ - canManage
+ properties:
+ botId:
+ type: string
+ description: The Bot's id.
+ mode:
+ $ref: '#/components/schemas/BotDelegationMode'
+ model:
+ type:
+ - string
+ - 'null'
+ description: The model the Bot answers on when it orchestrates, or null for the organization's default.
+ effort:
+ type:
+ - string
+ - 'null'
+ description: How hard it thinks when it orchestrates, or null for the model's own.
+ instructions:
+ type: string
+ description: How it hands work out and answers when it orchestrates. May be empty. Empty for a caller who can't change the Bot, since it can name an agent private to its owner.
+ agents:
+ type: array
+ minItems: 1
+ items:
+ $ref: '#/components/schemas/BotDelegationAgent'
+ canManage:
+ type: boolean
+ description: Whether the caller may change it.
+ ReplaceBotDelegationRequest:
+ type: object
+ additionalProperties: false
+ required:
+ - mode
+ - model
+ - effort
+ - instructions
+ - agentIds
+ properties:
+ mode:
+ $ref: '#/components/schemas/BotDelegationMode'
+ model:
+ type:
+ - string
+ - 'null'
+ minLength: 1
+ maxLength: 500
+ pattern: \S
+ description: A model the catalogue offers, or null for the default. Trimmed.
+ effort:
+ type:
+ - string
+ - 'null'
+ minLength: 1
+ maxLength: 40
+ pattern: \S
+ description: An effort the model takes, or null for its own. Trimmed, and read in lower case.
+ instructions:
+ type: string
+ maxLength: 4000
+ description: How it hands work out and answers, up to 4000 characters. May be empty.
+ agentIds:
+ type: array
+ minItems: 1
+ maxItems: 20
+ uniqueItems: true
+ description: The agents it may use, in order, the first being its default. Exactly one in mode self.
+ items:
+ type: string
+ minLength: 1
+ maxLength: 200
+ pattern: \S
responses:
InvalidRequest:
description: A parameter is malformed.
@@ -40048,6 +41043,129 @@ components:
retryable: false
requestId: req_example
traceId: trace_example
+ InvalidBotAgent:
+ description: A field is missing or out of bounds, kind and endpoint don't agree, the address is one this organization may not reach or did not answer a real AG-UI run, the model is not one the catalogue offers, or the agent runs inside OpenBot and so takes no callback token.
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ examples:
+ description:
+ value:
+ type: https://open.bot/errors/validation-error
+ title: Request validation failed.
+ status: 400
+ detail: Say what this agent is good at, so your Bots know what to send it.
+ code: VALIDATION_ERROR
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ unreachable:
+ value:
+ type: https://open.bot/errors/bot-agent-unreachable
+ title: Couldn't reach that agent.
+ status: 400
+ detail: Couldn't reach an agent at that address. Check the address and its key, then try again.
+ code: BOT_AGENT_UNREACHABLE
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ BotAgentForbidden:
+ description: The caller may not manage this agent, or only an admin may make an agent public.
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ examples:
+ notYours:
+ value:
+ type: https://open.bot/errors/permission-denied
+ title: You can't manage this agent.
+ status: 403
+ detail: You can't manage this agent.
+ code: PERMISSION_DENIED
+ category: permission
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ publicAdminOnly:
+ value:
+ type: https://open.bot/errors/permission-denied
+ title: Only an admin can share an agent with everyone.
+ status: 403
+ detail: Only an admin can share an agent with everyone. Keep it private to use it with your own Bots.
+ code: PERMISSION_DENIED
+ category: permission
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ BotAgentNotFound:
+ description: The agent does not exist, was deleted, or is not visible to the caller, or the organization is not.
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ examples:
+ missing:
+ value:
+ type: https://open.bot/errors/bot-agent-not-found
+ title: Agent not found.
+ status: 404
+ detail: Couldn't find that agent.
+ code: BOT_AGENT_NOT_FOUND
+ category: not_found
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ BotAgentInUse:
+ description: The agent is the only agent of a Bot, or a repeated request with the same Idempotency-Key had a different body.
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ examples:
+ onlyAgent:
+ value:
+ type: https://open.bot/errors/bot-agent-in-use
+ title: A Bot runs on this agent alone.
+ status: 409
+ detail: Quote Checker and 1 other Bot run on this agent alone. Give them another agent first, then delete this one.
+ code: BOT_AGENT_IN_USE
+ category: conflict
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ InvalidBotDelegation:
+ description: A field is missing or out of bounds, mode self names other than one agent, an agent named is not one the caller can see, or the model or effort is not one the catalogue offers.
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ examples:
+ selfTakesOne:
+ value:
+ type: https://open.bot/errors/validation-error
+ title: Request validation failed.
+ status: 400
+ detail: A Bot that works on its own runs on one agent. Turn on handing work to agents to choose more.
+ code: VALIDATION_ERROR
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ unknownAgent:
+ value:
+ type: https://open.bot/errors/validation-error
+ title: Request validation failed.
+ status: 400
+ detail: Couldn't find one of those agents. Choose from the agents you can see.
+ code: VALIDATION_ERROR
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
examples:
ReactionPageLast:
summary: Every reaction in a conversation, on one page.
@@ -41013,6 +42131,17 @@ components:
resolvedAt: null
createdAt: '2026-11-14T09:00:00.000Z'
updatedAt: '2026-11-14T09:05:00.000Z'
+ TaskTurnPageExample:
+ summary: 'One turn: the Bot''s brief, worked on for 52 seconds.'
+ value:
+ turns:
+ - askId: 3a1c9e2b-5d40-4f7a-8b61-0e9d2c4f7a13
+ startedAt: '2026-11-14T09:00:02.000Z'
+ endedAt: '2026-11-14T09:00:54.000Z'
+ workedSeconds: 52
+ runs: 1
+ model: gpt-5.1
+ nextCursor: null
TranscriptionExample:
summary: What was said.
value:
@@ -43928,3 +45057,113 @@ components:
query:
type: string
nextCursor: null
+ BotAgentPageLast:
+ summary: The last page.
+ value:
+ agents:
+ - id: bag_0c51d9e3a7f24b18
+ name: OpenBot
+ description: OpenBot's own agent, with every app and component the Bot may use.
+ kind: openbot
+ visibility: public
+ endpoint: null
+ framework: OpenBot
+ model: null
+ skills: []
+ hasAuth: false
+ hasCallbackToken: false
+ builtIn: true
+ canManage: false
+ mine: false
+ botCount: 4
+ createdAt: '2026-11-16T09:00:00Z'
+ updatedAt: '2026-11-16T09:00:00Z'
+ nextCursor: null
+ CreatedBotAgent:
+ summary: An agent a person added at their own address.
+ value:
+ agent:
+ id: bag_4f7c1e2a9d0b4c63
+ name: Pipeline analyst
+ description: Reads the sales pipeline and forecasts the quarter.
+ kind: address
+ visibility: private
+ endpoint: https://agents.example.com/ag-ui
+ framework: LangChain
+ model: null
+ skills:
+ - name: Forecast
+ description: Forecasts the quarter from the open deals.
+ examples:
+ - What will we close this quarter?
+ hasAuth: true
+ hasCallbackToken: false
+ builtIn: false
+ canManage: true
+ mine: true
+ botCount: 0
+ createdAt: '2026-11-16T09:30:00Z'
+ updatedAt: '2026-11-16T09:30:00Z'
+ OpenBotAgent:
+ summary: OpenBot's own agent.
+ value:
+ agent:
+ id: bag_0c51d9e3a7f24b18
+ name: OpenBot
+ description: OpenBot's own agent, with every app and component the Bot may use.
+ kind: openbot
+ visibility: public
+ endpoint: null
+ framework: OpenBot
+ model: null
+ skills: []
+ hasAuth: false
+ hasCallbackToken: false
+ builtIn: true
+ canManage: false
+ mine: false
+ botCount: 4
+ createdAt: '2026-11-16T09:00:00Z'
+ updatedAt: '2026-11-16T09:00:00Z'
+ BotAgentCallbackTokenExample:
+ summary: A new token.
+ value:
+ token: obot_agt_7f3a9c2e5d1b4f60a8e2c9d4b1f7e3a6c0d9
+ SelfBotDelegation:
+ summary: A Bot that runs on its own agent, as every Bot did before agents were a list.
+ value:
+ botId: agent_9b1c6f0e-7f0e-4c1e-9d55-2f4a8c1b6e21
+ mode: self
+ model: null
+ effort: null
+ instructions: ''
+ agents:
+ - id: bag_0c51d9e3a7f24b18
+ name: OpenBot
+ description: OpenBot's own agent, with every app and component the Bot may use.
+ kind: openbot
+ framework: OpenBot
+ available: true
+ canManage: true
+ OrchestratingBotDelegation:
+ summary: A Bot that hands work to two agents.
+ value:
+ botId: agent_9b1c6f0e-7f0e-4c1e-9d55-2f4a8c1b6e21
+ mode: orchestrate
+ model: null
+ effort: null
+ instructions: Hand research to Researcher and anything about the pipeline to Pipeline analyst. Answer greetings yourself.
+ agents:
+ - id: bag_4f7c1e2a9d0b4c63
+ name: Researcher
+ description: Deep research on the web and in the person's apps, with sources.
+ kind: openbot
+ framework: OpenBot
+ available: true
+ - id: bag_9a2d7e1c3b5f4086
+ name: Pipeline analyst
+ description: Reads the sales pipeline and forecasts the quarter.
+ kind: address
+ framework: LangChain
+ available: true
+ canManage: true
diff --git a/api/openapi/agents.yaml b/api/openapi/agents.yaml
new file mode 100644
index 0000000000..a283227867
--- /dev/null
+++ b/api/openapi/agents.yaml
@@ -0,0 +1,1146 @@
+# Agents: the agents an organization's Bots hand work to, and each Bot's delegation.
+#
+# One area of OpenBot's REST API. `bun run api:bundle` joins every area with common.yaml into
+# api/openapi.yaml, the file every client and check reads. See api/README.md.
+#
+# The path noun is `bot-agents`, not `agents`: Intelligence's API already uses `agentId` for the
+# runtime agent a thread ran on (in OpenBot, a Bot), and names under an organization that are not a
+# Bot's could one day be Intelligence's. Intelligence has no Bots, so a `bot-` name cannot collide.
+paths:
+ /api/v2/organizations/{organizationId}/bot-agents:
+ parameters:
+ - $ref: './common.yaml#/components/parameters/OrganizationId'
+ get:
+ tags: [Agents]
+ operationId: listBotAgents
+ summary: List agents
+ description: >-
+ Return one page of the agents the caller can see: the organization's
+ public agents and the caller's own private ones, oldest first, and by
+ id among agents made at the same moment. Somebody else's private agent
+ is never among them. scope=organization lists every agent in the
+ organization, people's private ones included, for an admin's screens;
+ it is refused to anybody who is not an admin of the organization. A
+ missing cursor starts at the first page and nextCursor null ends the
+ list.
+ security:
+ - webSession: []
+ - appOAuth: [bot-agents:read]
+ - apiKey: []
+ parameters:
+ - name: scope
+ in: query
+ description: >-
+ Whose agents: caller, the agents the caller can see; organization,
+ every agent in the organization, for an admin of it only.
+ schema:
+ type: string
+ enum: [caller, organization]
+ default: caller
+ - $ref: './common.yaml#/components/parameters/Limit'
+ - $ref: './common.yaml#/components/parameters/Cursor'
+ responses:
+ '200':
+ description: One page of agents.
+ headers:
+ Cache-Control:
+ $ref: './common.yaml#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotAgentPage'
+ examples:
+ lastPage:
+ $ref: '#/components/examples/BotAgentPageLast'
+ '400':
+ $ref: './common.yaml#/components/responses/InvalidRequest'
+ '401':
+ $ref: './common.yaml#/components/responses/Unauthenticated'
+ '403':
+ $ref: './common.yaml#/components/responses/Forbidden'
+ '404':
+ $ref: './common.yaml#/components/responses/OrganizationNotFound'
+ '500':
+ $ref: './common.yaml#/components/responses/ServerError'
+ default:
+ $ref: './common.yaml#/components/responses/UnexpectedError'
+ post:
+ tags: [Agents]
+ operationId: createBotAgent
+ summary: Add an agent
+ description: >-
+ Add an agent for Bots to hand work to. kind openbot runs inside
+ OpenBot, on the model given or the organization's default. kind
+ address runs at an AG-UI address, which the server checks before
+ saving; a key, when given, is stored encrypted and never returned.
+ Anybody may add a private agent, for their own Bots; only an admin of
+ the organization may add a public one, which every member's Bots may
+ use. A repeated request with the same Idempotency-Key and body returns
+ the first result.
+ security:
+ - webSession: []
+ - appOAuth: [bot-agents:write]
+ - apiKey: []
+ parameters:
+ - $ref: './common.yaml#/components/parameters/IdempotencyKey'
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CreateBotAgentRequest'
+ examples:
+ openbot:
+ summary: OpenBot's own agent, on a model of its own.
+ value:
+ name: Researcher
+ description: Deep research on the web and in the person's apps, with sources.
+ visibility: public
+ kind: openbot
+ model: null
+ address:
+ summary: An agent somebody runs themselves, behind a key.
+ value:
+ name: Pipeline analyst
+ description: Reads the sales pipeline and forecasts the quarter.
+ visibility: private
+ kind: address
+ endpoint: https://agents.example.com/ag-ui
+ auth:
+ header: Authorization
+ value: Bearer example-key
+ harness: langgraph
+ skills:
+ - name: Forecast
+ description: Forecasts the quarter from the open deals.
+ examples: [What will we close this quarter?]
+ responses:
+ '201':
+ description: The agent was added.
+ headers:
+ Cache-Control:
+ $ref: './common.yaml#/components/headers/PrivateNoStore'
+ Location:
+ description: The new agent's address.
+ schema:
+ type: string
+ example: /api/v2/organizations/default/bot-agents/bag_4f7c1e2a9d0b4c63
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotAgentResponse'
+ examples:
+ created:
+ $ref: '#/components/examples/CreatedBotAgent'
+ '400':
+ $ref: '#/components/responses/InvalidBotAgent'
+ '401':
+ $ref: './common.yaml#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/BotAgentForbidden'
+ '404':
+ $ref: './common.yaml#/components/responses/OrganizationNotFound'
+ '409':
+ $ref: './common.yaml#/components/responses/IdempotencyConflict'
+ '500':
+ $ref: './common.yaml#/components/responses/ServerError'
+ default:
+ $ref: './common.yaml#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/bot-agents/{botAgentId}:
+ parameters:
+ - $ref: './common.yaml#/components/parameters/OrganizationId'
+ - $ref: '#/components/parameters/BotAgentId'
+ get:
+ tags: [Agents]
+ operationId: getBotAgent
+ summary: Read one agent
+ description: >-
+ Return one agent the caller can see. An agent that does not exist, was
+ deleted, or is private to somebody else is not found.
+ security:
+ - webSession: []
+ - appOAuth: [bot-agents:read]
+ - apiKey: []
+ responses:
+ '200':
+ description: The agent.
+ headers:
+ Cache-Control:
+ $ref: './common.yaml#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotAgentResponse'
+ examples:
+ openbot:
+ $ref: '#/components/examples/OpenBotAgent'
+ '400':
+ $ref: './common.yaml#/components/responses/InvalidRequest'
+ '401':
+ $ref: './common.yaml#/components/responses/Unauthenticated'
+ '403':
+ $ref: './common.yaml#/components/responses/Forbidden'
+ '404':
+ $ref: '#/components/responses/BotAgentNotFound'
+ '500':
+ $ref: './common.yaml#/components/responses/ServerError'
+ default:
+ $ref: './common.yaml#/components/responses/UnexpectedError'
+ patch:
+ tags: [Agents]
+ operationId: updateBotAgent
+ summary: Change an agent
+ description: >-
+ Replace an agent's name, description and visibility, which are all
+ required, and change any optional field that is present. An absent
+ endpoint, key, model or skills leaves that setting as it is, so an edit
+ to a name never drops a key. Only whoever may manage the agent may
+ change it: its owner for a private one, an admin for a public one.
+ Only an admin may make an agent public. kind cannot change. Every Bot
+ that uses the agent runs on the change from its next turn.
+ security:
+ - webSession: []
+ - appOAuth: [bot-agents:write]
+ - apiKey: []
+ parameters:
+ - $ref: './common.yaml#/components/parameters/IdempotencyKey'
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/UpdateBotAgentRequest'
+ examples:
+ rename:
+ value:
+ name: Research desk
+ description: Deep research on the web and in the person's apps, with sources.
+ visibility: public
+ responses:
+ '200':
+ description: The changed agent.
+ headers:
+ Cache-Control:
+ $ref: './common.yaml#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotAgentResponse'
+ examples:
+ renamed:
+ $ref: '#/components/examples/CreatedBotAgent'
+ '400':
+ $ref: '#/components/responses/InvalidBotAgent'
+ '401':
+ $ref: './common.yaml#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/BotAgentForbidden'
+ '404':
+ $ref: '#/components/responses/BotAgentNotFound'
+ '409':
+ $ref: './common.yaml#/components/responses/IdempotencyConflict'
+ '500':
+ $ref: './common.yaml#/components/responses/ServerError'
+ default:
+ $ref: './common.yaml#/components/responses/UnexpectedError'
+ delete:
+ tags: [Agents]
+ operationId: deleteBotAgent
+ summary: Delete an agent
+ description: >-
+ Delete an agent and retire its key and callback token. It is taken off
+ every Bot that may use it. Refused, with BOT_AGENT_IN_USE, while it is
+ the only agent of any Bot, deleted Bots aside: give that Bot another
+ agent first. The refusal names those Bots the caller can see and
+ only counts the rest. Only whoever may manage the agent may delete it. Task
+ threads it worked in stay readable. An agent that is already deleted
+ is not found.
+ security:
+ - webSession: []
+ - appOAuth: [bot-agents:write]
+ - apiKey: []
+ parameters:
+ - $ref: './common.yaml#/components/parameters/IdempotencyKey'
+ responses:
+ '204':
+ description: The agent was deleted.
+ '400':
+ $ref: './common.yaml#/components/responses/InvalidRequest'
+ '401':
+ $ref: './common.yaml#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/BotAgentForbidden'
+ '404':
+ $ref: '#/components/responses/BotAgentNotFound'
+ '409':
+ $ref: '#/components/responses/BotAgentInUse'
+ '500':
+ $ref: './common.yaml#/components/responses/ServerError'
+ default:
+ $ref: './common.yaml#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/bot-agents/{botAgentId}/issue-callback-token:
+ parameters:
+ - $ref: './common.yaml#/components/parameters/OrganizationId'
+ - $ref: '#/components/parameters/BotAgentId'
+ post:
+ tags: [Agents]
+ operationId: issueBotAgentCallbackToken
+ summary: Issue an agent's callback token
+ description: >-
+ Give an agent at an address a new credential for calling OpenBot's
+ tools back, and return it this once: it is never returned again, and
+ the audit trail records that one was issued, never what it is. Issuing
+ one for an agent that has one replaces it, which is how a leaked token
+ is retired. A call made with it is allowed only for a run of a Bot
+ that may use this agent, as the person that run is for. Only whoever
+ may manage the agent may issue one. An agent that runs inside OpenBot,
+ or at an address OpenBot runs itself, needs none and is refused.
+ security:
+ - webSession: []
+ - appOAuth: [bot-agents:write]
+ - apiKey: []
+ parameters:
+ - $ref: './common.yaml#/components/parameters/IdempotencyKey'
+ responses:
+ '200':
+ description: The new token, shown once.
+ headers:
+ Cache-Control:
+ $ref: './common.yaml#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotAgentCallbackToken'
+ examples:
+ issued:
+ $ref: '#/components/examples/BotAgentCallbackTokenExample'
+ '400':
+ $ref: '#/components/responses/InvalidBotAgent'
+ '401':
+ $ref: './common.yaml#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/BotAgentForbidden'
+ '404':
+ $ref: '#/components/responses/BotAgentNotFound'
+ '409':
+ $ref: './common.yaml#/components/responses/IdempotencyConflict'
+ '500':
+ $ref: './common.yaml#/components/responses/ServerError'
+ default:
+ $ref: './common.yaml#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/bot-agents/{botAgentId}/revoke-callback-token:
+ parameters:
+ - $ref: './common.yaml#/components/parameters/OrganizationId'
+ - $ref: '#/components/parameters/BotAgentId'
+ post:
+ tags: [Agents]
+ operationId: revokeBotAgentCallbackToken
+ summary: Revoke an agent's callback token
+ description: >-
+ Take away an agent's credential for calling OpenBot's tools back. It
+ still answers in a conversation; it can't reach anything outside one.
+ Only whoever may manage the agent may revoke it. Revoking a token that
+ is not there changes nothing.
+ security:
+ - webSession: []
+ - appOAuth: [bot-agents:write]
+ - apiKey: []
+ parameters:
+ - $ref: './common.yaml#/components/parameters/IdempotencyKey'
+ responses:
+ '200':
+ description: The agent, with no callback token.
+ headers:
+ Cache-Control:
+ $ref: './common.yaml#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotAgentResponse'
+ examples:
+ revoked:
+ $ref: '#/components/examples/CreatedBotAgent'
+ '400':
+ $ref: './common.yaml#/components/responses/InvalidRequest'
+ '401':
+ $ref: './common.yaml#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/BotAgentForbidden'
+ '404':
+ $ref: '#/components/responses/BotAgentNotFound'
+ '409':
+ $ref: './common.yaml#/components/responses/IdempotencyConflict'
+ '500':
+ $ref: './common.yaml#/components/responses/ServerError'
+ default:
+ $ref: './common.yaml#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/bots/{botId}/delegation:
+ parameters:
+ - $ref: './common.yaml#/components/parameters/OrganizationId'
+ - $ref: './common.yaml#/components/parameters/BotId'
+ get:
+ tags: [Agents]
+ operationId: getBotDelegation
+ x-openbot-singleton: true
+ summary: Read a Bot's delegation
+ description: >-
+ Return how a Bot the caller can see works: on its own agent (mode
+ self, every Bot made before agents were a list), or handing work to
+ the agents it may use (mode orchestrate). The first agent is its
+ default: a Bot in mode self runs on it, and a Bot in mode orchestrate
+ hands it work the Bot names no agent for and every run nobody is
+ waiting on (a routine, a check-in, a goal, another Bot's hand-off, a
+ group conversation). Whoever uses a Bot uses its agents: an agent that
+ is private to the Bot's owner still does the work for everybody the
+ Bot is shared with, and to anybody else it is named Private agent,
+ with its description withheld. An agent that was deleted, or that the
+ Bot's owner can no longer use, is listed with available false, and
+ the Bot hands it nothing.
+ security:
+ - webSession: []
+ - appOAuth: [bots:read]
+ - apiKey: []
+ responses:
+ '200':
+ description: The Bot's delegation.
+ headers:
+ Cache-Control:
+ $ref: './common.yaml#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotDelegation'
+ examples:
+ self:
+ $ref: '#/components/examples/SelfBotDelegation'
+ orchestrate:
+ $ref: '#/components/examples/OrchestratingBotDelegation'
+ '400':
+ $ref: './common.yaml#/components/responses/InvalidRequest'
+ '401':
+ $ref: './common.yaml#/components/responses/Unauthenticated'
+ '403':
+ $ref: './common.yaml#/components/responses/Forbidden'
+ '404':
+ $ref: './common.yaml#/components/responses/BotNotFound'
+ '500':
+ $ref: './common.yaml#/components/responses/ServerError'
+ default:
+ $ref: './common.yaml#/components/responses/UnexpectedError'
+ put:
+ tags: [Agents]
+ operationId: replaceBotDelegation
+ summary: Set a Bot's delegation
+ description: >-
+ Replace how a Bot works. Mode self takes exactly one agent, which the
+ Bot runs on with its apps, as every Bot did before agents were a list.
+ Mode orchestrate takes one to twenty agents, in order, the first being
+ the default: the Bot then answers on its own model with only the tools
+ for replying, reacting, finding a task's thread and handing work to an
+ agent, plus reading the person's memory, and each agent works with the
+ Bot's apps as the person who asked. model and effort are the Bot's own
+ when it orchestrates, one the model catalogue offers, or null for the
+ organization's default; they are ignored in mode self. instructions
+ steer how it hands work out and answers, and are read only in mode
+ orchestrate. Every agent named must be one the caller can see, or one
+ the Bot already has. Only
+ whoever may manage the Bot may change it, and a Bot that comes with
+ OpenBot cannot be changed.
+ security:
+ - webSession: []
+ - appOAuth: [bots:write]
+ - apiKey: []
+ parameters:
+ - $ref: './common.yaml#/components/parameters/IdempotencyKey'
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ReplaceBotDelegationRequest'
+ examples:
+ orchestrate:
+ value:
+ mode: orchestrate
+ model: null
+ effort: null
+ instructions: Hand research to Researcher and anything about the pipeline to Pipeline analyst. Answer greetings yourself.
+ agentIds: [bag_4f7c1e2a9d0b4c63, bag_9a2d7e1c3b5f4086]
+ responses:
+ '200':
+ description: The Bot's delegation after the change.
+ headers:
+ Cache-Control:
+ $ref: './common.yaml#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BotDelegation'
+ examples:
+ orchestrate:
+ $ref: '#/components/examples/OrchestratingBotDelegation'
+ '400':
+ $ref: '#/components/responses/InvalidBotDelegation'
+ '401':
+ $ref: './common.yaml#/components/responses/Unauthenticated'
+ '403':
+ $ref: './common.yaml#/components/responses/BotForbidden'
+ '404':
+ $ref: './common.yaml#/components/responses/BotNotFound'
+ '409':
+ $ref: './common.yaml#/components/responses/IdempotencyConflict'
+ '500':
+ $ref: './common.yaml#/components/responses/ServerError'
+ default:
+ $ref: './common.yaml#/components/responses/UnexpectedError'
+components:
+ parameters:
+ BotAgentId:
+ name: botAgentId
+ in: path
+ required: true
+ description: The agent's id.
+ schema:
+ type: string
+ minLength: 1
+ maxLength: 200
+ pattern: \S
+ example: bag_4f7c1e2a9d0b4c63
+ schemas:
+ BotAgentKind:
+ type: string
+ enum: [openbot, address]
+ description: >-
+ openbot: runs inside OpenBot. address: runs at an AG-UI address,
+ somebody's own or a framework OpenBot runs itself.
+ BotAgentVisibility:
+ type: string
+ enum: [public, private]
+ description: >-
+ public: every member's Bots may use it, and only an admin may make one.
+ private: only its owner's Bots may use it.
+ BotAgentSkill:
+ type: object
+ description: >-
+ One thing the agent is good at, in the shape of an A2A Agent Card's
+ skill. A Bot reads its agents' skills when it decides which to hand
+ work to.
+ additionalProperties: false
+ required: [name, description]
+ properties:
+ name:
+ type: string
+ minLength: 1
+ maxLength: 80
+ pattern: \S
+ description: The skill's name, 1 to 80 characters once trimmed.
+ description:
+ type: string
+ minLength: 1
+ maxLength: 500
+ pattern: \S
+ description: What it does, 1 to 500 characters once trimmed.
+ examples:
+ type: array
+ maxItems: 5
+ description: Up to five things a person might ask for that it handles.
+ items:
+ type: string
+ minLength: 1
+ maxLength: 200
+ pattern: \S
+ BotAgent:
+ type: object
+ description: >-
+ An agent as the caller sees it. canManage, mine and builtIn are the
+ server's verdicts for this caller; a client renders them and never
+ recomputes them. No secret is ever part of an agent: hasAuth and
+ hasCallbackToken say whether one is set.
+ required:
+ - id
+ - name
+ - description
+ - kind
+ - visibility
+ - endpoint
+ - model
+ - skills
+ - hasAuth
+ - hasCallbackToken
+ - builtIn
+ - canManage
+ - mine
+ - botCount
+ - createdAt
+ - updatedAt
+ properties:
+ id:
+ type: string
+ description: The agent's id.
+ name:
+ type: string
+ description: What the agent is called.
+ description:
+ type: string
+ description: >-
+ What it is good at, in its owner's words. A Bot reads it when it
+ decides which agent to hand work to.
+ kind:
+ $ref: '#/components/schemas/BotAgentKind'
+ visibility:
+ $ref: '#/components/schemas/BotAgentVisibility'
+ endpoint:
+ type: [string, 'null']
+ description: >-
+ The AG-UI address it runs at, as it was stored. Null for an agent
+ that runs inside OpenBot.
+ framework:
+ type: string
+ description: >-
+ What runs it, by the name a person reads ("LangChain", "OpenBot").
+ Absent when OpenBot doesn't know.
+ model:
+ type: [string, 'null']
+ description: >-
+ The model it runs on, for an agent whose model is OpenBot's to
+ choose. Null for the organization's default, or for an agent that
+ picks its own.
+ skills:
+ type: array
+ items:
+ $ref: '#/components/schemas/BotAgentSkill'
+ hasAuth:
+ type: boolean
+ description: Whether a key is set for its address. Never the key.
+ hasCallbackToken:
+ type: boolean
+ description: >-
+ Whether it holds a credential for calling OpenBot's tools back.
+ Never the credential.
+ builtIn:
+ type: boolean
+ description: >-
+ Whether OpenBot runs it, inside OpenBot or at an address OpenBot
+ started, so it needs no callback token of its own.
+ canManage:
+ type: boolean
+ description: Whether the caller may change and delete it.
+ mine:
+ type: boolean
+ description: Whether the caller added it.
+ botCount:
+ type: integer
+ minimum: 0
+ description: >-
+ How many of the Bots the caller can see may use it, deleted Bots
+ aside. A count only: which Bots is not said. With
+ scope=organization, every Bot in the organization.
+ createdAt:
+ type: string
+ format: date-time
+ description: When it was added.
+ updatedAt:
+ type: string
+ format: date-time
+ description: When it last changed.
+ BotAgentPage:
+ type: object
+ required: [agents, nextCursor]
+ properties:
+ agents:
+ type: array
+ items:
+ $ref: '#/components/schemas/BotAgent'
+ nextCursor:
+ type: [string, 'null']
+ maxLength: 4096
+ pattern: ^[A-Za-z0-9_-]+$
+ description: >-
+ Pass as cursor for the next page. Null ends the list. Written in
+ URL-safe base64, the only form the cursor parameter accepts.
+ BotAgentResponse:
+ type: object
+ required: [agent]
+ properties:
+ agent:
+ $ref: '#/components/schemas/BotAgent'
+ BotAgentKey:
+ type: object
+ description: >-
+ A key the agent's address sits behind. Write-only: stored encrypted and
+ never returned. A blank value sets no key.
+ additionalProperties: false
+ required: [value]
+ properties:
+ header:
+ type: string
+ maxLength: 200
+ pattern: ^[A-Za-z0-9-]*$
+ description: The header it is sent in. Blank or absent means Authorization.
+ value:
+ type: string
+ maxLength: 8000
+ writeOnly: true
+ description: The header's value.
+ BotAgentName:
+ type: string
+ minLength: 1
+ maxLength: 80
+ pattern: \S
+ description: What the agent is called, 1 to 80 characters once trimmed.
+ BotAgentDescription:
+ type: string
+ minLength: 1
+ maxLength: 1000
+ pattern: \S
+ description: >-
+ What it is good at, 1 to 1000 characters once trimmed. A Bot reads it
+ when it decides which agent to hand work to, so say what to send it.
+ BotAgentEndpoint:
+ type: string
+ description: >-
+ The AG-UI address it runs at: an absolute http or https address. An
+ address that fits can still be refused: the server refuses one this
+ organization may not reach, and one that does not answer a real AG-UI
+ run.
+ maxLength: 2048
+ format: uri
+ pattern: ^[Hh][Tt][Tt][Pp][Ss]?://
+ BotAgentModel:
+ type: [string, 'null']
+ minLength: 1
+ maxLength: 500
+ pattern: \S
+ description: >-
+ A model the catalogue offers, or null for the organization's default.
+ Read only for an agent whose model is OpenBot's to choose.
+ BotAgentSkills:
+ type: array
+ maxItems: 20
+ description: Up to twenty things it is good at. Absent on a change leaves them as they are.
+ items:
+ $ref: '#/components/schemas/BotAgentSkill'
+ BotAgentHarness:
+ type: string
+ description: >-
+ The framework an agent at an address is built on, by its id in
+ OpenBot's harness list (shared/harnesses.json). Empty means none was
+ named. Kept only for kind address.
+ enum:
+ - ''
+ - crewai
+ - llamaindex
+ - agno
+ - langgraph
+ - google-adk
+ - antigravity
+ - pydantic-ai
+ - microsoft-agent-framework
+ - claude-agent-sdk
+ - strands
+ - ag2
+ - langroid
+ - mastra
+ CreateBotAgentRequest:
+ type: object
+ description: >-
+ A new agent. endpoint is required for kind address and refused for
+ kind openbot.
+ additionalProperties: false
+ required: [name, description, visibility, kind]
+ properties:
+ name:
+ $ref: '#/components/schemas/BotAgentName'
+ description:
+ $ref: '#/components/schemas/BotAgentDescription'
+ visibility:
+ $ref: '#/components/schemas/BotAgentVisibility'
+ kind:
+ $ref: '#/components/schemas/BotAgentKind'
+ endpoint:
+ $ref: '#/components/schemas/BotAgentEndpoint'
+ auth:
+ $ref: '#/components/schemas/BotAgentKey'
+ harness:
+ $ref: '#/components/schemas/BotAgentHarness'
+ model:
+ $ref: '#/components/schemas/BotAgentModel'
+ skills:
+ $ref: '#/components/schemas/BotAgentSkills'
+ UpdateBotAgentRequest:
+ type: object
+ description: An agent's fields after the change. Absent optional fields stay as they are.
+ additionalProperties: false
+ required: [name, description, visibility]
+ properties:
+ name:
+ $ref: '#/components/schemas/BotAgentName'
+ description:
+ $ref: '#/components/schemas/BotAgentDescription'
+ visibility:
+ $ref: '#/components/schemas/BotAgentVisibility'
+ endpoint:
+ $ref: '#/components/schemas/BotAgentEndpoint'
+ auth:
+ $ref: '#/components/schemas/BotAgentKey'
+ model:
+ $ref: '#/components/schemas/BotAgentModel'
+ skills:
+ $ref: '#/components/schemas/BotAgentSkills'
+ BotAgentCallbackToken:
+ type: object
+ required: [token]
+ properties:
+ token:
+ type: string
+ minLength: 1
+ description: >-
+ The agent's credential for calling OpenBot's tools back. Returned
+ this once and never again.
+ BotDelegationMode:
+ type: string
+ enum: [self, orchestrate]
+ description: >-
+ self: the Bot runs on its one agent with its apps. orchestrate: the
+ Bot answers on its own model and hands work to the agents it may use.
+ BotDelegationAgent:
+ type: object
+ description: One agent a Bot may use, as the caller sees it.
+ required: [id, name, description, kind, available]
+ properties:
+ id:
+ type: string
+ description: The agent's id.
+ name:
+ type: string
+ description: >-
+ What the agent is called. An agent private to somebody other than
+ the caller is named Private agent.
+ description:
+ type: string
+ description: What it is good at. Empty for an agent private to somebody other than the caller.
+ kind:
+ $ref: '#/components/schemas/BotAgentKind'
+ framework:
+ type: string
+ description: What runs it, by the name a person reads. Absent when OpenBot doesn't know.
+ available:
+ type: boolean
+ description: >-
+ Whether the Bot may still hand it work: false once the agent is
+ deleted, or private to somebody other than the Bot's owner.
+ BotDelegation:
+ type: object
+ description: How a Bot works, and the agents it may use, the first being its default.
+ required: [botId, mode, model, effort, instructions, agents, canManage]
+ properties:
+ botId:
+ type: string
+ description: The Bot's id.
+ mode:
+ $ref: '#/components/schemas/BotDelegationMode'
+ model:
+ type: [string, 'null']
+ description: >-
+ The model the Bot answers on when it orchestrates, or null for the
+ organization's default.
+ effort:
+ type: [string, 'null']
+ description: How hard it thinks when it orchestrates, or null for the model's own.
+ instructions:
+ type: string
+ description: >-
+ How it hands work out and answers when it orchestrates. May be
+ empty. Empty for a caller who can't change the Bot, since it can
+ name an agent private to its owner.
+ agents:
+ type: array
+ minItems: 1
+ items:
+ $ref: '#/components/schemas/BotDelegationAgent'
+ canManage:
+ type: boolean
+ description: Whether the caller may change it.
+ ReplaceBotDelegationRequest:
+ type: object
+ additionalProperties: false
+ required: [mode, model, effort, instructions, agentIds]
+ properties:
+ mode:
+ $ref: '#/components/schemas/BotDelegationMode'
+ model:
+ type: [string, 'null']
+ minLength: 1
+ maxLength: 500
+ pattern: \S
+ description: A model the catalogue offers, or null for the default. Trimmed.
+ effort:
+ type: [string, 'null']
+ minLength: 1
+ maxLength: 40
+ pattern: \S
+ description: An effort the model takes, or null for its own. Trimmed, and read in lower case.
+ instructions:
+ type: string
+ maxLength: 4000
+ description: How it hands work out and answers, up to 4000 characters. May be empty.
+ agentIds:
+ type: array
+ minItems: 1
+ maxItems: 20
+ uniqueItems: true
+ description: >-
+ The agents it may use, in order, the first being its default.
+ Exactly one in mode self.
+ items:
+ type: string
+ minLength: 1
+ maxLength: 200
+ pattern: \S
+ responses:
+ InvalidBotAgent:
+ description: >-
+ A field is missing or out of bounds, kind and endpoint don't agree,
+ the address is one this organization may not reach or did not answer
+ a real AG-UI run, the model is not one the catalogue offers, or the
+ agent runs inside OpenBot and so takes no callback token.
+ content:
+ application/problem+json:
+ schema:
+ $ref: './common.yaml#/components/schemas/Problem'
+ examples:
+ description:
+ value:
+ type: https://open.bot/errors/validation-error
+ title: Request validation failed.
+ status: 400
+ detail: Say what this agent is good at, so your Bots know what to send it.
+ code: VALIDATION_ERROR
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ unreachable:
+ value:
+ type: https://open.bot/errors/bot-agent-unreachable
+ title: Couldn't reach that agent.
+ status: 400
+ detail: Couldn't reach an agent at that address. Check the address and its key, then try again.
+ code: BOT_AGENT_UNREACHABLE
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ BotAgentForbidden:
+ description: >-
+ The caller may not manage this agent, or only an admin may make an
+ agent public.
+ content:
+ application/problem+json:
+ schema:
+ $ref: './common.yaml#/components/schemas/Problem'
+ examples:
+ notYours:
+ value:
+ type: https://open.bot/errors/permission-denied
+ title: You can't manage this agent.
+ status: 403
+ detail: You can't manage this agent.
+ code: PERMISSION_DENIED
+ category: permission
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ publicAdminOnly:
+ value:
+ type: https://open.bot/errors/permission-denied
+ title: Only an admin can share an agent with everyone.
+ status: 403
+ detail: Only an admin can share an agent with everyone. Keep it private to use it with your own Bots.
+ code: PERMISSION_DENIED
+ category: permission
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ BotAgentNotFound:
+ description: >-
+ The agent does not exist, was deleted, or is not visible to the
+ caller, or the organization is not.
+ content:
+ application/problem+json:
+ schema:
+ $ref: './common.yaml#/components/schemas/Problem'
+ examples:
+ missing:
+ value:
+ type: https://open.bot/errors/bot-agent-not-found
+ title: Agent not found.
+ status: 404
+ detail: Couldn't find that agent.
+ code: BOT_AGENT_NOT_FOUND
+ category: not_found
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ BotAgentInUse:
+ description: >-
+ The agent is the only agent of a Bot, or a repeated request with the
+ same Idempotency-Key had a different body.
+ content:
+ application/problem+json:
+ schema:
+ $ref: './common.yaml#/components/schemas/Problem'
+ examples:
+ onlyAgent:
+ value:
+ type: https://open.bot/errors/bot-agent-in-use
+ title: A Bot runs on this agent alone.
+ status: 409
+ detail: Quote Checker and 1 other Bot run on this agent alone. Give them another agent first, then delete this one.
+ code: BOT_AGENT_IN_USE
+ category: conflict
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ InvalidBotDelegation:
+ description: >-
+ A field is missing or out of bounds, mode self names other than one
+ agent, an agent named is not one the caller can see, or the model or
+ effort is not one the catalogue offers.
+ content:
+ application/problem+json:
+ schema:
+ $ref: './common.yaml#/components/schemas/Problem'
+ examples:
+ selfTakesOne:
+ value:
+ type: https://open.bot/errors/validation-error
+ title: Request validation failed.
+ status: 400
+ detail: A Bot that works on its own runs on one agent. Turn on handing work to agents to choose more.
+ code: VALIDATION_ERROR
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ unknownAgent:
+ value:
+ type: https://open.bot/errors/validation-error
+ title: Request validation failed.
+ status: 400
+ detail: Couldn't find one of those agents. Choose from the agents you can see.
+ code: VALIDATION_ERROR
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ examples:
+ BotAgentPageLast:
+ summary: The last page.
+ value:
+ agents:
+ - id: bag_0c51d9e3a7f24b18
+ name: OpenBot
+ description: OpenBot's own agent, with every app and component the Bot may use.
+ kind: openbot
+ visibility: public
+ endpoint: null
+ framework: OpenBot
+ model: null
+ skills: []
+ hasAuth: false
+ hasCallbackToken: false
+ builtIn: true
+ canManage: false
+ mine: false
+ botCount: 4
+ createdAt: '2026-11-16T09:00:00Z'
+ updatedAt: '2026-11-16T09:00:00Z'
+ nextCursor: null
+ OpenBotAgent:
+ summary: OpenBot's own agent.
+ value:
+ agent:
+ id: bag_0c51d9e3a7f24b18
+ name: OpenBot
+ description: OpenBot's own agent, with every app and component the Bot may use.
+ kind: openbot
+ visibility: public
+ endpoint: null
+ framework: OpenBot
+ model: null
+ skills: []
+ hasAuth: false
+ hasCallbackToken: false
+ builtIn: true
+ canManage: false
+ mine: false
+ botCount: 4
+ createdAt: '2026-11-16T09:00:00Z'
+ updatedAt: '2026-11-16T09:00:00Z'
+ CreatedBotAgent:
+ summary: An agent a person added at their own address.
+ value:
+ agent:
+ id: bag_4f7c1e2a9d0b4c63
+ name: Pipeline analyst
+ description: Reads the sales pipeline and forecasts the quarter.
+ kind: address
+ visibility: private
+ endpoint: https://agents.example.com/ag-ui
+ framework: LangChain
+ model: null
+ skills:
+ - name: Forecast
+ description: Forecasts the quarter from the open deals.
+ examples: [What will we close this quarter?]
+ hasAuth: true
+ hasCallbackToken: false
+ builtIn: false
+ canManage: true
+ mine: true
+ botCount: 0
+ createdAt: '2026-11-16T09:30:00Z'
+ updatedAt: '2026-11-16T09:30:00Z'
+ BotAgentCallbackTokenExample:
+ summary: A new token.
+ value:
+ token: obot_agt_7f3a9c2e5d1b4f60a8e2c9d4b1f7e3a6c0d9
+ SelfBotDelegation:
+ summary: A Bot that runs on its own agent, as every Bot did before agents were a list.
+ value:
+ botId: agent_9b1c6f0e-7f0e-4c1e-9d55-2f4a8c1b6e21
+ mode: self
+ model: null
+ effort: null
+ instructions: ''
+ agents:
+ - id: bag_0c51d9e3a7f24b18
+ name: OpenBot
+ description: OpenBot's own agent, with every app and component the Bot may use.
+ kind: openbot
+ framework: OpenBot
+ available: true
+ canManage: true
+ OrchestratingBotDelegation:
+ summary: A Bot that hands work to two agents.
+ value:
+ botId: agent_9b1c6f0e-7f0e-4c1e-9d55-2f4a8c1b6e21
+ mode: orchestrate
+ model: null
+ effort: null
+ instructions: Hand research to Researcher and anything about the pipeline to Pipeline analyst. Answer greetings yourself.
+ agents:
+ - id: bag_4f7c1e2a9d0b4c63
+ name: Researcher
+ description: Deep research on the web and in the person's apps, with sources.
+ kind: openbot
+ framework: OpenBot
+ available: true
+ - id: bag_9a2d7e1c3b5f4086
+ name: Pipeline analyst
+ description: Reads the sales pipeline and forecasts the quarter.
+ kind: address
+ framework: LangChain
+ available: true
+ canManage: true
diff --git a/api/openapi/common.yaml b/api/openapi/common.yaml
index 5ef3decf22..46d3095bf2 100644
--- a/api/openapi/common.yaml
+++ b/api/openapi/common.yaml
@@ -112,6 +112,7 @@ tags:
- { name: Product events, description: "What a person did with a Bot's answer, seen on screen or copied, counted so OpenBot knows which answers people use. Best effort: a client never waits on one." }
- { name: Learning, description: "Automatic learning: the skills Learning proposed, the evidence behind them, approving and rejecting them, and its runs, in the organization's spaces and each person's own; which space each Bot learns into, who reviews what people's recordings propose, each person's sharing choices, requests to share a skill with every Bot, and the skills delivered to Bots." }
- { name: Memory, description: "The facts a person's Bots remember about them, and the app actions those facts are read in from. Each person's are theirs alone: an administrator can't read them either." }
+ - { name: Agents, description: "The agents an organization's Bots hand work to: OpenBot's own, a framework OpenBot runs, or an agent somebody runs at its own address. An administrator adds the organization's, and anybody may add a private one for their own Bots. A Bot's delegation says whether it works on one agent or hands work to several, and which." }
paths:
/api/v2/organizations/{organizationId}/reactions: { $ref: './conversations.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1reactions' }
/api/v2/organizations/{organizationId}/bots: { $ref: './bots.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1bots' }
@@ -175,9 +176,11 @@ paths:
/api/v2/organizations/{organizationId}/conversation-threads/{threadId}: { $ref: './conversations.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1conversation-threads~1{threadId}' }
/api/v2/organizations/{organizationId}/tasks: { $ref: './conversations.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1tasks' }
/api/v2/organizations/{organizationId}/tasks/{taskId}: { $ref: './conversations.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1tasks~1{taskId}' }
+ /api/v2/organizations/{organizationId}/tasks/{taskId}/turns: { $ref: './conversations.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1tasks~1{taskId}~1turns' }
/api/v2/organizations/{organizationId}/tasks/{taskId}/resolve: { $ref: './conversations.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1tasks~1{taskId}~1resolve' }
/api/v2/organizations/{organizationId}/tasks/{taskId}/reopen: { $ref: './conversations.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1tasks~1{taskId}~1reopen' }
/api/v2/organizations/{organizationId}/tasks/{taskId}/retry: { $ref: './conversations.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1tasks~1{taskId}~1retry' }
+ /api/v2/organizations/{organizationId}/tasks/{taskId}/stop: { $ref: './conversations.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1tasks~1{taskId}~1stop' }
/api/v2/organizations/{organizationId}/transcriptions: { $ref: './conversations.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1transcriptions' }
/api/v2/organizations/{organizationId}/credentials: { $ref: './model-connections.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1credentials' }
/api/v2/organizations/{organizationId}/credentials/{credentialId}/revoke: { $ref: './model-connections.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1credentials~1{credentialId}~1revoke' }
@@ -447,6 +450,11 @@ paths:
/api/v2/organizations/{organizationId}/people/{personId}/memory-sources/{memorySourceId}: { $ref: './memory.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1people~1{personId}~1memory-sources~1{memorySourceId}' }
/api/v2/organizations/{organizationId}/people/{personId}/memory-sources/{memorySourceId}/sync: { $ref: './memory.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1people~1{personId}~1memory-sources~1{memorySourceId}~1sync' }
/api/v2/organizations/{organizationId}/bots/{botId}/memory-source-tools: { $ref: './memory.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1bots~1{botId}~1memory-source-tools' }
+ /api/v2/organizations/{organizationId}/bot-agents: { $ref: './agents.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1bot-agents' }
+ /api/v2/organizations/{organizationId}/bot-agents/{botAgentId}: { $ref: './agents.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1bot-agents~1{botAgentId}' }
+ /api/v2/organizations/{organizationId}/bot-agents/{botAgentId}/issue-callback-token: { $ref: './agents.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1bot-agents~1{botAgentId}~1issue-callback-token' }
+ /api/v2/organizations/{organizationId}/bot-agents/{botAgentId}/revoke-callback-token: { $ref: './agents.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1bot-agents~1{botAgentId}~1revoke-callback-token' }
+ /api/v2/organizations/{organizationId}/bots/{botId}/delegation: { $ref: './agents.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1bots~1{botId}~1delegation' }
components:
securitySchemes:
webSession:
@@ -605,6 +613,8 @@ components:
learning:write: Approve and reject what Learning proposed and start Learning in the signed-in person's own spaces, change their Learning choices, and for an administrator change the organization's Learning settings and decide sharing requests.
memories:read: Read the signed-in person's memories and memory sources.
memories:write: Write, change and forget the signed-in person's memories, and add, change, sync and remove their memory sources.
+ bot-agents:read: Read the agents the signed-in person's Bots may hand work to, and for an administrator every agent in the organization.
+ bot-agents:write: Add, change and delete the signed-in person's own agents and their callback tokens, and for an administrator the organization's.
apiKey:
type: http
scheme: bearer
diff --git a/api/openapi/conversations.yaml b/api/openapi/conversations.yaml
index e9696f26f9..713a9ee245 100644
--- a/api/openapi/conversations.yaml
+++ b/api/openapi/conversations.yaml
@@ -1303,6 +1303,58 @@ paths:
$ref: '#/components/responses/ServiceUnavailable'
default:
$ref: './common.yaml#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/tasks/{taskId}/turns:
+ parameters:
+ - $ref: './common.yaml#/components/parameters/OrganizationId'
+ - $ref: '#/components/parameters/TaskId'
+ get:
+ tags:
+ - Tasks
+ operationId: listTaskTurns
+ summary: List a task's turns
+ description: "Return one page of the turns a task has finished, oldest
+ first: each time its Bot worked on something it was asked in the
+ task's conversation, the Bot's brief or a line the person said there.
+ Each says how long the Bot worked on it, counting only the time its
+ runs took, never the time it waited on the person, and which model
+ answered. A turn still running is not listed until it ends. Another
+ person's task is not found. A missing cursor starts at the first page
+ and nextCursor null ends the list."
+ security:
+ - webSession: []
+ - appOAuth:
+ - tasks:read
+ - apiKey: []
+ parameters:
+ - $ref: './common.yaml#/components/parameters/Limit'
+ - $ref: './common.yaml#/components/parameters/Cursor'
+ responses:
+ '200':
+ description: One page of the task's turns.
+ headers:
+ Cache-Control:
+ $ref: './common.yaml#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/TaskTurnPage'
+ examples:
+ example:
+ $ref: '#/components/examples/TaskTurnPageExample'
+ '400':
+ $ref: './common.yaml#/components/responses/InvalidRequest'
+ '401':
+ $ref: './common.yaml#/components/responses/Unauthenticated'
+ '403':
+ $ref: './common.yaml#/components/responses/Forbidden'
+ '404':
+ $ref: '#/components/responses/TaskNotFound'
+ '500':
+ $ref: './common.yaml#/components/responses/ServerError'
+ '503':
+ $ref: '#/components/responses/ServiceUnavailable'
+ default:
+ $ref: './common.yaml#/components/responses/UnexpectedError'
/api/v2/organizations/{organizationId}/tasks/{taskId}/resolve:
parameters:
- $ref: './common.yaml#/components/parameters/OrganizationId'
@@ -1445,6 +1497,57 @@ paths:
$ref: '#/components/responses/ServiceUnavailable'
default:
$ref: './common.yaml#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/tasks/{taskId}/stop:
+ parameters:
+ - $ref: './common.yaml#/components/parameters/OrganizationId'
+ - $ref: '#/components/parameters/TaskId'
+ post:
+ tags:
+ - Tasks
+ operationId: stopTask
+ summary: Stop a task
+ description: Stop the task's work, as Stop in its conversation does. A
+ step it is in the middle of is cut off; the steps it finished stay done,
+ and its conversation and the one that asked for it say how far it got.
+ What it waits on the person for is no longer asked. Only a task that is
+ working or waiting on the person can be stopped. The answer is the task
+ as it stands now, which is stopped.
+ security:
+ - webSession: []
+ - appOAuth:
+ - tasks:write
+ - apiKey: []
+ parameters:
+ - $ref: './common.yaml#/components/parameters/IdempotencyKey'
+ responses:
+ '200':
+ description: The task as it stands now.
+ headers:
+ Cache-Control:
+ $ref: './common.yaml#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/TaskResponse'
+ examples:
+ example:
+ $ref: '#/components/examples/TaskResponseExample'
+ '400':
+ $ref: './common.yaml#/components/responses/InvalidRequest'
+ '401':
+ $ref: './common.yaml#/components/responses/Unauthenticated'
+ '403':
+ $ref: './common.yaml#/components/responses/Forbidden'
+ '404':
+ $ref: '#/components/responses/TaskNotFound'
+ '409':
+ $ref: '#/components/responses/TaskConflict'
+ '500':
+ $ref: './common.yaml#/components/responses/ServerError'
+ '503':
+ $ref: '#/components/responses/ServiceUnavailable'
+ default:
+ $ref: './common.yaml#/components/responses/UnexpectedError'
/api/v2/organizations/{organizationId}/transcriptions:
parameters:
- $ref: './common.yaml#/components/parameters/OrganizationId'
@@ -2388,6 +2491,24 @@ components:
botId:
type: string
description: The Bot doing it.
+ agent:
+ type: [object, 'null']
+ description: >-
+ The agent doing the work, when the Bot handed it to one of the
+ agents it may use. Null for a task the Bot does itself, which is
+ every task before agents were a list. Absent from a server that
+ does not name it.
+ additionalProperties: false
+ required: [id, name]
+ properties:
+ id:
+ type: string
+ description: The agent's id.
+ name:
+ type: string
+ description: >-
+ What the agent is called. An agent private to somebody other
+ than the caller is named Private agent.
conversationId:
type: string
description: The task's own conversation, where the person reads it and replies.
@@ -2526,6 +2647,59 @@ components:
pattern: ^[A-Za-z0-9_-]+$
description: Pass as cursor for the next page. Null ends the list. Written
in URL-safe base64, the only form the cursor parameter accepts.
+ TaskTurn:
+ type: object
+ description: One finished turn of a task's work, answering one thing it was asked in its conversation.
+ required:
+ - askId
+ - startedAt
+ - endedAt
+ - workedSeconds
+ - runs
+ - model
+ properties:
+ askId:
+ type: string
+ description: The id of the message the turn answered, as the conversation's history names it.
+ startedAt:
+ type: string
+ format: date-time
+ description: When its first run began.
+ endedAt:
+ type: string
+ format: date-time
+ description: When its last run ended.
+ workedSeconds:
+ type: integer
+ minimum: 0
+ description: How long its runs took, added up. A wait on the person between two runs (an approval, a question) is not counted.
+ runs:
+ type: integer
+ minimum: 1
+ description: How many runs it took. More than one when it stopped for the person and carried on after.
+ model:
+ type:
+ - string
+ - 'null'
+ description: The model its last run used. Null when the Bot chooses its own model and did not name it.
+ TaskTurnPage:
+ type: object
+ required:
+ - turns
+ - nextCursor
+ properties:
+ turns:
+ type: array
+ items:
+ $ref: '#/components/schemas/TaskTurn'
+ nextCursor:
+ type:
+ - string
+ - 'null'
+ maxLength: 4096
+ pattern: ^[A-Za-z0-9_-]+$
+ description: Pass as cursor for the next page. Null ends the list. Written
+ in URL-safe base64, the only form the cursor parameter accepts.
TaskResponse:
type: object
required:
@@ -3106,6 +3280,9 @@ components:
TaskResponseExample:
summary: "A task ready to read."
value: {"task": {"id": "7c2d6b1f-6f10-4a53-9d51-5f0d6c0e2f1a", "botId": "general-assistant", "conversationId": "5f0d6c0e-2f1a-4a53-9d51-6f3d6b1f6f10", "threadId": "6f3d6b1f-6f10-8a53-9d51-5f0d6c0e2f1a", "title": "Reply to Sam about the spec", "why": "Sam asked for the spec by Friday.", "origin": "check_in", "suggestionId": "0b1c6f0e-7f0e-4c1e-9d55-2f4a8c1b6e21", "sourceApp": "Gmail", "sourceLink": null, "originConversationId": null, "status": "ready_for_review", "failure": null, "failedAt": null, "stoppedAt": null, "next": "Read the draft and send it.", "workingSince": null, "lastActivityAt": "2026-11-14T09:05:00.000Z", "resolvedAt": null, "createdAt": "2026-11-14T09:00:00.000Z", "updatedAt": "2026-11-14T09:05:00.000Z"}}
+ TaskTurnPageExample:
+ summary: "One turn: the Bot's brief, worked on for 52 seconds."
+ value: {"turns": [{"askId": "3a1c9e2b-5d40-4f7a-8b61-0e9d2c4f7a13", "startedAt": "2026-11-14T09:00:02.000Z", "endedAt": "2026-11-14T09:00:54.000Z", "workedSeconds": 52, "runs": 1, "model": "gpt-5.1"}], "nextCursor": null}
TranscriptionExample:
summary: "What was said."
value: {"text": "Remind me to send the forecast on Friday."}
diff --git a/app/src/components/agents/new-bot-sheet.tsx b/app/src/components/agents/new-bot-sheet.tsx
index 59fe1812e9..5ecf15a0d9 100644
--- a/app/src/components/agents/new-bot-sheet.tsx
+++ b/app/src/components/agents/new-bot-sheet.tsx
@@ -65,11 +65,11 @@ import {
type GiveableApp,
giveableAppsQueryOptions,
} from "@/lib/app-access/queries";
+import { appsQueryOptions } from "@/lib/apps/queries";
import { isComposing } from "@/lib/composing";
import { ALWAYS_ON_APP } from "@/lib/connections/rows";
import { deploymentCapabilitiesQueryOptions } from "@/lib/deployment/queries";
import { myCapabilitiesQueryOptions } from "@/lib/enterprise/queries";
-import { appsQueryOptions } from "@/lib/apps/queries";
import { type PluginServer, pluginKeys } from "@/lib/plugins/queries";
import { cn } from "@/lib/utils";
import { queryClient } from "@/query-client";
@@ -127,14 +127,18 @@ type Step = (typeof STEPS)[number];
* The framework is kept for its connection instructions and default role description. Every framework is reached the same way and stored the same way — an AG-UI address —
* so the server never hears which was picked.
*/
-type Runtime = { kind: "builtin" } | { kind: "managed"; harness: string };
+export type Runtime =
+ | { kind: "builtin" }
+ | { kind: "managed"; harness: string };
/**
* The framework as the API names it, or undefined for "An agent you already run" (`byo-url`), which
* names none. The API lists the same ids as the harness catalogue, and api/openapi-harnesses.test.ts
* fails if the two drift apart.
*/
-function declaredFramework(id: string): CreateBotRequestHarness | undefined {
+export function declaredFramework(
+ id: string,
+): CreateBotRequestHarness | undefined {
const known: readonly string[] = Object.values(CreateBotRequestHarness);
return id !== "" && known.includes(id)
? (id as CreateBotRequestHarness)
@@ -938,7 +942,7 @@ function IsolatedOption({
* Filled rather than outlined, so the list reads as a set of things to pick and not as a stack of
* cards. The border is there but transparent until chosen, so choosing one never shifts the rows.
*/
-const OPTION_CLASSES =
+export const OPTION_CLASSES =
"flex w-full items-center gap-3 rounded-lg border border-transparent bg-muted/50 p-3 text-left transition-colors hover:bg-muted disabled:pointer-events-none disabled:opacity-50 aria-pressed:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset";
/**
@@ -947,7 +951,11 @@ const OPTION_CLASSES =
* new question rather than the control on the previous screen. The sheet body scrolls;
* an inner scroller would give this list a second scrollbar.
*/
-function RuntimeStep({ onChoose }: { onChoose: (runtime: Runtime) => void }) {
+export function RuntimeStep({
+ onChoose,
+}: {
+ onChoose: (runtime: Runtime) => void;
+}) {
const heading = useRef(null);
useEffect(() => heading.current?.focus(), []);
@@ -996,7 +1004,7 @@ function RuntimeStep({ onChoose }: { onChoose: (runtime: Runtime) => void }) {
* from there, which is the one thing the browser cannot tell. Why it could not be reached arrives as
* this field's error.
*/
-function EndpointStep({
+export function EndpointStep({
harness,
endpoint,
secret,
diff --git a/app/src/components/approvals/inline-approval.tsx b/app/src/components/approvals/inline-approval.tsx
index dee1c81416..33925f4e43 100644
--- a/app/src/components/approvals/inline-approval.tsx
+++ b/app/src/components/approvals/inline-approval.tsx
@@ -1,11 +1,9 @@
import { offersStandingRule } from "@openbot/shared/standing-rule";
-import {
- approvalPhrase,
- PRIVATE_SHARE_TOOL_REF,
-} from "@openbot/shared/tool-name";
+import { approvalPhrase } from "@openbot/shared/tool-name";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
import { type ReactNode, useState } from "react";
+import { shareOf, ShareText } from "@/components/approvals/share-details";
import { DecisionCard } from "@/components/decisions/decision-card";
import type { Tone } from "@/components/gallery/frame";
import {
@@ -107,32 +105,8 @@ export function InlineApproval({
];
// In the words the step and Activity use for the same action: "Save a file todo.txt in share".
const title = request ? approvalPhrase(request.action) : "";
- // A share shows what it would send, so the person sees what leaves the conversation.
- const share =
- request?.action.toolRef === PRIVATE_SHARE_TOOL_REF
- ? ((request.action.args ?? {}) as {
- preview?: unknown;
- audience?: unknown;
- handOff?: unknown;
- })
- : undefined;
- const shared = share?.preview;
- /*
- * Handed to another person's Bot, the card says who reads it. When the person also asks before
- * changes, this one card is both asks, so it says it hands the work over and shares the text.
- */
- const handedTo =
- typeof share?.handOff === "string"
- ? share.handOff
- : (request?.action.target as { kind?: unknown } | undefined)?.kind ===
- "handoff" && typeof share?.audience === "string"
- ? share.audience
- : undefined;
- const shareCaption = handedTo
- ? typeof share?.handOff === "string"
- ? `${handedTo} belongs to someone else, so this also shares the text below with them.`
- : `${handedTo} belongs to someone else, so they can read the text below.`
- : undefined;
+ // A share shows who reads it and what it would send, so the person sees what leaves the conversation.
+ const share = request ? shareOf(request.action) : null;
return (
<>
{/* The card leaves by folding away; what is left behind is the tool's own line. */}
@@ -159,7 +133,7 @@ export function InlineApproval({
}
caption={
request.action.policy?.reason ??
- shareCaption ??
+ share?.caption ??
(handOff ? "This one is yours to do." : undefined)
}
error={decision.error?.message ?? null}
@@ -175,14 +149,7 @@ export function InlineApproval({
submitting={decision.isPending}
title={title.charAt(0).toUpperCase() + title.slice(1)}
>
- {typeof shared === "string" && shared.trim() ? (
-
- {shared}
-
- ) : null}
+ {share?.text ? : null}
) : null}
diff --git a/app/src/components/approvals/share-details.tsx b/app/src/components/approvals/share-details.tsx
new file mode 100644
index 0000000000..cc2addd03d
--- /dev/null
+++ b/app/src/components/approvals/share-details.tsx
@@ -0,0 +1,109 @@
+import { PRIVATE_SHARE_TOOL_REF } from "@openbot/shared/tool-name";
+import { useCallback, useState } from "react";
+import { cn } from "@/lib/utils";
+
+/** An approval as much as a share's details read: what it is, where it goes, what it sends. */
+type ShareAction = { toolRef: string; target?: unknown; args?: unknown };
+
+/**
+ * What a request to share something private says to the person: who reads it, as one sentence,
+ * and the text itself. Null for any other request.
+ *
+ * Handed to another person's Bot, the sentence says who reads it. When the person also asks before
+ * changes, one card is both asks, so it says it hands the work over and shares the text.
+ */
+export function shareOf(
+ action: ShareAction,
+): { caption: string | undefined; text: string | undefined } | null {
+ if (action.toolRef !== PRIVATE_SHARE_TOOL_REF) return null;
+ const share = (action.args ?? {}) as {
+ preview?: unknown;
+ audience?: unknown;
+ handOff?: unknown;
+ };
+ const handedTo =
+ typeof share.handOff === "string"
+ ? share.handOff
+ : (action.target as { kind?: unknown } | undefined)?.kind === "handoff" &&
+ typeof share.audience === "string"
+ ? share.audience
+ : undefined;
+ return {
+ caption: handedTo
+ ? typeof share.handOff === "string"
+ ? `${handedTo} belongs to someone else, so this also shares the text below with them.`
+ : `${handedTo} belongs to someone else, so they can read the text below.`
+ : undefined,
+ text:
+ typeof share.preview === "string" && share.preview.trim()
+ ? share.preview
+ : undefined,
+ };
+}
+
+/**
+ * The text a share would send, whole. A short text is shown as it is. A long one is cut to a few
+ * lines and faded at the foot, with Show all to read the rest in place, as a step's output is in
+ * the conversation. Never a box that scrolls on its own: where scroll bars hide until used, the
+ * end of the text looked like the end of the box, and the person allowed words they never saw.
+ */
+export function ShareText({ text }: { text: string }) {
+ const [open, setOpen] = useState(false);
+ const [long, setLong] = useState(false);
+ const measure = useCallback((element: HTMLQuoteElement | null) => {
+ if (element) setLong(element.scrollHeight > element.clientHeight + 1);
+ }, []);
+ return (
+
+
+ {text}
+ {long && !open ? (
+
+ ) : null}
+
+ {long ? (
+
+ ) : null}
+
+ );
+}
+
+/**
+ * A share as a list row shows it under the request: the same sentence and text its card in the
+ * conversation shows, so the person reads the same thing in both places before they answer.
+ */
+export function ShareDetails({
+ action,
+ className,
+}: {
+ action: ShareAction;
+ className?: string;
+}) {
+ const share = shareOf(action);
+ if (!share || (!share.caption && !share.text)) return null;
+ return (
+
+ {share.caption ? (
+
{share.caption}
+ ) : null}
+ {share.text ? : null}
+
+ );
+}
diff --git a/app/src/components/approvals/waiting.tsx b/app/src/components/approvals/waiting.tsx
index 858e6af203..eaf238f1be 100644
--- a/app/src/components/approvals/waiting.tsx
+++ b/app/src/components/approvals/waiting.tsx
@@ -1,5 +1,9 @@
import { offersStandingRule } from "@openbot/shared/standing-rule";
-import { approvalDetails, approvalWords } from "@openbot/shared/tool-name";
+import {
+ approvalDetails,
+ approvalPhrase,
+ approvalWords,
+} from "@openbot/shared/tool-name";
import {
IconDots,
IconHandStop,
@@ -10,8 +14,13 @@ import { useMutation, useQuery } from "@tanstack/react-query";
import { useNavigate } from "@tanstack/react-router";
import { Fragment, type ReactNode, useState } from "react";
import { BotOrb } from "@/components/agents/bot-orb";
+import { ShareDetails, shareOf } from "@/components/approvals/share-details";
import { PageRows } from "@/components/layout/page-shell";
-import { BoardRow } from "@/components/needs-you/board-row";
+import {
+ BoardRow,
+ ROW_MENU_WIDTH,
+ RowMenu,
+} from "@/components/needs-you/board-row";
import { Button } from "@/components/ui/button";
import {
Dialog,
@@ -24,6 +33,7 @@ import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
+ DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import {
@@ -135,15 +145,21 @@ function QuestionRow({
/**
* What an approval would send, a labelled line each: "Text: hello". Nothing when it sends nothing
* the title has not said already, as a click does: its ref and snapshot are handles for the model.
+ *
+ * A share reads as its card in the conversation reads: who reads it, in a sentence, and the whole
+ * text. Its own fields (the audience's key, a count of recipients, the text's fingerprint) are the
+ * server's, and listed here as "Audience", "Recipients" and "Preview" they said less than the card.
*/
function ApprovalDetails({
- args,
+ action,
className,
}: {
- args: unknown;
+ action: WaitingRequest["action"];
className?: string;
}) {
- const details = approvalDetails(args);
+ if (shareOf(action))
+ return ;
+ const details = approvalDetails(action.args);
if (details.length === 0) return null;
return (
{request.action.policy.behaviour === "hand_off"
@@ -198,7 +219,7 @@ function RequestRow({
{request.action.policy.reason}
) : null}
-
+
{request.action.policy?.behaviour === "hand_off" ? (
@@ -500,7 +521,14 @@ function AnswerDialog({
* Allow for this conversation and Always allow here in the menu; for a hand-off, Don't do it and I
* did it myself. The action's own row and the row of a task waiting on it both answer with these.
*/
-function RequestAnswers({ request }: { request: WaitingRequest }) {
+function RequestAnswers({
+ request,
+ more = null,
+}: {
+ request: WaitingRequest;
+ /** Menu items of the row it answers on (a task's Mark done and Open), put in this one's menu. */
+ more?: ReactNode;
+}) {
const decision = useMutation(decideApprovalMutationOptions(queryClient));
const words = approvalWords(request.action);
const handOff = request.action.policy?.behaviour === "hand_off";
@@ -561,7 +589,7 @@ function RequestAnswers({ request }: { request: WaitingRequest }) {
>
-
+ decide("allow_conversation")}
@@ -574,11 +602,22 @@ function RequestAnswers({ request }: { request: WaitingRequest }) {
>
Always allow here
+ {more ? (
+ <>
+
+ {more}
+ >
+ ) : null}
+ ) : more ? (
+ {more}
) : null}
>
)}
+ {handOff && more ? (
+ {more}
+ ) : null}
>
);
}
@@ -602,14 +641,20 @@ function requestReason(request: WaitingRequest): ReactNode {
*/
function RequestBoardRow({ request }: { request: WaitingRequest }) {
const words = approvalWords(request.action);
- const action = words.action.charAt(0).toUpperCase() + words.action.slice(1);
+ /*
+ * A share is titled as its card is, who it goes to included: "Hand this to Ledger Bot". Split as
+ * an action and its place, it read "Hand this to" over "Ledger Bot".
+ */
+ const share = shareOf(request.action) !== null;
+ const said = share ? approvalPhrase(request.action) : words.action;
+ const action = said.charAt(0).toUpperCase() + said.slice(1);
return (
}
- detail={words.place}
+ detail={share ? null : words.place}
icon={}
meta={[requestReason(request)]}
- more={}
+ more={}
open
title={action}
waiting
@@ -622,7 +667,14 @@ function RequestBoardRow({ request }: { request: WaitingRequest }) {
* Answer, for a question a task waits on, from the board: the dialog with the whole question and
* the box to answer in, so the person answers without opening the thread. And Dismiss beside it.
*/
-function QuestionAnswers({ question }: { question: WaitingQuestion }) {
+function QuestionAnswers({
+ question,
+ more = null,
+}: {
+ question: WaitingQuestion;
+ /** Menu items of the row it answers on (a task's Mark done and Open), in a menu after Dismiss. */
+ more?: ReactNode;
+}) {
const [answering, setAnswering] = useState(false);
const dismiss = useMutation(
dismissPersonQuestionMutationOptions(queryClient),
@@ -646,6 +698,9 @@ function QuestionAnswers({ question }: { question: WaitingQuestion }) {
>
+ {more ? (
+ {more}
+ ) : null}
ReactNode;
meta: ReactNode[];
more?: ReactNode;
};
@@ -684,9 +740,9 @@ export function useHeldAnswers(): (task: {
: undefined;
if (request)
return {
- actions: ,
+ actions: (more) => ,
meta: [requestReason(request)],
- more: ,
+ more: ,
};
const question = waiting.questions.find(
(asked) =>
@@ -695,7 +751,7 @@ export function useHeldAnswers(): (task: {
);
if (question)
return {
- actions: ,
+ actions: (more) => ,
meta: question.why ? [{question.why}] : [],
};
return undefined;
diff --git a/app/src/components/bot-agents/agent-callback-token.tsx b/app/src/components/bot-agents/agent-callback-token.tsx
new file mode 100644
index 0000000000..30d51bb876
--- /dev/null
+++ b/app/src/components/bot-agents/agent-callback-token.tsx
@@ -0,0 +1,84 @@
+import { useMutation } from "@tanstack/react-query";
+import { useState } from "react";
+import { Button } from "@/components/ui/button";
+import {
+ issueBotAgentCallbackTokenMutationOptions,
+ revokeBotAgentCallbackTokenMutationOptions,
+} from "@/lib/bot-agents/mutations";
+import type { AgentRecord } from "@/lib/bot-agents/queries";
+import { queryClient } from "@/query-client";
+
+/**
+ * The key an agent at its own address presents when it calls a tool back, as the Bot's own key panel
+ * offers it (components/agents/callback-token-panel.tsx).
+ *
+ * Shown once, and said plainly: OpenBot keeps only a hash, so nothing can show it again. A call made
+ * with it is allowed only for a run of a Bot that may use this agent, as the person that run is for.
+ */
+export function AgentCallbackToken({ agent }: { agent: AgentRecord }) {
+ const issue = useMutation(
+ issueBotAgentCallbackTokenMutationOptions(queryClient),
+ );
+ const revoke = useMutation(
+ revokeBotAgentCallbackTokenMutationOptions(queryClient),
+ );
+ /** Held in state, not in a query cache: it must not survive a refetch or a navigation. */
+ const [token, setToken] = useState(null);
+ const error = issue.error ?? revoke.error;
+
+ return (
+
+
+ {agent.hasCallbackToken
+ ? "This agent has a key, so it can use the apps of the Bots that hand it work. If you make a new key, the old one stops working right away."
+ : "This agent has no key yet. It can answer but can't use apps. Generate a key and add it to your agent's configuration."}
+
+ {token ? (
+
+
+ Copy this key now. You won't see it again.
+
+
+ {token}
+
+
+ If you lose it, make a new one.
+
+
+
+ ) : (
+
+
+ {agent.hasCallbackToken ? (
+
+ ) : null}
+
+ )}
+ {error ? (
+
+ {error.message}
+
+ ) : null}
+
+ );
+}
diff --git a/app/src/components/bot-agents/agent-list.tsx b/app/src/components/bot-agents/agent-list.tsx
new file mode 100644
index 0000000000..21790e6dbb
--- /dev/null
+++ b/app/src/components/bot-agents/agent-list.tsx
@@ -0,0 +1,174 @@
+import { IconDots, IconPlus, IconSitemap } from "@tabler/icons-react";
+import { useMutation, useQuery } from "@tanstack/react-query";
+import { Fragment, useState } from "react";
+import {
+ PageEmpty,
+ PageRows,
+ PageSection,
+} from "@/components/layout/page-shell";
+import { MetaTag } from "@/components/needs-you/board-row";
+import { Button } from "@/components/ui/button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
+import {
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemDescription,
+ ItemFooter,
+ ItemTitle,
+} from "@/components/ui/item";
+import { Separator } from "@/components/ui/separator";
+import { deleteBotAgentMutationOptions } from "@/lib/bot-agents/mutations";
+import {
+ type AgentRecord,
+ botAgentListQueryOptions,
+ whereItRuns,
+} from "@/lib/bot-agents/queries";
+import { queryClient } from "@/query-client";
+import { AgentCallbackToken } from "./agent-callback-token";
+import { AgentMark } from "./agent-mark";
+
+/** "Used by 2 Bots", or "Not used by any Bot yet". */
+export function usedBy(count: number): string {
+ if (count === 0) return "Not used by any Bot yet";
+ return `Used by ${count} ${count === 1 ? "Bot" : "Bots"}`;
+}
+
+/**
+ * Every agent the person's Bots may hand work to: OpenBot's own, and the ones the organization and
+ * the person added. Each row says where it runs and how many Bots use it. Changing and deleting are
+ * in the row's menu, for whoever may manage it; a key for calling tools back is offered on an agent
+ * at its own address that OpenBot doesn't run.
+ */
+export function AgentList({
+ onAdd,
+ onEdit,
+}: {
+ onAdd: () => void;
+ onEdit: (agent: AgentRecord) => void;
+}) {
+ const agents = useQuery(botAgentListQueryOptions());
+ const remove = useMutation(deleteBotAgentMutationOptions(queryClient));
+ const [refusal, setRefusal] = useState<{ id: string; message: string }>();
+ const [keyFor, setKeyFor] = useState();
+
+ if (agents.isPending) return null;
+ if (agents.data === undefined)
+ return (
+
+ Couldn't load your agents. Try again in a moment.
+
+
+ ) : null}
+ {keyFor === agent.id ? (
+
+
+
+ ) : null}
+
+
+ ))}
+
+
+ );
+}
diff --git a/app/src/components/bot-agents/agent-mark.tsx b/app/src/components/bot-agents/agent-mark.tsx
new file mode 100644
index 0000000000..3bdeb670a3
--- /dev/null
+++ b/app/src/components/bot-agents/agent-mark.tsx
@@ -0,0 +1,41 @@
+import { WEB_HARNESSES } from "@openbot/shared/harnesses";
+import { IconSitemap } from "@tabler/icons-react";
+import { HarnessMark } from "@/components/agents/harness-mark";
+import { OpenBotLogo } from "@/components/edition/openbot-logo";
+import { ItemMedia } from "@/components/ui/item";
+import type { AgentRecord } from "@/lib/bot-agents/queries";
+
+/** The framework's mark id for the name the server gives (`framework`), or null for none. */
+export function markIdFor(framework: string | undefined): string | null {
+ if (!framework) return null;
+ return (
+ WEB_HARNESSES.find((harness) => harness.name === framework)?.mark ?? null
+ );
+}
+
+/**
+ * An agent's leading picture: OpenBot's own mark for an agent that runs inside OpenBot, the
+ * framework's mark for one that names a framework with a mark, and the Agents glyph otherwise.
+ * Never a monogram drawn to fill the gap (`shared/marks/README.md`).
+ *
+ * In a row's media tile by default; `bare` draws the picture alone, for a tile of the caller's own.
+ */
+export function AgentMark({
+ agent,
+ bare = false,
+}: {
+ agent: Pick;
+ bare?: boolean;
+}) {
+ const mark = agent.kind === "openbot" ? null : markIdFor(agent.framework);
+ const picture =
+ agent.kind === "openbot" ? (
+
+ ) : mark ? (
+
+ ) : (
+
+ );
+ if (bare) return picture;
+ return {picture};
+}
diff --git a/app/src/components/bot-agents/agent-sheet.tsx b/app/src/components/bot-agents/agent-sheet.tsx
new file mode 100644
index 0000000000..5fec00413d
--- /dev/null
+++ b/app/src/components/bot-agents/agent-sheet.tsx
@@ -0,0 +1,685 @@
+import { WEB_HARNESSES } from "@openbot/shared/harnesses";
+import { IconLock, IconPlus, IconUsers, IconX } from "@tabler/icons-react";
+import { useMutation, useQuery } from "@tanstack/react-query";
+import { useState } from "react";
+import { CustomAgentCta } from "@/components/agents/custom-agent-cta";
+import {
+ EndpointStep,
+ OPTION_CLASSES,
+ type Runtime,
+ RuntimeStep,
+} from "@/components/agents/new-bot-sheet";
+import { Button } from "@/components/ui/button";
+import {
+ Field,
+ FieldDescription,
+ FieldGroup,
+ FieldLabel,
+ FieldLegend,
+ FieldSet,
+} from "@/components/ui/field";
+import { Input } from "@/components/ui/input";
+import {
+ Select,
+ SelectContent,
+ SelectGroup,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
+import {
+ Sheet,
+ SheetClose,
+ SheetContent,
+ SheetFooter,
+ SheetTitle,
+} from "@/components/ui/sheet";
+import { Textarea } from "@/components/ui/textarea";
+import { agentFormSchema } from "@/lib/agents/form";
+import { testAgentConnection } from "@/lib/agents/queries";
+import {
+ BotAgentHarness,
+ type BotAgentSkill,
+ type BotAgentVisibility,
+} from "@/lib/api/generated/model";
+import { currentUserQueryOptions } from "@/lib/auth/queries";
+import { isOrganizationAdmin } from "@/lib/auth/roles";
+import {
+ createBotAgentMutationOptions,
+ updateBotAgentMutationOptions,
+} from "@/lib/bot-agents/mutations";
+import type { AgentRecord } from "@/lib/bot-agents/queries";
+import { deploymentCapabilitiesQueryOptions } from "@/lib/deployment/queries";
+import { modelCatalogueQueryOptions } from "@/lib/models/queries";
+import { queryClient } from "@/query-client";
+
+/** The value the model picker gives "the organization's default", which the API sends as null. */
+const DEFAULT_MODEL = "__default__";
+
+const STEPS = ["about", "runtime", "endpoint"] as const;
+type Step = (typeof STEPS)[number];
+
+/** A skill as the form holds it, with a key of its own so a row keeps its place while typed in. */
+type SkillDraft = { key: number; name: string; description: string };
+
+/**
+ * Where an agent is added, or changed: a sheet from the right, so the list stays in view behind it.
+ *
+ * Adding takes the New Bot sheet's steps. What it is called and what it is good at come first, and
+ * by default it runs inside OpenBot. "Connect an agent you run" goes through the same framework list
+ * and address step New Bot has, and the address is tried with a real run before anything is saved.
+ */
+export function AgentSheet({
+ open,
+ editing,
+ onClose,
+}: {
+ open: boolean;
+ /** The agent being changed, or undefined to add one. */
+ editing?: AgentRecord;
+ onClose: () => void;
+}) {
+ return (
+ {
+ if (!next) onClose();
+ }}
+ open={open}
+ >
+
+ {/* Inside the popup, so it unmounts on close and a reopened sheet starts afresh. */}
+
+
+
+ );
+}
+
+function harnessFor(runtime: Runtime | null): BotAgentHarness | undefined {
+ if (runtime?.kind !== "managed") return undefined;
+ const known: readonly string[] = Object.values(BotAgentHarness);
+ return runtime.harness !== "" && known.includes(runtime.harness)
+ ? (runtime.harness as BotAgentHarness)
+ : undefined;
+}
+
+function AgentFlow({
+ editing,
+ onDone,
+}: {
+ editing?: AgentRecord;
+ onDone: () => void;
+}) {
+ const personal =
+ useQuery(deploymentCapabilitiesQueryOptions()).data?.edition === "personal";
+ const me = useQuery(currentUserQueryOptions()).data;
+ const admin = isOrganizationAdmin(me?.role);
+ const create = useMutation(createBotAgentMutationOptions(queryClient));
+ const update = useMutation(updateBotAgentMutationOptions(queryClient));
+ const saving = create.isPending || update.isPending;
+ const failure = create.error ?? update.error;
+
+ const [step, setStep] = useState("about");
+ const [name, setName] = useState(editing?.name ?? "");
+ const [description, setDescription] = useState(editing?.description ?? "");
+ const [visibility, setVisibility] = useState(
+ editing?.visibility ?? "private",
+ );
+ const [model, setModel] = useState(editing?.model ?? DEFAULT_MODEL);
+ const [skills, setSkills] = useState(() =>
+ (editing?.skills ?? []).map((skill, index) => ({
+ key: index,
+ name: skill.name,
+ description: skill.description,
+ })),
+ );
+ const [runtime, setRuntime] = useState(
+ editing?.kind === "address"
+ ? { kind: "managed", harness: "byo-url" }
+ : { kind: "builtin" },
+ );
+ const [endpoint, setEndpoint] = useState(editing?.endpoint ?? "");
+ const [key, setKey] = useState("");
+ const [tried, setTried] = useState(false);
+ const [checking, setChecking] = useState(false);
+ const [unreachable, setUnreachable] = useState();
+ const [missing, setMissing] = useState();
+
+ const kind = runtime?.kind === "managed" ? "address" : "openbot";
+ const catalogue = useQuery({
+ ...modelCatalogueQueryOptions(),
+ enabled: kind === "openbot",
+ });
+ const busy = checking || saving;
+ const endpointIssue =
+ endpoint.trim() === ""
+ ? "Enter your agent's address."
+ : agentFormSchema.shape.endpoint.safeParse(endpoint).error?.issues[0]
+ ?.message;
+ const addressChanged =
+ kind === "address" &&
+ (endpoint.trim() !== (editing?.endpoint ?? "") || key.trim() !== "");
+
+ const go = (to: Step) => {
+ setTried(false);
+ setUnreachable(undefined);
+ create.reset();
+ update.reset();
+ setStep(to);
+ };
+
+ /** What the person typed, checked: a name, and what the agent is good at. */
+ const aboutIssue = (): string | undefined => {
+ if (!name.trim()) return "Give the agent a name.";
+ if (!description.trim())
+ return "Say what this agent is good at, so your Bots know what to send it.";
+ if (skills.some((skill) => !skill.name.trim() || !skill.description.trim()))
+ return "Give each thing it's good at a name and a description, or remove it.";
+ return undefined;
+ };
+
+ const shownSkills = (): BotAgentSkill[] =>
+ skills.map((skill) => ({
+ name: skill.name.trim(),
+ description: skill.description.trim(),
+ }));
+
+ /** Dial the address from the server before it is saved, as New Bot does. */
+ const reachable = async (): Promise => {
+ if (endpointIssue) {
+ setTried(true);
+ document.getElementById("new-bot-endpoint")?.focus();
+ return false;
+ }
+ setUnreachable(undefined);
+ setChecking(true);
+ const verdict = await testAgentConnection(endpoint.trim(), key).finally(
+ () => setChecking(false),
+ );
+ if (!verdict.ok) {
+ setUnreachable(verdict.reason);
+ document.getElementById("new-bot-endpoint")?.focus();
+ return false;
+ }
+ return true;
+ };
+
+ const save = async () => {
+ const issue = aboutIssue();
+ if (issue) {
+ setMissing(issue);
+ if (step !== "about") go("about");
+ return;
+ }
+ setMissing(undefined);
+ if (kind === "address" && (!editing || addressChanged)) {
+ if (!(await reachable())) return;
+ }
+ const auth = key.trim()
+ ? { auth: { header: "Authorization", value: key.trim() } }
+ : {};
+ const chosenModel = model === DEFAULT_MODEL ? null : model;
+ // One person, and the Bot they start with is the install's own: an agent here is for every Bot.
+ const shown: BotAgentVisibility = personal ? "public" : visibility;
+ if (editing) {
+ await update.mutateAsync({
+ botAgentId: editing.id,
+ input: {
+ name: name.trim(),
+ description: description.trim(),
+ visibility: shown,
+ skills: shownSkills(),
+ ...(kind === "openbot" ? { model: chosenModel } : {}),
+ ...(kind === "address" && addressChanged
+ ? { endpoint: endpoint.trim(), ...auth }
+ : {}),
+ },
+ });
+ } else {
+ const harness = harnessFor(runtime);
+ await create.mutateAsync({
+ name: name.trim(),
+ description: description.trim(),
+ visibility: shown,
+ kind,
+ skills: shownSkills(),
+ ...(kind === "openbot"
+ ? { model: chosenModel }
+ : {
+ endpoint: endpoint.trim(),
+ ...auth,
+ ...(harness ? { harness } : {}),
+ }),
+ });
+ }
+ onDone();
+ };
+
+ const submit = () => {
+ if (busy) return;
+ if (step === "about" && kind === "address" && !editing) {
+ const issue = aboutIssue();
+ if (issue) {
+ setMissing(issue);
+ return;
+ }
+ setMissing(undefined);
+ go("endpoint");
+ return;
+ }
+ // The failure is shown from the mutation's own state; nothing more to do with it here.
+ void save().catch(() => undefined);
+ };
+
+ const title = editing ? `Change ${editing.name}` : "Add agent";
+ const primary = checking
+ ? "Checking…"
+ : saving
+ ? "Saving…"
+ : editing
+ ? "Save"
+ : step === "about" && kind === "address"
+ ? "Continue"
+ : "Add agent";
+
+ return (
+
+ );
+}
+
+/** The two ways an agent can be seen. Public is an admin's to give. */
+const VISIBILITY_OPTIONS: Array<{
+ value: BotAgentVisibility;
+ title: string;
+ description: string;
+ icon: typeof IconLock;
+}> = [
+ {
+ value: "private",
+ title: "Private",
+ description: "Only your Bots can use it.",
+ icon: IconLock,
+ },
+ {
+ value: "public",
+ title: "Everyone",
+ description: "Every Bot in your organization can use it.",
+ icon: IconUsers,
+ },
+];
+
+function AboutFields({
+ name,
+ description,
+ visibility,
+ model,
+ skills,
+ kind,
+ runtime,
+ catalogue,
+ admin,
+ personal,
+ onName,
+ onDescription,
+ onVisibility,
+ onModel,
+ onSkills,
+}: {
+ name: string;
+ description: string;
+ visibility: BotAgentVisibility;
+ model: string;
+ skills: SkillDraft[];
+ kind: "openbot" | "address";
+ runtime: Runtime | null;
+ /** The models it can run on, or null for an agent whose model is its own. */
+ catalogue: Array<{ id: string; label: string }> | null;
+ admin: boolean;
+ personal: boolean;
+ onName: (value: string) => void;
+ onDescription: (value: string) => void;
+ onVisibility: (value: BotAgentVisibility) => void;
+ onModel: (value: string) => void;
+ onSkills: (value: SkillDraft[]) => void;
+}) {
+ const framework =
+ runtime?.kind === "managed"
+ ? WEB_HARNESSES.find((harness) => harness.id === runtime.harness)
+ : undefined;
+ return (
+
+
+ {kind === "openbot"
+ ? "Runs in OpenBot, with the apps of whichever Bot hands it work."
+ : framework && framework.id !== "byo-url"
+ ? `An agent you run on ${framework.name}. OpenBot connects to it.`
+ : "An agent you run. OpenBot connects to it."}
+
+
+ Name
+ onName(event.target.value)}
+ placeholder="Researcher"
+ value={name}
+ />
+
+
+ What it's good at
+
+ {catalogue ? (
+
+ Model
+
+
+ ) : null}
+
+ {personal ? null : (
+
+ )}
+
+ );
+}
diff --git a/app/src/components/bot-profile/activity.tsx b/app/src/components/bot-profile/activity.tsx
index 30b917765f..3e8f8217f3 100644
--- a/app/src/components/bot-profile/activity.tsx
+++ b/app/src/components/bot-profile/activity.tsx
@@ -39,6 +39,7 @@ import { currentUserQueryOptions } from "@/lib/auth/queries";
import { isOrganizationAdmin } from "@/lib/auth/roles";
import {
type ActivityEntry,
+ type ActivityGroup,
groupActivity,
isRoutine,
} from "@/lib/bot-lifecycle/activity-groups";
@@ -188,6 +189,52 @@ export function ActivityRow({
);
}
+/**
+ * A Bot's activity in the groups its Activity page lists: its own activity, its tasks in their live
+ * state, its routines and its check-ins, put together by `groupActivity`. The Activity page draws
+ * these groups and the Bot page's row to it counts them, so the two never disagree.
+ */
+function useActivityGroups(agentId: string, boardAbove = false) {
+ const activity = useBotActivity(agentId);
+ const taskList = useQuery(taskListQueryOptions());
+ const channels = useInfiniteQuery(channelListQueryOptions());
+ // What the Routines page reads, to count its rows as it draws them (`routinesSummary`).
+ const routines = useQuery(routinesQueryOptions());
+ const checkIns = useQuery(proactiveSettingsQueryOptions());
+ const channel = (channelId: string) =>
+ channels.data?.find((candidate) => candidate.id === channelId);
+ const goalRoutineIds = new Set(
+ (routines.data?.routines ?? [])
+ .filter((routine) => routine.goalId)
+ .map((routine) => routine.id),
+ );
+ const ownCheckIns = (checkIns.data ?? []).filter(
+ (checkIn) => checkIn.botId === agentId && checkIn.enabled,
+ );
+ const groups = activity.data
+ ? groupActivity({
+ activity: activity.data,
+ tasks: orderTasks(
+ (taskList.data ?? []).filter((task) => task.agentId === agentId),
+ (channelId) => channel(channelId)?.busy === true,
+ Date.now(),
+ ),
+ checkIns: ownCheckIns,
+ goalRoutineIds,
+ boardAbove,
+ })
+ : [];
+ return {
+ activity,
+ taskList,
+ channel,
+ goalRoutineIds,
+ ownCheckIns,
+ groups,
+ pending: activity.isPending || taskList.isPending,
+ };
+}
+
/** How many running or scheduled items the Bot's page shows before "All activity". */
const GLANCE = 3;
@@ -217,9 +264,9 @@ function upcomingOf(activity: BotActivity | undefined) {
* least urgent, so it lives only on the Activity page.
*/
export function BotActivityGlance({ agentId }: { agentId: string }) {
- const activity = useBotActivity(agentId);
+ const { activity, groups, pending } = useActivityGroups(agentId);
const upcoming = upcomingOf(activity.data);
- if (activity.isPending || upcoming.length === 0) return null;
+ if (pending || upcoming.length === 0) return null;
return (
@@ -229,7 +276,11 @@ export function BotActivityGlance({ agentId }: { agentId: string }) {
))}
-
+
);
@@ -241,14 +292,15 @@ export function BotActivityGlance({ agentId }: { agentId: string }) {
* card's other rows.
*/
export function BotActivityRow({ agentId }: { agentId: string }) {
- const activity = useBotActivity(agentId);
- if (activity.isPending || upcomingOf(activity.data).length > 0) return null;
+ const { activity, groups, pending } = useActivityGroups(agentId);
+ if (pending || upcomingOf(activity.data).length > 0) return null;
return (
<>
@@ -259,11 +311,14 @@ export function BotActivityRow({ agentId }: { agentId: string }) {
function AllActivityItem({
activity,
agentId,
+ groups,
title = "All activity",
withIcon = false,
}: {
activity: BotActivity | undefined;
agentId: string;
+ /** What the Activity page lists, which the summary counts. */
+ groups: readonly ActivityGroup[];
title?: string;
withIcon?: boolean;
}) {
@@ -281,7 +336,7 @@ function AllActivityItem({
{title}
{activity
- ? activitySummary(activity)
+ ? activitySummary(activity, groups)
: "Couldn't load this Bot's activity."}
@@ -296,18 +351,27 @@ function AllActivityItem({
* The Bot page's one line about its activity: what is running, what is lined up and which goals
* wait to be asked. Finished work is only counted when there is nothing else to say. A goal that
* runs only when asked is never "scheduled": it was, and a Bot with one routine read "2 scheduled".
+ *
+ * Counted from what the Activity page lists (`groups`, its tasks included), so the row never says
+ * there is nothing while the page it opens lists something. FOUND LIVE: it said "No tasks, routines
+ * or goals yet" over an Activity page with a finished task under Done, because it counted only the
+ * Bot's own activity. Without `groups`, the Bot's own activity alone.
*/
-export function activitySummary(activity: BotActivity): string {
+export function activitySummary(
+ activity: BotActivity,
+ groups: readonly ActivityGroup[] = groupActivity({ activity, tasks: [] }),
+): string {
const onDemand = activity.onDemand?.length ?? 0;
+ const count = (id: ActivityGroup["id"]) =>
+ groups.find((group) => group.id === id)?.entries.length ?? 0;
+ const inProgress = count("needs_you") + count("working");
const parts = [
- activity.inProgress.length
- ? `${activity.inProgress.length} in progress`
- : null,
+ inProgress ? `${inProgress} in progress` : null,
activity.scheduled.length ? `${activity.scheduled.length} scheduled` : null,
onDemand ? `${onDemand} on demand` : null,
].filter(Boolean);
if (parts.length) return parts.join(" · ");
- return activity.completed.length
+ return groups.length
? "Nothing running or scheduled"
: "No tasks, routines or goals yet";
}
@@ -412,15 +476,18 @@ export function BotActivitySections({
/** The Needs you board sits above, so tasks and what the Bot asked are not listed twice. */
boardAbove?: boolean;
}) {
- const activity = useBotActivity(agentId);
- const taskList = useQuery(taskListQueryOptions());
- const channels = useInfiniteQuery(channelListQueryOptions());
- // What the Routines page reads, to count its rows as it draws them (`routinesSummary`).
- const routines = useQuery(routinesQueryOptions());
- const checkIns = useQuery(proactiveSettingsQueryOptions());
+ const {
+ activity,
+ taskList,
+ channel,
+ goalRoutineIds,
+ ownCheckIns,
+ groups,
+ pending,
+ } = useActivityGroups(agentId, boardAbove);
const bots = useQuery(agentListQueryOptions());
const blocked = useCheckInsBlocked();
- if (activity.isPending || taskList.isPending) return null;
+ if (pending || activity.isPending) return null;
if (activity.error)
return (
@@ -429,27 +496,6 @@ export function BotActivitySections({
);
- const channel = (channelId: string) =>
- channels.data?.find((candidate) => candidate.id === channelId);
- const goalRoutineIds = new Set(
- (routines.data?.routines ?? [])
- .filter((routine) => routine.goalId)
- .map((routine) => routine.id),
- );
- const ownCheckIns = (checkIns.data ?? []).filter(
- (checkIn) => checkIn.botId === agentId && checkIn.enabled,
- );
- const groups = groupActivity({
- activity: activity.data,
- tasks: orderTasks(
- (taskList.data ?? []).filter((task) => task.agentId === agentId),
- (channelId) => channel(channelId)?.busy === true,
- Date.now(),
- ),
- checkIns: ownCheckIns,
- goalRoutineIds,
- boardAbove,
- });
const titleOf = (channelId: string) => {
const found = channel(channelId);
return (found && conversationTitle(found)) || null;
diff --git a/app/src/components/bot-profile/attention.tsx b/app/src/components/bot-profile/attention.tsx
index a4a026a291..6cbe9d8c0f 100644
--- a/app/src/components/bot-profile/attention.tsx
+++ b/app/src/components/bot-profile/attention.tsx
@@ -65,6 +65,18 @@ export function useWaitingCount(): number {
return waitingAcross(useQuery(botAttentionQueryOptions()).data);
}
+/**
+ * The same count, read live, for one Bot or, given none, across all of them: what a list of what
+ * waits on the person says beside its rows, so it says the badge's number and never its own.
+ */
+export function useWaitingOnYou(): (botId?: string) => number {
+ const bots = useQuery(botAttentionQueryOptions()).data;
+ return (botId) =>
+ waitingAcross(
+ botId === undefined ? bots : bots?.filter((bot) => bot.botId === botId),
+ );
+}
+
const count = (total: number, one: string, many: string) =>
`${total} ${total === 1 ? one : many}`;
diff --git a/app/src/components/bot-profile/delegation.tsx b/app/src/components/bot-profile/delegation.tsx
new file mode 100644
index 0000000000..0a36dd60d9
--- /dev/null
+++ b/app/src/components/bot-profile/delegation.tsx
@@ -0,0 +1,495 @@
+import { IconArrowDown, IconArrowUp, IconSitemap } from "@tabler/icons-react";
+import { useMutation, useQuery } from "@tanstack/react-query";
+import { useState } from "react";
+import { OPTION_CLASSES } from "@/components/agents/new-bot-sheet";
+import { AgentMark } from "@/components/bot-agents/agent-mark";
+import {
+ PageCard,
+ PageRows,
+ PageSection,
+} from "@/components/layout/page-shell";
+import { MetaTag } from "@/components/needs-you/board-row";
+import { Button } from "@/components/ui/button";
+import { Checkbox } from "@/components/ui/checkbox";
+import {
+ Field,
+ FieldDescription,
+ FieldGroup,
+ FieldLabel,
+ FieldLegend,
+ FieldSet,
+} from "@/components/ui/field";
+import {
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemDescription,
+ ItemMedia,
+ ItemTitle,
+} from "@/components/ui/item";
+import {
+ Select,
+ SelectContent,
+ SelectGroup,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
+import { Switch } from "@/components/ui/switch";
+import { Textarea } from "@/components/ui/textarea";
+import type { AgentProfile } from "@/lib/agents/queries";
+import type { BotDelegationAgent } from "@/lib/api/generated/model";
+import { replaceBotDelegationMutationOptions } from "@/lib/bot-agents/mutations";
+import {
+ botAgentListQueryOptions,
+ botDelegationQueryOptions,
+ type Delegation,
+ whereItRuns,
+} from "@/lib/bot-agents/queries";
+import { modelCatalogueQueryOptions } from "@/lib/models/queries";
+import { queryClient } from "@/query-client";
+
+/** The value the model picker gives "the organization's default", which the API sends as null. */
+const DEFAULT_MODEL = "__default__";
+const MAX_AGENTS = 20;
+
+/** The name the server gives an agent private to somebody other than the person reading it. */
+const PRIVATE_AGENT = "Private agent";
+
+/** One agent as this page draws it: from the Bot's own list, or from the agents the person sees. */
+type Choice = Pick<
+ BotDelegationAgent,
+ "id" | "name" | "description" | "kind"
+> & {
+ framework?: string;
+ endpoint?: string | null;
+ available: boolean;
+};
+
+/**
+ * How a Bot works: on its one agent, doing the work itself with its apps, or handing the work to the
+ * agents it may use while it answers quickly. One form, saved together, because the switch means
+ * nothing without the agents it switches to.
+ */
+export function BotDelegation({ agent }: { agent: AgentProfile }) {
+ const delegation = useQuery(botDelegationQueryOptions(agent.id));
+ /*
+ * Kept out here: the save's own refetch remounts the form below (it is keyed by what was saved), and
+ * "Saved." has to outlive that.
+ */
+ const [saved, setSaved] = useState(false);
+ if (delegation.isPending) return null;
+ if (delegation.error)
+ return (
+
+ Couldn't load how this Bot works. Try again in a moment.
+
+ );
+ // Keyed by what was saved, so a save from another tab starts the form from the new answer.
+ return (
+
+ );
+}
+
+function DelegationForm({
+ botId,
+ saved,
+ done,
+ onDone: setDone,
+}: {
+ botId: string;
+ saved: Delegation;
+ /** Whether the last save went through. */
+ done: boolean;
+ onDone: (done: boolean) => void;
+}) {
+ const visible = useQuery(botAgentListQueryOptions());
+ const catalogue = useQuery(modelCatalogueQueryOptions());
+ const save = useMutation(replaceBotDelegationMutationOptions(queryClient));
+ const editable = saved.canManage;
+
+ const orchestrate = saved.mode === "orchestrate";
+ const toggle = useMutation(replaceBotDelegationMutationOptions(queryClient));
+ const [runsOn, setRunsOn] = useState(saved.agents[0]?.id ?? "");
+ const [chosen, setChosen] = useState(
+ saved.mode === "orchestrate" ? saved.agents.map((each) => each.id) : [],
+ );
+ const [model, setModel] = useState(saved.model ?? DEFAULT_MODEL);
+ const [instructions, setInstructions] = useState(saved.instructions);
+ const [problem, setProblem] = useState();
+
+ // Every agent this page can name: the Bot's own first, as the server described them, then the rest.
+ const byId = new Map();
+ for (const each of saved.agents) byId.set(each.id, each);
+ for (const each of visible.data ?? [])
+ if (!byId.has(each.id))
+ byId.set(each.id, {
+ id: each.id,
+ name: each.name,
+ description: each.description,
+ kind: each.kind,
+ framework: each.framework,
+ endpoint: each.endpoint,
+ available: true,
+ });
+ const all = [...byId.values()];
+ const others = all.filter(
+ (each) => !chosen.includes(each.id) && each.available,
+ );
+
+ const move = (id: string, by: -1 | 1) =>
+ setChosen((current) => {
+ const at = current.indexOf(id);
+ const to = at + by;
+ if (at < 0 || to < 0 || to >= current.length) return current;
+ const next = [...current];
+ [next[at], next[to]] = [next[to] as string, next[at] as string];
+ return next;
+ });
+
+ const submit = async () => {
+ setProblem(undefined);
+ setDone(false);
+ const agentIds = orchestrate ? chosen : runsOn ? [runsOn] : [];
+ if (agentIds.length === 0) {
+ setProblem(
+ orchestrate
+ ? "Choose at least one agent for this Bot to hand work to."
+ : "Choose the agent this Bot runs on.",
+ );
+ return;
+ }
+ await save.mutateAsync({
+ botId,
+ input: {
+ mode: orchestrate ? "orchestrate" : "self",
+ model: model === DEFAULT_MODEL ? null : model,
+ effort: saved.effort,
+ instructions,
+ agentIds,
+ },
+ });
+ setDone(true);
+ };
+
+ /*
+ * The switch saves on its own, as a switch does. Turning it on keeps the agent the Bot runs on as
+ * its first and default; turning it off runs the Bot on its default agent again. What was saved
+ * for the other mode (the model, the instructions) is kept for when it is turned back on.
+ */
+ const flip = (next: boolean) => {
+ setDone(false);
+ const own = saved.agents.filter((each) => each.available);
+ const first = own[0] ?? saved.agents[0];
+ if (!first) return;
+ toggle.mutate({
+ botId,
+ input: {
+ mode: next ? "orchestrate" : "self",
+ model: saved.model,
+ effort: saved.effort,
+ instructions: saved.instructions,
+ agentIds: next ? own.map((each) => each.id) : [first.id],
+ },
+ });
+ };
+
+ return (
+ <>
+
+
+
+
+
+
+
+
+ Hand work to agents
+
+
+ {orchestrate
+ ? "This Bot answers quickly and hands the work to the agents below. They act with this Bot's apps, as the person who asked."
+ : "This Bot does the work itself, with its apps."}
+
+
+
+
+
+
+
+ {toggle.error ? (
+
+ );
+}
diff --git a/app/src/components/bot-profile/settings-rows.tsx b/app/src/components/bot-profile/settings-rows.tsx
index 58d1cbfbce..0c1ee3a387 100644
--- a/app/src/components/bot-profile/settings-rows.tsx
+++ b/app/src/components/bot-profile/settings-rows.tsx
@@ -1,6 +1,7 @@
import {
IconChevronRight,
IconDeviceMobile,
+ IconSitemap,
IconUsersGroup,
} from "@tabler/icons-react";
import { useQuery } from "@tanstack/react-query";
@@ -27,6 +28,7 @@ import type { AgentProfile } from "@/lib/agents/queries";
import { approvalInboxOptions, ruleCoversBot } from "@/lib/approvals";
import { currentUserQueryOptions } from "@/lib/auth/queries";
import { isOrganizationAdmin } from "@/lib/auth/roles";
+import { delegationSummary } from "@/lib/bot-agents/queries";
import { destinationsQueryOptions } from "@/lib/delivery";
import {
deploymentCapabilitiesQueryOptions,
@@ -41,7 +43,7 @@ import { mergeRoutines } from "@/lib/routines/merged";
import { routinesQueryOptions } from "@/lib/routines/queries";
import { teamBotsQueryOptions } from "@/lib/team-bots";
import { connectorCount } from "./access";
-import { useBotPlugins } from "./use-bot-reads";
+import { useBotDelegation, useBotPlugins } from "./use-bot-reads";
type Row = {
to:
@@ -52,6 +54,7 @@ type Row = {
| "/bots/$agentId/computer"
| "/bots/$agentId/approvals"
| "/bots/$agentId/setup"
+ | "/bots/$agentId/agents"
| "/bots/$agentId/sharing"
| "/bots/$agentId/reach";
title: string;
@@ -86,6 +89,7 @@ export function BotSettingsRows({ agent }: { agent: AgentProfile }) {
...destinationsQueryOptions(),
enabled: !personal,
});
+ const delegation = useBotDelegation(agent.id);
const published = teamBots.data?.find((bot) => bot.botId === agent.id);
const admin = isOrganizationAdmin(me?.role);
// Its owner and admins change it there; anyone it is published to finds its link there.
@@ -188,6 +192,12 @@ export function BotSettingsRows({ agent }: { agent: AgentProfile }) {
icon: SETUP.icon,
summary: setupSummary(agent, personal ? "personal" : "team"),
},
+ {
+ to: "/bots/$agentId/agents",
+ title: "Agents",
+ icon: IconSitemap,
+ summary: delegation.data ? delegationSummary(delegation.data) : "",
+ },
...(canShare
? [
{
diff --git a/app/src/components/bot-profile/use-bot-reads.ts b/app/src/components/bot-profile/use-bot-reads.ts
index f449fcc43e..7901a7024c 100644
--- a/app/src/components/bot-profile/use-bot-reads.ts
+++ b/app/src/components/bot-profile/use-bot-reads.ts
@@ -2,6 +2,7 @@ import { useQuery } from "@tanstack/react-query";
import { useDeletedHere } from "@/components/routines/routine-detail-missing";
import { deleteAgentMutationKey } from "@/lib/agents/mutations";
import { agentQueryOptions } from "@/lib/agents/queries";
+import { botDelegationQueryOptions } from "@/lib/bot-agents/queries";
import { botActivityQueryOptions } from "@/lib/bot-lifecycle/queries";
import { agentPluginsQueryOptions } from "@/lib/plugins/queries";
@@ -35,3 +36,12 @@ export function useBotPlugins(agentId: string) {
enabled: agentId.length > 0 && !deleted,
});
}
+
+/** How the Bot works and the agents it may use, read until the Bot is deleted from this browser. */
+export function useBotDelegation(agentId: string) {
+ const deleted = useBotDeletedHere(agentId);
+ return useQuery({
+ ...botDelegationQueryOptions(agentId),
+ enabled: agentId.length > 0 && !deleted,
+ });
+}
diff --git a/app/src/components/channels/channel-chat.tsx b/app/src/components/channels/channel-chat.tsx
index 9ebea7c6ff..b44e1fe1aa 100644
--- a/app/src/components/channels/channel-chat.tsx
+++ b/app/src/components/channels/channel-chat.tsx
@@ -46,6 +46,7 @@ import {
carryingOnAfterApproval,
leftAnswers,
} from "@/lib/approvals";
+import { useBotTakesModelChoice } from "@/lib/bot-agents/queries";
import { attachmentUrl } from "@/lib/channels/attachments";
import {
recordChannelActivityMutationOptions,
@@ -70,10 +71,6 @@ import {
} from "@/lib/channels/turns-finished-away";
import { publishedPlaygroundQueryOptions } from "@/lib/components/queries";
import { useConversationActivity } from "@/lib/computers/activity";
-import {
- useConnectionLost,
- useReconnected,
-} from "@/lib/desktop/connection-lost";
import { channelAgentId, useActiveBot } from "@/lib/copilot/active-bot";
import {
observeApprovalAgent,
@@ -105,6 +102,10 @@ import {
readThreadMessages,
withCurrentA2uiVersions,
} from "@/lib/copilot/thread-messages";
+import {
+ useConnectionLost,
+ useReconnected,
+} from "@/lib/desktop/connection-lost";
import { modelCatalogueQueryOptions } from "@/lib/models/queries";
import { useConversationModel } from "@/lib/models/run-model";
import { useSkillCommands } from "@/lib/plugins/skill-commands";
@@ -1011,13 +1012,18 @@ export function ChannelChat({
* The model this conversation's Bot answers on. Only a Bot that runs inside OpenBot uses OpenBot's
* model, so only it gets a picker; a Bot on its own framework picks its own model.
*/
+ /*
+ * Not a Bot that hands work to agents either: its own model is set on its Agents page, and each
+ * agent keeps its own.
+ */
+ const picksModel = useBotTakesModelChoice(botProfile);
const models = useQuery({
...modelCatalogueQueryOptions(),
- enabled: botProfile?.runsOnOpenBotModel === true,
+ enabled: picksModel,
});
const runModel = useConversationModel(
channel.id,
- botProfile?.runsOnOpenBotModel ? models.data : undefined,
+ picksModel ? models.data : undefined,
);
/*
* History is the snapshot, the stored thread AND the voice archive. The transcript shows none of
@@ -1871,9 +1877,7 @@ export function ChannelChat({
commands={skillCommands}
modelPicker={
{
+ if (taskThread && threadId)
+ publishThreadWork(threadId, threadWorkOf(visible));
+ });
+ const taskWork = {
+ folds,
+ lastAskId: [...folds.at.values()].at(-1)?.askId,
+ };
/*
* The folders this conversation's "Check your folders" steps named, for its other folder steps.
* The same map while the names are the same: a new one on every render is a new context value,
@@ -2498,65 +2527,88 @@ export function ChatTranscript({
* One row, wherever it is drawn. `index` is the row's place in `items`, not in the slice being
* drawn, so "the last row" and "latest" mean the same with or without older pages above.
*/
- const renderRow = (item: TranscriptItem, index: number) =>
+ /*
+ * What one row draws, without the scroller's wrapper: drawn on its own below, and inside a task
+ * turn's "Worked for" row when it folds there (`foldTurnWork`).
+ */
+ const rowContent = (item: TranscriptItem, index: number) =>
item.kind === "tools" || item.kind === "tool" ? (
-
- = turnStart}
- latest={index >= latestIndex}
- spokeAfter={lastBotWords > index}
- steps={item.kind === "tools" ? item.steps : [item]}
- />
-
+ = turnStart}
+ latest={index >= latestIndex}
+ spokeAfter={lastBotWords > index}
+ steps={item.kind === "tools" ? item.steps : [item]}
+ />
) : item.kind === "activity" ? (
-
-
-
+
) : item.kind === "text" ? (
-
-
-
+ settled={!busy || index < turnStart}
+ commandLabels={commandLabels}
+ role={item.role}
+ slackNames={slackNames}
+ streaming={
+ busy && item.role === "assistant" && index === items.length - 1
+ }
+ text={item.text}
+ />
) : item.kind === "attachments" ? (
+
+ ) : (
+ // Every member of the union is handled above. `assertNever` types `item` as
+ // `never` here, so a future addition to `VisibleChatItem` fails to typecheck at
+ // this call instead of silently falling into this branch and rendering nothing.
+ assertNever(item)
+ );
+
+ /*
+ * One row, wherever it is drawn. `index` is the row's place in `items`, not in the slice being
+ * drawn, so "the last row" and "latest" mean the same with or without older pages above. In a
+ * task's thread a turn's work is one row, drawn where its first step is; the rest of it is drawn
+ * inside that row.
+ */
+ const renderRow = (item: TranscriptItem, index: number) => {
+ const work = taskWork.folds.at.get(item.id);
+ if (work)
+ return (
+
+
+ {work.rows.map((row) => (
+
+ {rowContent(row.item, row.index)}
+
+ ))}
+
+
+ );
+ if (taskWork.folds.inside.has(item.id)) return null;
+ return (
-
+ {rowContent(item, index)}
- ) : (
- // Every member of the union is handled above. `assertNever` types `item` as
- // `never` here, so a future addition to `VisibleChatItem` fails to typecheck at
- // this call instead of silently falling into this branch and rendering nothing.
- assertNever(item)
);
+ };
return (
diff --git a/app/src/components/channels/tool-activity.tsx b/app/src/components/channels/tool-activity.tsx
index cd7b3bb419..d9a1552f0e 100644
--- a/app/src/components/channels/tool-activity.tsx
+++ b/app/src/components/channels/tool-activity.tsx
@@ -228,7 +228,7 @@ export function useDrawnTool(): (name: string) => boolean {
* they cannot use yet (not connected, lost at the vendor, or a team account nobody connected) — and neither may sit behind a disclosure for the same reason: a question
* nobody can see is a conversation that has stopped without saying so.
*/
-function asksThePerson(result: string | undefined): boolean {
+export function asksThePerson(result: string | undefined): boolean {
if (result === undefined) return false;
const answer = asText(result);
if (!answer.startsWith(REFUSAL_MARKER)) return false;
diff --git a/app/src/components/needs-you/board-row.tsx b/app/src/components/needs-you/board-row.tsx
index 8996e744c0..bdae3e1fd0 100644
--- a/app/src/components/needs-you/board-row.tsx
+++ b/app/src/components/needs-you/board-row.tsx
@@ -1,15 +1,47 @@
-import { Fragment, type ReactNode, useState } from "react";
+import { IconDots } from "@tabler/icons-react";
+import {
+ Fragment,
+ type ReactNode,
+ useLayoutEffect,
+ useRef,
+ useState,
+} from "react";
+import { Button } from "@/components/ui/button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
import { cn } from "@/lib/utils";
+/**
+ * An action a row can put in its menu when its line has no room: the button drawn on the row, and
+ * the same action as an item in the row's "More actions" menu.
+ */
+export type SecondaryAction = {
+ key: string;
+ button: ReactNode;
+ menuItem: ReactNode;
+};
+
/**
* One row of the Needs you board, whatever it holds: a question, an action to allow, a task, or
* something a check-in found. One shape for all of them, so the board reads as one list.
*
* An icon in a small square (tinted where a Bot is stopped on the person), the title and one line
- * of detail, each cut to a line until the row is opened with a click, a quiet line of where and
- * when, and the row's actions on the right, or under the words where the row is too narrow for
- * both. `more` is what opens under the row; `onSelect` opens something else instead (a question's
- * answer dialog).
+ * of detail, a quiet line of where and when, and the row's actions on the right. `more` is what
+ * opens under the row; `onSelect` opens something else instead (a question's answer dialog).
+ *
+ * WHERE THE ROW IS NARROW (a phone, a chat's width, a window with the sidebar beside it) it stacks:
+ * the title in full and the status line across the row, and the actions on a line of their own
+ * under them. FOUND LIVE at 390px: with the actions kept beside the words, a task waiting on a
+ * question had a title of "P.." and its status ran down the row a word to a line. Where the row is
+ * wide, the actions sit on the right and the title and detail are cut to a line until it is opened.
+ * Whether it is narrow is the row's own width (a container query), not the window's.
+ *
+ * `secondary` are the actions that matter least (Mark done, Open beside a task's answers). They are
+ * buttons on the row while its line has room for them, and move into a "More actions" menu when it
+ * does not, measured on the row as drawn.
*/
export function BoardRow({
icon,
@@ -19,6 +51,7 @@ export function BoardRow({
detail,
meta = [],
actions,
+ secondary = [],
more,
open: openFromParent,
wholeDetail = false,
@@ -34,7 +67,13 @@ export function BoardRow({
detail?: string | null;
/** Small pieces of where and when, joined with a dot. */
meta?: ReactNode[];
- actions?: ReactNode;
+ /**
+ * The row's answers. Given as a function, it is handed the folded secondary actions' menu items
+ * (null while they are buttons) to put in a menu of its own, so the row never has two menus.
+ */
+ actions?: ReactNode | ((folded: ReactNode | null) => ReactNode);
+ /** Drawn after `actions`, and folded into a menu when the line has no room for them. */
+ secondary?: SecondaryAction[];
/** Drawn under the row while it is open. */
more?: ReactNode;
/** Opened by the parent (an Answer button), as well as by a click on the text. */
@@ -56,13 +95,18 @@ export function BoardRow({
const open = opened || openFromParent === true;
const opens = Boolean(onSelect || (detail && !wholeDetail) || more || title);
const shownMeta = meta.filter(Boolean);
+ const { content, actionLine, folded } = useFolding(secondary.length > 0);
+ const hasActions = Boolean(actions) || secondary.length > 0;
+ const menuItems = secondary.map((action) => (
+ {action.menuItem}
+ ));
return (
-
+
{icon}
- {/*
- * The words and the buttons share a line while the words keep room to be read (20rem), and
- * the buttons go under the words, lined up with them, where they don't. On a phone or in a
- * narrow window, three buttons beside the words squeezed them to a word or two per line.
- */}
-
);
}
+/**
+ * A row's menu is as wide as its longest item, on one line, and never wider than the window has room
+ * for. Left at the trigger's width it was 128px, and "Allow for this conversation" broke in two.
+ */
+export const ROW_MENU_WIDTH = "w-max max-w-(--available-width)";
+
+/** A row's menu, behind a "…" button named for what it holds. */
+export function RowMenu({
+ label,
+ children,
+}: {
+ label: string;
+ children: ReactNode;
+}) {
+ return (
+
+ }
+ >
+
+
+
+ {children}
+
+
+ );
+}
+
+/**
+ * Whether a row's secondary actions are folded into its menu: when the row is stacked (its actions on
+ * a line of their own under its words) and that line is narrower than the actions drawn whole. The
+ * width they need whole is remembered from when they were last drawn, so they come back as soon as
+ * the line is wide enough again, and a wide row, its actions on the right, never folds.
+ *
+ * Measured on the row as the browser lays it out. Where nothing is laid out (no ResizeObserver, or
+ * every width zero), nothing folds.
+ */
+function useFolding(enabled: boolean) {
+ const content = useRef(null);
+ const actionLine = useRef(null);
+ const [folded, setFolded] = useState(false);
+ const foldedNow = useRef(false);
+ const wholeWidth = useRef(0);
+ useLayoutEffect(() => {
+ const words = content.current;
+ const line = actionLine.current;
+ if (!enabled || !words || !line || typeof ResizeObserver === "undefined")
+ return;
+ const fold = (next: boolean) => {
+ foldedNow.current = next;
+ setFolded(next);
+ };
+ const check = () => {
+ const stacked =
+ line.getBoundingClientRect().top >=
+ words.getBoundingClientRect().bottom - 1;
+ if (!stacked) {
+ if (foldedNow.current) fold(false);
+ return;
+ }
+ if (!foldedNow.current) {
+ if (line.scrollWidth > line.clientWidth + 1) {
+ wholeWidth.current = line.scrollWidth;
+ fold(true);
+ }
+ } else if (line.clientWidth >= wholeWidth.current) fold(false);
+ };
+ check();
+ const observer = new ResizeObserver(check);
+ observer.observe(line);
+ observer.observe(words);
+ return () => observer.disconnect();
+ }, [enabled]);
+ return { content, actionLine, folded };
+}
+
function RowText({
title,
detail,
@@ -141,7 +282,10 @@ function RowText({
diff --git a/app/src/components/needs-you/board.tsx b/app/src/components/needs-you/board.tsx
index 36ab7b2889..7385731d65 100644
--- a/app/src/components/needs-you/board.tsx
+++ b/app/src/components/needs-you/board.tsx
@@ -6,6 +6,7 @@ import {
useHeldAnswers,
useWaitingByBot,
} from "@/components/approvals/waiting";
+import { useWaitingOnYou } from "@/components/bot-profile/attention";
import { PageSection } from "@/components/layout/page-shell";
import { SuggestionRow } from "@/components/suggestions/suggestion-row";
import { TaskBoardRow } from "@/components/tasks/task-row";
@@ -51,14 +52,18 @@ export function NeedsYouBoard({ agentId }: { agentId?: string }) {
// A task waiting on something in its thread is answered on its own row.
const heldAnswer = useHeldAnswers();
+ /*
+ * ONE COUNT, THE BADGE'S. How many things wait on the person is the number the Bots badge shows
+ * (`waitingOnYou`, the server's rule), read from the same answer, for every Bot or for this one:
+ * the board counted its own rows and said "18 waiting" beside a badge of 16. The two it had over
+ * were tasks under a Bot no longer shared with the person, which the server leaves out, as it
+ * leaves out every Bot they can't reach: there is nothing left there for them to read, answer or
+ * try again, only to mark done. Those rows are still listed, and are not counted.
+ */
+ const waitingOn = useWaitingOnYou();
+ const waitingCount = waitingOn(agentId);
const blocked = new Map(waiting.byBot);
- // Questions and actions each wait on the person; a task does when the badge counts it.
- let waitingCount = [...waiting.byBot.values()].reduce(
- (total, group) => total + group.rows.length,
- 0,
- );
for (const listed of list.tasks) {
- if (countsAsWaiting(listed)) waitingCount += 1;
const group = blocked.get(listed.task.agentId) ?? { rows: [], times: [] };
group.rows.push(
Date.parse(at) < Date.parse(first) ? at : first,
diff --git a/app/src/components/needs-you/needs-you.tsx b/app/src/components/needs-you/needs-you.tsx
index 96d1a4608a..102be4bd93 100644
--- a/app/src/components/needs-you/needs-you.tsx
+++ b/app/src/components/needs-you/needs-you.tsx
@@ -20,7 +20,7 @@ import {
proactiveSuggestionsQueryOptions,
} from "@/lib/proactive";
import { readFailure } from "@/lib/read-failure";
-import { type ListedTask, orderTasks } from "@/lib/tasks/groups";
+import { type ListedTask, onTheBoard, orderTasks } from "@/lib/tasks/groups";
import { taskListQueryOptions } from "@/lib/tasks/queries";
/** How many items show before the rest fold behind "Show more". */
@@ -44,7 +44,10 @@ export function useBotName() {
*
* - `tasks`: every task not yet resolved, in OpenDuet's order (ready for review, needs input,
* failed, working). A working task stays beside the ones that need the person, because it is the
- * item they just started and it comes back here when it is ready.
+ * item they just started and it comes back here when it is ready. A delegated task that has
+ * finished is not here (`onTheBoard`): its result is in the conversation that asked for
+ * it and it is on its Bot's Activity page under Done, so the board, OpenDuet's Tasks and
+ * OpenFuse's bell all leave it out.
* - `done`: tasks marked done this week, for Reopen.
* - `items`: open items, newest first.
*
@@ -72,7 +75,7 @@ export function useNeedsYou(agentId?: string) {
tasks: readFailure(taskList),
checkIns: readFailure(suggestions),
},
- tasks: listed.filter(({ status }) => status !== "resolved"),
+ tasks: listed.filter(onTheBoard),
done: listed.filter(({ status }) => status === "resolved"),
items: (suggestions.data ?? []).filter(
(item) => agentId === undefined || item.botId === agentId,
diff --git a/app/src/components/tasks/task-details.tsx b/app/src/components/tasks/task-details.tsx
new file mode 100644
index 0000000000..46addc39ab
--- /dev/null
+++ b/app/src/components/tasks/task-details.tsx
@@ -0,0 +1,256 @@
+import {
+ IconArrowUpRight,
+ IconCube,
+ IconDeviceDesktop,
+ IconFileText,
+ IconPlug,
+ IconWorld,
+} from "@tabler/icons-react";
+import { useQuery } from "@tanstack/react-query";
+import { type ReactNode, useState } from "react";
+import { HarnessMark } from "@/components/agents/harness-mark";
+import { ChannelAvatar } from "@/components/channels/avatar";
+import { setupSummary } from "@/lib/agents/bot-summaries";
+import { agentQueryOptions } from "@/lib/agents/queries";
+import { deploymentCapabilitiesQueryOptions } from "@/lib/deployment/queries";
+import { markFor } from "@/lib/marks";
+import { modelCatalogueQueryOptions } from "@/lib/models/queries";
+import { type BotTask, taskTurnsQueryOptions } from "@/lib/tasks/queries";
+import { type Output, type Source, useThreadWork } from "./thread-work";
+
+/*
+ * A task's details, beside its thread: which Bot ran it and on what, what it read, and what it
+ * made, as dots lays out a task's Outputs, Sources and Environment. Stacked for the narrow pane,
+ * each a short list of one-line rows that open what they name.
+ *
+ * Who ran it is the Bot and what runs it (its framework, or built in). The model is the one the
+ * task's latest turn used, as the server recorded it (listTaskTurns). Sources and outputs are read
+ * from the thread itself (`threadWorkOf`). The Bot's computer is named only when the task used it.
+ */
+
+/** How many rows a list shows before "View all". */
+const SHOWN = 4;
+
+function Section({ title, children }: { title: string; children: ReactNode }) {
+ return (
+
+
+ {title}
+
+ {children}
+
+ );
+}
+
+/** One line of a list: its icon, what it names, and the way to it when it has one. */
+function Row({
+ icon,
+ label,
+ detail,
+ href,
+}: {
+ icon: ReactNode;
+ label: string;
+ detail?: string;
+ href?: string;
+}) {
+ const body = (
+ <>
+
+ {icon}
+
+
+ {label}
+ {detail ? (
+
+ {detail}
+
+ ) : null}
+
+ {href ? (
+
+ ) : null}
+ >
+ );
+ const shape = "-mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5";
+ return (
+
@@ -613,6 +682,8 @@ export function SentFromBot({
const task = tasks?.find((task) => task.threadId === threadId);
const name = bots?.find((bot) => bot.id === task?.agentId)?.name;
const label = `Sent from ${name ?? "your Bot"}`;
+ // The agent the Bot handed it to, when it handed it to one: said after the link, as plain words.
+ const to = task?.agent?.name ? ` to ${task.agent.name}` : "";
return (
{to} : null}
{brief}
diff --git a/app/src/components/tasks/thread-work.ts b/app/src/components/tasks/thread-work.ts
new file mode 100644
index 0000000000..db215f14c8
--- /dev/null
+++ b/app/src/components/tasks/thread-work.ts
@@ -0,0 +1,124 @@
+import { useSyncExternalStore } from "react";
+import type { VisibleChatItem } from "@/components/channels/chat-messages";
+import { stepDetailsIn } from "@/components/channels/tool-activity";
+import { asText } from "@/lib/plugins/tool-result";
+
+/*
+ * What a task used and what it made, read from its own thread: the web pages it read, the apps it
+ * looked in, and the changes it made in them, as its Details pane lists them (dots' Sources and
+ * Outputs). Nothing new is asked of the server: every step is already in the thread, with the
+ * line the server put on each app call's answer saying whether the app changed anything ("Ran: read
+ * only, nothing was changed." or "Ran: the app made this change.").
+ *
+ * The transcript works this out as it draws the thread, and hands it to the pane beside it through
+ * a small store, so the pane never reads the conversation a second time.
+ */
+
+/** A page the task read. */
+export type SourcePage = { kind: "page"; href: string; title?: string };
+/** An app the task looked in. */
+export type SourceApp = { kind: "app"; app: string };
+export type Source = SourcePage | SourceApp;
+
+/** Something the task made or changed, and where it can be opened when the app said. */
+export type Output = { label: string; app?: string; href?: string };
+
+export type ThreadWork = {
+ sources: Source[];
+ outputs: Output[];
+ /** Whether it worked on the Bot's computer: a page opened in its browser. */
+ usedComputer: boolean;
+};
+
+export const NO_THREAD_WORK: ThreadWork = {
+ sources: [],
+ outputs: [],
+ usedComputer: false,
+};
+
+/** The first web address in an app's answer: where the thing it made can be opened. */
+function firstLink(text: string): string | undefined {
+ return text.match(/https?:\/\/[^\s"'<>)\]]+/)?.[0]?.replace(/[.,;]+$/, "");
+}
+
+/** Whether an app's answer says it changed something. Its server says so on the first line. */
+function changedSomething(text: string): boolean {
+ return (
+ /^(?:Partly ran|Already done):/.test(text) ||
+ (/^Ran:/.test(text) && !/^Ran: read only/.test(text))
+ );
+}
+
+/** The sources and outputs in a thread's items, each once, in the order the task met them. */
+export function threadWorkOf(items: readonly VisibleChatItem[]): ThreadWork {
+ const details = stepDetailsIn(new Map());
+ const sources: Source[] = [];
+ const outputs: Output[] = [];
+ const pages = new Set();
+ const apps = new Set();
+ const made = new Set();
+ let usedComputer = false;
+ const page = (href: string | undefined, title?: string) => {
+ if (!href || !/^https?:\/\//.test(href) || pages.has(href)) return;
+ pages.add(href);
+ sources.push({ kind: "page", href, ...(title ? { title } : {}) });
+ };
+ for (const item of items) {
+ if (item.kind !== "tool" || item.result === undefined) continue;
+ const step = details(item);
+ if (step.failed || step.refused || step.pending) continue;
+ if (step.kind === "browser") {
+ usedComputer = true;
+ page(step.href, step.detail);
+ continue;
+ }
+ if (step.kind === "search" || step.kind === "fetch") {
+ for (const found of step.sources ?? []) page(found.url, found.title);
+ if (!step.sources?.length) page(step.href);
+ continue;
+ }
+ if (step.kind !== "connector" || !step.connector) continue;
+ const answer = asText(item.result);
+ if (changedSomething(answer)) {
+ const href = firstLink(answer);
+ const key = href ?? `${step.connector}\n${step.label}\n${step.detail}`;
+ if (made.has(key)) continue;
+ made.add(key);
+ outputs.push({
+ label: step.detail ? `${step.label} ${step.detail}` : step.label,
+ app: step.connector,
+ ...(href ? { href } : {}),
+ });
+ } else if (!apps.has(step.connector)) {
+ apps.add(step.connector);
+ sources.push({ kind: "app", app: step.connector });
+ }
+ }
+ return { sources, outputs, usedComputer };
+}
+
+/* The store: the transcript publishes each thread's work, the Details pane reads it. */
+const work = new Map();
+const listeners = new Set<() => void>();
+
+function same(a: ThreadWork | undefined, b: ThreadWork): boolean {
+ return a !== undefined && JSON.stringify(a) === JSON.stringify(b);
+}
+
+/** Say what a thread's task used and made, as its transcript reads it now. */
+export function publishThreadWork(threadId: string, next: ThreadWork): void {
+ if (same(work.get(threadId), next)) return;
+ work.set(threadId, next);
+ for (const listener of listeners) listener();
+}
+
+/** What a thread's task used and made, kept current while its transcript is drawn. */
+export function useThreadWork(threadId: string | undefined): ThreadWork {
+ return useSyncExternalStore(
+ (listener) => {
+ listeners.add(listener);
+ return () => listeners.delete(listener);
+ },
+ () => (threadId ? (work.get(threadId) ?? NO_THREAD_WORK) : NO_THREAD_WORK),
+ );
+}
diff --git a/app/src/components/tasks/turn-work.ts b/app/src/components/tasks/turn-work.ts
new file mode 100644
index 0000000000..6caa175197
--- /dev/null
+++ b/app/src/components/tasks/turn-work.ts
@@ -0,0 +1,161 @@
+import { SUBAGENT_TOOL } from "@openbot/shared/subagent";
+import {
+ asksThePerson,
+ type TranscriptItem,
+} from "@/components/channels/tool-activity";
+import { isPersonSentMessage } from "@/components/channels/transcript-turns";
+import { claudeCodeCall } from "@/lib/copilot/coding-calls";
+
+/*
+ * A task's thread, read the way dots reads one: what it was asked, one "Worked for 2m" row, and
+ * what it came back with. The steps it took and the lines it said on the way fold into that row,
+ * which opens to them.
+ *
+ * Only work folds: a run of tool lines (`tools`), a step the app draws as a card of its own (a
+ * command it ran, a file it changed, a page it opened on its computer, a subtask), and what the Bot
+ * said before its answer. What is drawn for the person (a chart, a table, an app's card, a
+ * question, a request for help, an approval still waiting) stays where it is, because it is either
+ * part of the answer or something the person has to act on, and neither may sit behind a
+ * disclosure. A turn still running keeps its newest line out, since it may be the answer arriving.
+ */
+
+/** One turn's work, folded: where it is drawn, what it answered, and the rows inside it. */
+export type TurnWork = {
+ /** The row's own key: `work:` and the first folded row's id, kept for the turn's whole life. */
+ id: string;
+ /** The person's message (or the Bot's brief) the turn answered, as the thread names it. */
+ askId: string;
+ /** The rows it holds, in order, each with its place among the transcript's items. */
+ rows: { item: TranscriptItem; index: number }[];
+ /** The turn is still under way. */
+ running: boolean;
+};
+
+export type TurnWorkFolds = {
+ /** Each fold, by the id of the first row it holds, which is where it is drawn. */
+ at: Map;
+ /** Every row inside a fold, drawn there and not on its own. */
+ inside: Set;
+};
+
+/** No folds: a thread that is not a task's. */
+export const NO_TURN_WORK: TurnWorkFolds = { at: new Map(), inside: new Set() };
+
+/**
+ * Whether a call drawn on its own is a step of the work: Claude Code's own tools, the Bot computer's
+ * (but not its requests to the person), an app's call, a subtask. Finished, and asking nothing.
+ */
+function isWorkStep(item: Extract): boolean {
+ if (item.result === undefined || asksThePerson(item.result)) return false;
+ const { name, arguments: args } = item.toolCall.function;
+ if (name.startsWith("mcp__") || name === SUBAGENT_TOOL) return true;
+ if (name.startsWith("computer_"))
+ return !name.startsWith("computer_request_");
+ return claudeCodeCall(name, args);
+}
+
+/**
+ * Whether a run of tool lines still waits on the person: a step held for their approval (`waiting`,
+ * the approval inbox's open requests by tool call; its card is drawn under the run's line), a step
+ * with no answer in a turn that is over, and a step whose answer asks them to connect or consent.
+ * Any of these stays out of the fold, card and all. FOUND BY THE APPROVALS JOURNEYS: a payment's
+ * approval card folded into "Worked for 5s", so the thread showed nothing to answer, in a task's
+ * turn and in a turn the person typed into the thread alike.
+ */
+function waitsOnThePerson(
+ item: Extract,
+ inFlight: boolean,
+ waiting: ReadonlySet,
+): boolean {
+ return item.steps.some(
+ (step) =>
+ waiting.has(step.toolCall.id) ||
+ (step.result === undefined && !inFlight) ||
+ asksThePerson(step.result),
+ );
+}
+
+function isPersons(item: TranscriptItem): boolean {
+ return (
+ (item.kind === "text" && isPersonSentMessage(item.role, item.text)) ||
+ item.kind === "attachments"
+ );
+}
+
+/**
+ * The folds of a task thread's turns. `running` says the last turn is still under way: the person's
+ * browser is streaming it, or the task reads Working. `waiting` is the tool calls held for the
+ * person's approval (`useWaitingToolCalls`).
+ */
+export function foldTurnWork(
+ items: readonly TranscriptItem[],
+ running: boolean,
+ waiting: ReadonlySet = new Set(),
+): TurnWorkFolds {
+ const folds: TurnWorkFolds = { at: new Map(), inside: new Set() };
+ // Where each turn starts: just after what the person (or the brief) said.
+ const starts: { askId: string; at: number; from: number }[] = [];
+ items.forEach((item, index) => {
+ if (!isPersons(item)) return;
+ const previous = starts.at(-1);
+ // A caption and its files are one ask: the turn answers the text, when there is text.
+ if (previous && previous.from === index) {
+ if (item.kind === "text") previous.askId = item.id;
+ previous.from = index + 1;
+ return;
+ }
+ starts.push({ askId: item.id, at: index, from: index + 1 });
+ });
+ starts.forEach((start, turn) => {
+ const end = starts[turn + 1]?.at ?? items.length;
+ const inFlight = running && turn === starts.length - 1;
+ const said: number[] = [];
+ for (let index = start.from; index < end; index += 1) {
+ const item = items[index];
+ if (item?.kind === "text" && item.role === "assistant") said.push(index);
+ }
+ // What it came back with: its last line, once the turn is over; while it runs, the newest line
+ // only when it is the newest row, since that may be the answer arriving.
+ const answer = inFlight
+ ? said.at(-1) === end - 1
+ ? end - 1
+ : -1
+ : (said.at(-1) ?? -1);
+ const rows: TurnWork["rows"] = [];
+ for (let index = start.from; index < end; index += 1) {
+ const item = items[index];
+ if (!item || index === answer) continue;
+ if (
+ (item.kind === "tools" && !waitsOnThePerson(item, inFlight, waiting)) ||
+ (item.kind === "tool" && isWorkStep(item)) ||
+ (item.kind === "text" && item.role === "assistant")
+ )
+ rows.push({ item, index });
+ }
+ const first = rows[0];
+ if (!first) return;
+ const work: TurnWork = {
+ id: `work:${first.item.id}`,
+ askId: start.askId,
+ rows,
+ running: inFlight,
+ };
+ folds.at.set(first.item.id, work);
+ for (const row of rows) folds.inside.add(row.item.id);
+ });
+ return folds.at.size ? folds : NO_TURN_WORK;
+}
+
+/** How many steps a fold holds: each tool call in it, a run of them counted call by call. */
+export function stepsIn(work: TurnWork): number {
+ return work.rows.reduce(
+ (count, { item }) =>
+ count +
+ (item.kind === "tools"
+ ? item.steps.length
+ : item.kind === "tool"
+ ? 1
+ : 0),
+ 0,
+ );
+}
diff --git a/app/src/components/tasks/worked-for.tsx b/app/src/components/tasks/worked-for.tsx
new file mode 100644
index 0000000000..ce5625badc
--- /dev/null
+++ b/app/src/components/tasks/worked-for.tsx
@@ -0,0 +1,209 @@
+import { readBrief } from "@openbot/shared/orchestration";
+import {
+ type QueryClient,
+ QueryClientContext,
+ useQuery,
+ useQueryClient,
+} from "@tanstack/react-query";
+import {
+ type ReactNode,
+ useContext,
+ useEffect,
+ useMemo,
+ useRef,
+ useSyncExternalStore,
+} from "react";
+import type { TranscriptItem } from "@/components/channels/tool-activity";
+import { ToolLine } from "@/components/channels/tool-line";
+import { type ApprovalInboxData, approvalInboxOptions } from "@/lib/approvals";
+import { briefDuration, useSecondsSince } from "@/lib/elapsed";
+import {
+ type BotTask,
+ type TaskTurn,
+ taskKeys,
+ taskListQueryOptions,
+ taskTurnsQueryOptions,
+} from "@/lib/tasks/queries";
+import { stepsIn, type TurnWork } from "./turn-work";
+
+/*
+ * The one row a turn's work folds into in a task's thread: "Worked for 2m", opening to every step
+ * and every line the Bot said on the way. Drawn as the transcript's own folded lines are
+ * (`ToolLine`), so it reads as one more thing the Bot did. While the turn runs it says how long it
+ * has been working, and shimmers.
+ *
+ * How long is the server's: the time the turn's runs took, added up, never the time it waited on
+ * the person (listTaskTurns). A turn the server has no record of yet says how many steps it took.
+ */
+
+const NOTHING_WAITING: ReadonlySet = new Set();
+const NO_CLIENT = () => () => undefined;
+
+/**
+ * The tool calls held for the person's approval, by id: the approval inbox's open requests, as the
+ * cards under a run's line read them (`PendingApprovals`). Read from the inbox the conversation
+ * already keeps loaded, and followed as it changes; with no query client, nothing waits.
+ */
+export function useWaitingToolCalls(
+ client: QueryClient | undefined,
+): ReadonlySet {
+ const key = approvalInboxOptions().queryKey;
+ const inbox = useSyncExternalStore(
+ client ? (change) => client.getQueryCache().subscribe(change) : NO_CLIENT,
+ () => client?.getQueryData(key),
+ );
+ return useMemo(() => {
+ const ids = (inbox?.requests ?? []).flatMap((request) =>
+ (request.status === "pending" || request.left) &&
+ request.action.toolCallId
+ ? [request.action.toolCallId]
+ : [],
+ );
+ return ids.length ? new Set(ids) : NOTHING_WAITING;
+ }, [inbox]);
+}
+
+/**
+ * Whether a thread is a task's: its first message is a Bot's brief, or a task the person has read
+ * runs in it. Read from what is already loaded; a thread drawn with no query client is a task's only
+ * by its brief.
+ */
+export function isTaskThread(
+ threadId: string | undefined,
+ items: readonly TranscriptItem[],
+ client: QueryClient | undefined,
+): boolean {
+ const first = items.find(
+ (item) => item.kind === "text" && item.role === "user",
+ );
+ if (first?.kind === "text" && readBrief(first.text) !== null) return true;
+ if (!threadId || !client) return false;
+ return (
+ client
+ .getQueryData(taskKeys.list)
+ ?.some((task) => task.threadId === threadId) ?? false
+ );
+}
+
+/** A turn's runs are written down as it ends: read once then, and once more a moment after. */
+const READ_AGAIN_MS = 2_000;
+
+/** What the row says, and whether it is still moving. */
+function label(
+ work: TurnWork,
+ running: boolean,
+ seconds: number | undefined,
+ turn: TaskTurn | undefined,
+): string {
+ if (running)
+ return seconds === undefined
+ ? "Working"
+ : `Working for ${briefDuration(seconds)}`;
+ if (turn) return `Worked for ${briefDuration(turn.workedSeconds)}`;
+ const steps = stepsIn(work);
+ return steps === 0
+ ? "Worked on it"
+ : `Worked through ${steps} ${steps === 1 ? "step" : "steps"}`;
+}
+
+export function WorkedFor({
+ threadId,
+ work,
+ last,
+ children,
+}: {
+ threadId: string | undefined;
+ work: TurnWork;
+ /** This is the thread's newest turn, the one a task that reads Working is working on. */
+ last: boolean;
+ /** The folded rows, drawn as they would be on their own. */
+ children: ReactNode;
+}) {
+ const client = useContext(QueryClientContext);
+ return client && threadId ? (
+
+ {children}
+
+ ) : (
+
+ {children}
+
+ );
+}
+
+function TimedWork({
+ threadId,
+ work,
+ last,
+ children,
+}: {
+ threadId: string;
+ work: TurnWork;
+ last: boolean;
+ children: ReactNode;
+}) {
+ const { data: task } = useQuery({
+ ...taskListQueryOptions(),
+ select: (tasks) => tasks.find((one) => one.threadId === threadId),
+ });
+ const running =
+ work.running || (last && task?.status === "working" && !task.stoppedAt);
+ const since =
+ running && task?.workingSince ? Date.parse(task.workingSince) : undefined;
+ const seconds = useSecondsSince(
+ since !== undefined && Number.isFinite(since) ? since : undefined,
+ );
+ // Read again soon while this turn runs, and again as it ends: its runs are written down then.
+ const { data: turns } = useQuery({
+ ...taskTurnsQueryOptions(task?.id ?? "", running),
+ enabled: task !== undefined,
+ });
+ const turn = turns?.find((one) => one.askId === work.askId);
+ const queryClient = useQueryClient();
+ const taskId = task?.id;
+ const wasRunning = useRef(running);
+ useEffect(() => {
+ const ended = wasRunning.current && !running;
+ wasRunning.current = running;
+ if (!ended || !taskId) return;
+ const read = () =>
+ void queryClient.invalidateQueries({ queryKey: taskKeys.turns(taskId) });
+ read();
+ const again = setTimeout(read, READ_AGAIN_MS);
+ return () => clearTimeout(again);
+ }, [running, taskId, queryClient]);
+ return (
+
+ {children}
+
+ );
+}
+
+function WorkLine({
+ text,
+ running,
+ children,
+}: {
+ text: string;
+ running: boolean;
+ children: ReactNode;
+}) {
+ return (
+
+
+
{children}
+
+
+ );
+}
diff --git a/app/src/lib/agents/legacy-routes.ts b/app/src/lib/agents/legacy-routes.ts
index 66cc243400..7f20e1fcac 100644
--- a/app/src/lib/agents/legacy-routes.ts
+++ b/app/src/lib/agents/legacy-routes.ts
@@ -18,6 +18,18 @@ export function legacyAgentsTarget(search: { new?: boolean; agent?: string }) {
return { to: "/bots", replace: true } as const;
}
+/**
+ * Whether an `/agents` address is an old link to a Bot or to New Bot. `/agents` on its own is the
+ * Agents page now, the list of agents Bots hand work to; only the two old search parameters still
+ * lead to the Bots.
+ */
+export function isLegacyAgentsLink(search: {
+ new?: boolean;
+ agent?: string;
+}): boolean {
+ return search.new === true || Boolean(search.agent);
+}
+
/**
* The pages that left the sidebar, and where their contents went. What was about one Bot is on that
* Bot's page; what was the person's own is in Settings, or on Routines.
diff --git a/app/src/lib/agents/mutations.ts b/app/src/lib/agents/mutations.ts
index 7c6ba60b86..7e0f8eafcb 100644
--- a/app/src/lib/agents/mutations.ts
+++ b/app/src/lib/agents/mutations.ts
@@ -13,6 +13,7 @@ import {
} from "@/lib/api/generated/bots/bots";
import type { CreateBotRequest } from "@/lib/api/generated/model";
import { idempotencyKey, organizationId } from "@/lib/api/request";
+import { botAgentKeys } from "@/lib/bot-agents/queries";
import { channelKeys } from "@/lib/channels/queries";
import { grantPlugin, revokePlugin } from "@/lib/plugins/mutations";
import { type AgentProfile, agentKeys } from "./queries";
@@ -136,6 +137,11 @@ export function deleteAgentMutationOptions(queryClient: QueryClient) {
// A read of it already on its way is dropped too, not left to land in the cache.
await queryClient.cancelQueries(ofThisBot);
queryClient.removeQueries(ofThisBot);
+ // How it worked goes with it, and the agents it used now count one Bot fewer.
+ const itsDelegation = { queryKey: botAgentKeys.delegation(agentId) };
+ await queryClient.cancelQueries(itsDelegation);
+ queryClient.removeQueries(itsDelegation);
+ void queryClient.invalidateQueries({ queryKey: botAgentKeys.list() });
return queryClient.invalidateQueries({
queryKey: agentKeys.all,
predicate: (query) => query.queryKey[2] !== agentId,
diff --git a/app/src/lib/api/generated/agents/agents.msw.ts b/app/src/lib/api/generated/agents/agents.msw.ts
new file mode 100644
index 0000000000..84604bbdfa
--- /dev/null
+++ b/app/src/lib/api/generated/agents/agents.msw.ts
@@ -0,0 +1,498 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import { HttpResponse, http } from "msw";
+import type { HttpResponseResolver, RequestHandlerOptions } from "msw";
+
+import type {
+ BotAgentCallbackToken,
+ BotAgentPage,
+ BotAgentResponse,
+ BotDelegation,
+ CreateBotAgentRequest,
+ ReplaceBotDelegationRequest,
+ UpdateBotAgentRequest,
+} from "../model";
+
+export const getListBotAgentsResponseMock = (): BotAgentPage => ({
+ agents: [
+ {
+ id: "bag_0c51d9e3a7f24b18",
+ name: "OpenBot",
+ description:
+ "OpenBot's own agent, with every app and component the Bot may use.",
+ kind: "openbot",
+ visibility: "public",
+ endpoint: null,
+ framework: "OpenBot",
+ model: null,
+ skills: [],
+ hasAuth: false,
+ hasCallbackToken: false,
+ builtIn: true,
+ canManage: false,
+ mine: false,
+ botCount: 4,
+ createdAt: "2026-11-16T09:00:00Z",
+ updatedAt: "2026-11-16T09:00:00Z",
+ },
+ ],
+ nextCursor: null,
+});
+
+export const getCreateBotAgentResponseMock = (): BotAgentResponse => ({
+ agent: {
+ id: "bag_4f7c1e2a9d0b4c63",
+ name: "Pipeline analyst",
+ description: "Reads the sales pipeline and forecasts the quarter.",
+ kind: "address",
+ visibility: "private",
+ endpoint: "https://agents.example.com/ag-ui",
+ framework: "LangChain",
+ model: null,
+ skills: [
+ {
+ name: "Forecast",
+ description: "Forecasts the quarter from the open deals.",
+ examples: ["What will we close this quarter?"],
+ },
+ ],
+ hasAuth: true,
+ hasCallbackToken: false,
+ builtIn: false,
+ canManage: true,
+ mine: true,
+ botCount: 0,
+ createdAt: "2026-11-16T09:30:00Z",
+ updatedAt: "2026-11-16T09:30:00Z",
+ },
+});
+
+export const getGetBotAgentResponseMock = (): BotAgentResponse => ({
+ agent: {
+ id: "bag_0c51d9e3a7f24b18",
+ name: "OpenBot",
+ description:
+ "OpenBot's own agent, with every app and component the Bot may use.",
+ kind: "openbot",
+ visibility: "public",
+ endpoint: null,
+ framework: "OpenBot",
+ model: null,
+ skills: [],
+ hasAuth: false,
+ hasCallbackToken: false,
+ builtIn: true,
+ canManage: false,
+ mine: false,
+ botCount: 4,
+ createdAt: "2026-11-16T09:00:00Z",
+ updatedAt: "2026-11-16T09:00:00Z",
+ },
+});
+
+export const getUpdateBotAgentResponseMock = (): BotAgentResponse => ({
+ agent: {
+ id: "bag_4f7c1e2a9d0b4c63",
+ name: "Pipeline analyst",
+ description: "Reads the sales pipeline and forecasts the quarter.",
+ kind: "address",
+ visibility: "private",
+ endpoint: "https://agents.example.com/ag-ui",
+ framework: "LangChain",
+ model: null,
+ skills: [
+ {
+ name: "Forecast",
+ description: "Forecasts the quarter from the open deals.",
+ examples: ["What will we close this quarter?"],
+ },
+ ],
+ hasAuth: true,
+ hasCallbackToken: false,
+ builtIn: false,
+ canManage: true,
+ mine: true,
+ botCount: 0,
+ createdAt: "2026-11-16T09:30:00Z",
+ updatedAt: "2026-11-16T09:30:00Z",
+ },
+});
+
+export const getIssueBotAgentCallbackTokenResponseMock =
+ (): BotAgentCallbackToken => ({
+ token: "obot_agt_7f3a9c2e5d1b4f60a8e2c9d4b1f7e3a6c0d9",
+ });
+
+export const getRevokeBotAgentCallbackTokenResponseMock =
+ (): BotAgentResponse => ({
+ agent: {
+ id: "bag_4f7c1e2a9d0b4c63",
+ name: "Pipeline analyst",
+ description: "Reads the sales pipeline and forecasts the quarter.",
+ kind: "address",
+ visibility: "private",
+ endpoint: "https://agents.example.com/ag-ui",
+ framework: "LangChain",
+ model: null,
+ skills: [
+ {
+ name: "Forecast",
+ description: "Forecasts the quarter from the open deals.",
+ examples: ["What will we close this quarter?"],
+ },
+ ],
+ hasAuth: true,
+ hasCallbackToken: false,
+ builtIn: false,
+ canManage: true,
+ mine: true,
+ botCount: 0,
+ createdAt: "2026-11-16T09:30:00Z",
+ updatedAt: "2026-11-16T09:30:00Z",
+ },
+ });
+
+export const getGetBotDelegationResponseMock = (): BotDelegation => ({
+ botId: "agent_9b1c6f0e-7f0e-4c1e-9d55-2f4a8c1b6e21",
+ mode: "self",
+ model: null,
+ effort: null,
+ instructions: "",
+ agents: [
+ {
+ id: "bag_0c51d9e3a7f24b18",
+ name: "OpenBot",
+ description:
+ "OpenBot's own agent, with every app and component the Bot may use.",
+ kind: "openbot",
+ framework: "OpenBot",
+ available: true,
+ },
+ ],
+ canManage: true,
+});
+
+export const getReplaceBotDelegationResponseMock = (): BotDelegation => ({
+ botId: "agent_9b1c6f0e-7f0e-4c1e-9d55-2f4a8c1b6e21",
+ mode: "orchestrate",
+ model: null,
+ effort: null,
+ instructions:
+ "Hand research to Researcher and anything about the pipeline to Pipeline analyst. Answer greetings yourself.",
+ agents: [
+ {
+ id: "bag_4f7c1e2a9d0b4c63",
+ name: "Researcher",
+ description:
+ "Deep research on the web and in the person's apps, with sources.",
+ kind: "openbot",
+ framework: "OpenBot",
+ available: true,
+ },
+ {
+ id: "bag_9a2d7e1c3b5f4086",
+ name: "Pipeline analyst",
+ description: "Reads the sales pipeline and forecasts the quarter.",
+ kind: "address",
+ framework: "LangChain",
+ available: true,
+ },
+ ],
+ canManage: true,
+});
+
+export const getListBotAgentsMockHandler = (
+ overrideResponse?:
+ | BotAgentPage
+ | ((
+ info: Parameters>[0],
+ ) => Promise | BotAgentPage),
+ options?: RequestHandlerOptions,
+) => {
+ return http.get<{ organizationId: string }>(
+ "*/api/v2/organizations/:organizationId/bot-agents",
+ async (
+ info: Parameters>[0],
+ ) => {
+ return HttpResponse.json(
+ overrideResponse !== undefined
+ ? typeof overrideResponse === "function"
+ ? await overrideResponse(info)
+ : overrideResponse
+ : getListBotAgentsResponseMock(),
+ { status: 200 },
+ );
+ },
+ options,
+ );
+};
+
+export const getCreateBotAgentMockHandler = (
+ overrideResponse?:
+ | BotAgentResponse
+ | ((
+ info: Parameters<
+ HttpResponseResolver<
+ { organizationId: string },
+ CreateBotAgentRequest
+ >
+ >[0],
+ ) => Promise | BotAgentResponse),
+ options?: RequestHandlerOptions,
+) => {
+ return http.post<{ organizationId: string }, CreateBotAgentRequest>(
+ "*/api/v2/organizations/:organizationId/bot-agents",
+ async (
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string }, CreateBotAgentRequest>
+ >[0],
+ ) => {
+ return HttpResponse.json(
+ overrideResponse !== undefined
+ ? typeof overrideResponse === "function"
+ ? await overrideResponse(info)
+ : overrideResponse
+ : getCreateBotAgentResponseMock(),
+ { status: 201 },
+ );
+ },
+ options,
+ );
+};
+
+export const getGetBotAgentMockHandler = (
+ overrideResponse?:
+ | BotAgentResponse
+ | ((
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string; botAgentId: string }>
+ >[0],
+ ) => Promise | BotAgentResponse),
+ options?: RequestHandlerOptions,
+) => {
+ return http.get<{ organizationId: string; botAgentId: string }>(
+ "*/api/v2/organizations/:organizationId/bot-agents/:botAgentId",
+ async (
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string; botAgentId: string }>
+ >[0],
+ ) => {
+ return HttpResponse.json(
+ overrideResponse !== undefined
+ ? typeof overrideResponse === "function"
+ ? await overrideResponse(info)
+ : overrideResponse
+ : getGetBotAgentResponseMock(),
+ { status: 200 },
+ );
+ },
+ options,
+ );
+};
+
+export const getUpdateBotAgentMockHandler = (
+ overrideResponse?:
+ | BotAgentResponse
+ | ((
+ info: Parameters<
+ HttpResponseResolver<
+ { organizationId: string; botAgentId: string },
+ UpdateBotAgentRequest
+ >
+ >[0],
+ ) => Promise | BotAgentResponse),
+ options?: RequestHandlerOptions,
+) => {
+ return http.patch<
+ { organizationId: string; botAgentId: string },
+ UpdateBotAgentRequest
+ >(
+ "*/api/v2/organizations/:organizationId/bot-agents/:botAgentId",
+ async (
+ info: Parameters<
+ HttpResponseResolver<
+ { organizationId: string; botAgentId: string },
+ UpdateBotAgentRequest
+ >
+ >[0],
+ ) => {
+ return HttpResponse.json(
+ overrideResponse !== undefined
+ ? typeof overrideResponse === "function"
+ ? await overrideResponse(info)
+ : overrideResponse
+ : getUpdateBotAgentResponseMock(),
+ { status: 200 },
+ );
+ },
+ options,
+ );
+};
+
+export const getDeleteBotAgentMockHandler = (
+ overrideResponse?:
+ | void
+ | ((
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string; botAgentId: string }>
+ >[0],
+ ) => Promise | void),
+ options?: RequestHandlerOptions,
+) => {
+ return http.delete<{ organizationId: string; botAgentId: string }>(
+ "*/api/v2/organizations/:organizationId/bot-agents/:botAgentId",
+ async (
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string; botAgentId: string }>
+ >[0],
+ ) => {
+ if (typeof overrideResponse === "function") {
+ await overrideResponse(info);
+ }
+
+ return new HttpResponse(null, { status: 204 });
+ },
+ options,
+ );
+};
+
+export const getIssueBotAgentCallbackTokenMockHandler = (
+ overrideResponse?:
+ | BotAgentCallbackToken
+ | ((
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string; botAgentId: string }>
+ >[0],
+ ) => Promise | BotAgentCallbackToken),
+ options?: RequestHandlerOptions,
+) => {
+ return http.post<{ organizationId: string; botAgentId: string }>(
+ "*/api/v2/organizations/:organizationId/bot-agents/:botAgentId/issue-callback-token",
+ async (
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string; botAgentId: string }>
+ >[0],
+ ) => {
+ return HttpResponse.json(
+ overrideResponse !== undefined
+ ? typeof overrideResponse === "function"
+ ? await overrideResponse(info)
+ : overrideResponse
+ : getIssueBotAgentCallbackTokenResponseMock(),
+ { status: 200 },
+ );
+ },
+ options,
+ );
+};
+
+export const getRevokeBotAgentCallbackTokenMockHandler = (
+ overrideResponse?:
+ | BotAgentResponse
+ | ((
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string; botAgentId: string }>
+ >[0],
+ ) => Promise | BotAgentResponse),
+ options?: RequestHandlerOptions,
+) => {
+ return http.post<{ organizationId: string; botAgentId: string }>(
+ "*/api/v2/organizations/:organizationId/bot-agents/:botAgentId/revoke-callback-token",
+ async (
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string; botAgentId: string }>
+ >[0],
+ ) => {
+ return HttpResponse.json(
+ overrideResponse !== undefined
+ ? typeof overrideResponse === "function"
+ ? await overrideResponse(info)
+ : overrideResponse
+ : getRevokeBotAgentCallbackTokenResponseMock(),
+ { status: 200 },
+ );
+ },
+ options,
+ );
+};
+
+export const getGetBotDelegationMockHandler = (
+ overrideResponse?:
+ | BotDelegation
+ | ((
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string; botId: string }>
+ >[0],
+ ) => Promise | BotDelegation),
+ options?: RequestHandlerOptions,
+) => {
+ return http.get<{ organizationId: string; botId: string }>(
+ "*/api/v2/organizations/:organizationId/bots/:botId/delegation",
+ async (
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string; botId: string }>
+ >[0],
+ ) => {
+ return HttpResponse.json(
+ overrideResponse !== undefined
+ ? typeof overrideResponse === "function"
+ ? await overrideResponse(info)
+ : overrideResponse
+ : getGetBotDelegationResponseMock(),
+ { status: 200 },
+ );
+ },
+ options,
+ );
+};
+
+export const getReplaceBotDelegationMockHandler = (
+ overrideResponse?:
+ | BotDelegation
+ | ((
+ info: Parameters<
+ HttpResponseResolver<
+ { organizationId: string; botId: string },
+ ReplaceBotDelegationRequest
+ >
+ >[0],
+ ) => Promise | BotDelegation),
+ options?: RequestHandlerOptions,
+) => {
+ return http.put<
+ { organizationId: string; botId: string },
+ ReplaceBotDelegationRequest
+ >(
+ "*/api/v2/organizations/:organizationId/bots/:botId/delegation",
+ async (
+ info: Parameters<
+ HttpResponseResolver<
+ { organizationId: string; botId: string },
+ ReplaceBotDelegationRequest
+ >
+ >[0],
+ ) => {
+ return HttpResponse.json(
+ overrideResponse !== undefined
+ ? typeof overrideResponse === "function"
+ ? await overrideResponse(info)
+ : overrideResponse
+ : getReplaceBotDelegationResponseMock(),
+ { status: 200 },
+ );
+ },
+ options,
+ );
+};
+export const getAgentsMock = () => [
+ getListBotAgentsMockHandler(),
+ getCreateBotAgentMockHandler(),
+ getGetBotAgentMockHandler(),
+ getUpdateBotAgentMockHandler(),
+ getDeleteBotAgentMockHandler(),
+ getIssueBotAgentCallbackTokenMockHandler(),
+ getRevokeBotAgentCallbackTokenMockHandler(),
+ getGetBotDelegationMockHandler(),
+ getReplaceBotDelegationMockHandler(),
+];
diff --git a/app/src/lib/api/generated/agents/agents.ts b/app/src/lib/api/generated/agents/agents.ts
new file mode 100644
index 0000000000..c0f78011b5
--- /dev/null
+++ b/app/src/lib/api/generated/agents/agents.ts
@@ -0,0 +1,1652 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import { useMutation, useQuery } from "@tanstack/react-query";
+import type {
+ DataTag,
+ DefinedInitialDataOptions,
+ DefinedUseQueryResult,
+ MutationFunction,
+ QueryClient,
+ QueryFunction,
+ QueryKey,
+ UndefinedInitialDataOptions,
+ UseMutationOptions,
+ UseMutationResult,
+ UseQueryOptions,
+ UseQueryResult,
+} from "@tanstack/react-query";
+
+import type {
+ BotAgentCallbackToken,
+ BotAgentForbiddenResponse,
+ BotAgentInUseResponse,
+ BotAgentNotFoundResponse,
+ BotAgentPage,
+ BotAgentResponse,
+ BotDelegation,
+ BotForbiddenResponse,
+ BotNotFoundResponse,
+ CreateBotAgentHeaders,
+ CreateBotAgentRequest,
+ DeleteBotAgentHeaders,
+ ForbiddenResponse,
+ IdempotencyConflictResponse,
+ InvalidBotAgentResponse,
+ InvalidBotDelegationResponse,
+ InvalidRequestResponse,
+ IssueBotAgentCallbackTokenHeaders,
+ ListBotAgentsParams,
+ OrganizationNotFoundResponse,
+ ReplaceBotDelegationHeaders,
+ ReplaceBotDelegationRequest,
+ RevokeBotAgentCallbackTokenHeaders,
+ ServerErrorResponse,
+ UnauthenticatedResponse,
+ UnexpectedErrorResponse,
+ UpdateBotAgentHeaders,
+ UpdateBotAgentRequest,
+} from "../model";
+
+import { apiRequest } from "../../request";
+
+type AwaitedInput = PromiseLike | T;
+
+type Awaited = O extends AwaitedInput ? T : never;
+
+type SecondParameter unknown> = Parameters[1];
+
+const withQueryKey = (
+ query: T,
+ queryKey: K,
+): T & { queryKey: K } => {
+ const result = { queryKey } as T & { queryKey: K };
+ for (const key of Object.keys(query)) {
+ // The explicit queryKey always wins, matching the previous
+ // `{ ...query, queryKey }` spread where it was set last.
+ if (key === "queryKey") continue;
+ Object.defineProperty(result, key, {
+ enumerable: true,
+ configurable: true,
+ get: () => (query as Record)[key],
+ });
+ }
+ return result;
+};
+
+export const getListBotAgentsUrl = (
+ organizationId: string,
+ params?: ListBotAgentsParams,
+) => {
+ const normalizedParams = new URLSearchParams();
+
+ Object.entries(params || {}).forEach(([key, value]) => {
+ if (value !== undefined) {
+ normalizedParams.append(key, value === null ? "null" : String(value));
+ }
+ });
+
+ const stringifiedParams = normalizedParams.toString();
+
+ return stringifiedParams.length > 0
+ ? `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/bot-agents?${stringifiedParams}`
+ : `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/bot-agents`;
+};
+
+/**
+ * Return one page of the agents the caller can see: the organization's public agents and the caller's own private ones, oldest first, and by id among agents made at the same moment. Somebody else's private agent is never among them. scope=organization lists every agent in the organization, people's private ones included, for an admin's screens; it is refused to anybody who is not an admin of the organization. A missing cursor starts at the first page and nextCursor null ends the list.
+ * @summary List agents
+ */
+export const listBotAgents = async (
+ organizationId: string,
+ params?: ListBotAgentsParams,
+ options?: Parameters[1],
+): Promise => {
+ return apiRequest(getListBotAgentsUrl(organizationId, params), {
+ ...options,
+ method: "GET",
+ });
+};
+
+export const getListBotAgentsQueryKey = (
+ organizationId: string,
+ params?: ListBotAgentsParams,
+) => {
+ return [
+ `/api/v2/organizations/${organizationId}/bot-agents`,
+ ...(params ? [params] : []),
+ ] as const;
+};
+
+export const getListBotAgentsQueryOptions = <
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | OrganizationNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ params?: ListBotAgentsParams,
+ options?: {
+ query?: Partial<
+ UseQueryOptions>, TError, TData>
+ >;
+ request?: SecondParameter;
+ },
+) => {
+ const { query: queryOptions, request: requestOptions } = options ?? {};
+
+ const queryKey =
+ queryOptions?.queryKey ?? getListBotAgentsQueryKey(organizationId, params);
+
+ const queryFn: QueryFunction>> = ({
+ signal,
+ }) => listBotAgents(organizationId, params, { signal, ...requestOptions });
+
+ return {
+ queryKey,
+ queryFn,
+ enabled: organizationId !== null && organizationId !== undefined,
+ ...queryOptions,
+ } as UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ > & { queryKey: DataTag };
+};
+
+export type ListBotAgentsQueryResult = NonNullable<
+ Awaited>
+>;
+export type ListBotAgentsQueryError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | OrganizationNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse;
+
+export function useListBotAgents<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | OrganizationNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ params: undefined | ListBotAgentsParams,
+ options: {
+ query: Partial<
+ UseQueryOptions>, TError, TData>
+ > &
+ Pick<
+ DefinedInitialDataOptions<
+ Awaited>,
+ TError,
+ Awaited>
+ >,
+ "initialData"
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): DefinedUseQueryResult & {
+ queryKey: DataTag;
+};
+export function useListBotAgents<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | OrganizationNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ params?: ListBotAgentsParams,
+ options?: {
+ query?: Partial<
+ UseQueryOptions>, TError, TData>
+ > &
+ Pick<
+ UndefinedInitialDataOptions<
+ Awaited>,
+ TError,
+ Awaited>
+ >,
+ "initialData"
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseQueryResult & {
+ queryKey: DataTag;
+};
+export function useListBotAgents<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | OrganizationNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ params?: ListBotAgentsParams,
+ options?: {
+ query?: Partial<
+ UseQueryOptions>, TError, TData>
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseQueryResult & {
+ queryKey: DataTag;
+};
+/**
+ * @summary List agents
+ */
+
+export function useListBotAgents<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | OrganizationNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ params?: ListBotAgentsParams,
+ options?: {
+ query?: Partial<
+ UseQueryOptions>, TError, TData>
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseQueryResult & {
+ queryKey: DataTag;
+} {
+ const queryOptions = getListBotAgentsQueryOptions(
+ organizationId,
+ params,
+ options,
+ );
+
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<
+ TData,
+ TError
+ > & { queryKey: DataTag };
+
+ return withQueryKey(query, queryOptions.queryKey);
+}
+
+export const getCreateBotAgentUrl = (organizationId: string) => {
+ return `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/bot-agents`;
+};
+
+/**
+ * Add an agent for Bots to hand work to. kind openbot runs inside OpenBot, on the model given or the organization's default. kind address runs at an AG-UI address, which the server checks before saving; a key, when given, is stored encrypted and never returned. Anybody may add a private agent, for their own Bots; only an admin of the organization may add a public one, which every member's Bots may use. A repeated request with the same Idempotency-Key and body returns the first result.
+ * @summary Add an agent
+ */
+export const createBotAgent = async (
+ organizationId: string,
+ createBotAgentRequest: CreateBotAgentRequest,
+ headers: CreateBotAgentHeaders,
+ options?: Parameters[1],
+): Promise => {
+ const getHeaders = (
+ h?: NonNullable,
+ ): Record => {
+ if (!h) return {};
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
+ if (Symbol.iterator in h) {
+ return Object.fromEntries(
+ Array.from(
+ h as Iterable>,
+ (entry) => Array.from(entry) as [string, string],
+ ),
+ );
+ }
+ const headers: Record = {};
+ for (const [name, value] of Object.entries<
+ string | readonly string[] | undefined
+ >(h)) {
+ if (value !== undefined) headers[name] = value;
+ }
+ return headers;
+ };
+ return apiRequest(getCreateBotAgentUrl(organizationId), {
+ ...options,
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ ...headers,
+ ...getHeaders(options?.headers),
+ },
+ body: JSON.stringify(createBotAgentRequest),
+ });
+};
+
+export const getCreateBotAgentMutationKey = () => ["createBotAgent"] as const;
+
+export const getCreateBotAgentMutationOptions = <
+ TError =
+ | InvalidBotAgentResponse
+ | UnauthenticatedResponse
+ | BotAgentForbiddenResponse
+ | OrganizationNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ CreateBotAgentMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+}): UseMutationOptions<
+ Awaited>,
+ TError,
+ CreateBotAgentMutationVariables,
+ TContext
+> => {
+ const mutationKey = getCreateBotAgentMutationKey();
+ const { mutation: mutationOptions, request: requestOptions } = options
+ ? options.mutation &&
+ "mutationKey" in options.mutation &&
+ options.mutation.mutationKey
+ ? options
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
+ : { mutation: { mutationKey }, request: undefined };
+
+ const mutationFn: MutationFunction<
+ Awaited>,
+ CreateBotAgentMutationVariables
+ > = (props) => {
+ const { organizationId, data, headers } = props ?? {};
+
+ return createBotAgent(organizationId, data, headers, requestOptions);
+ };
+
+ return { mutationFn, ...mutationOptions };
+};
+
+export type CreateBotAgentMutationResult = NonNullable<
+ Awaited>
+>;
+export type CreateBotAgentMutationBody = CreateBotAgentRequest;
+export type CreateBotAgentMutationError =
+ | InvalidBotAgentResponse
+ | UnauthenticatedResponse
+ | BotAgentForbiddenResponse
+ | OrganizationNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse;
+export type CreateBotAgentMutationVariables = {
+ organizationId: string;
+ data: CreateBotAgentRequest;
+ headers: CreateBotAgentHeaders;
+};
+
+/**
+ * @summary Add an agent
+ */
+export const useCreateBotAgent = <
+ TError =
+ | InvalidBotAgentResponse
+ | UnauthenticatedResponse
+ | BotAgentForbiddenResponse
+ | OrganizationNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(
+ options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ CreateBotAgentMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseMutationResult<
+ Awaited>,
+ TError,
+ CreateBotAgentMutationVariables,
+ TContext
+> => {
+ return useMutation(getCreateBotAgentMutationOptions(options), queryClient);
+};
+export const getGetBotAgentUrl = (
+ organizationId: string,
+ botAgentId: string,
+) => {
+ return `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/bot-agents/${encodeURIComponent(String(botAgentId))}`;
+};
+
+/**
+ * Return one agent the caller can see. An agent that does not exist, was deleted, or is private to somebody else is not found.
+ * @summary Read one agent
+ */
+export const getBotAgent = async (
+ organizationId: string,
+ botAgentId: string,
+ options?: Parameters[1],
+): Promise => {
+ return apiRequest(
+ getGetBotAgentUrl(organizationId, botAgentId),
+ {
+ ...options,
+ method: "GET",
+ },
+ );
+};
+
+export const getGetBotAgentQueryKey = (
+ organizationId: string,
+ botAgentId: string,
+) => {
+ return [
+ `/api/v2/organizations/${organizationId}/bot-agents/${botAgentId}`,
+ ] as const;
+};
+
+export const getGetBotAgentQueryOptions = <
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | BotAgentNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ botAgentId: string,
+ options?: {
+ query?: Partial<
+ UseQueryOptions>, TError, TData>
+ >;
+ request?: SecondParameter;
+ },
+) => {
+ const { query: queryOptions, request: requestOptions } = options ?? {};
+
+ const queryKey =
+ queryOptions?.queryKey ??
+ getGetBotAgentQueryKey(organizationId, botAgentId);
+
+ const queryFn: QueryFunction>> = ({
+ signal,
+ }) => getBotAgent(organizationId, botAgentId, { signal, ...requestOptions });
+
+ return {
+ queryKey,
+ queryFn,
+ enabled:
+ organizationId !== null &&
+ organizationId !== undefined &&
+ botAgentId !== null &&
+ botAgentId !== undefined,
+ ...queryOptions,
+ } as UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ > & { queryKey: DataTag };
+};
+
+export type GetBotAgentQueryResult = NonNullable<
+ Awaited>
+>;
+export type GetBotAgentQueryError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | BotAgentNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse;
+
+export function useGetBotAgent<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | BotAgentNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ botAgentId: string,
+ options: {
+ query: Partial<
+ UseQueryOptions>, TError, TData>
+ > &
+ Pick<
+ DefinedInitialDataOptions<
+ Awaited>,
+ TError,
+ Awaited>
+ >,
+ "initialData"
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): DefinedUseQueryResult & {
+ queryKey: DataTag;
+};
+export function useGetBotAgent<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | BotAgentNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ botAgentId: string,
+ options?: {
+ query?: Partial<
+ UseQueryOptions>, TError, TData>
+ > &
+ Pick<
+ UndefinedInitialDataOptions<
+ Awaited>,
+ TError,
+ Awaited>
+ >,
+ "initialData"
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseQueryResult & {
+ queryKey: DataTag;
+};
+export function useGetBotAgent<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | BotAgentNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ botAgentId: string,
+ options?: {
+ query?: Partial<
+ UseQueryOptions>, TError, TData>
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseQueryResult & {
+ queryKey: DataTag;
+};
+/**
+ * @summary Read one agent
+ */
+
+export function useGetBotAgent<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | BotAgentNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ botAgentId: string,
+ options?: {
+ query?: Partial<
+ UseQueryOptions>, TError, TData>
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseQueryResult & {
+ queryKey: DataTag;
+} {
+ const queryOptions = getGetBotAgentQueryOptions(
+ organizationId,
+ botAgentId,
+ options,
+ );
+
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<
+ TData,
+ TError
+ > & { queryKey: DataTag };
+
+ return withQueryKey(query, queryOptions.queryKey);
+}
+
+export const getUpdateBotAgentUrl = (
+ organizationId: string,
+ botAgentId: string,
+) => {
+ return `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/bot-agents/${encodeURIComponent(String(botAgentId))}`;
+};
+
+/**
+ * Replace an agent's name, description and visibility, which are all required, and change any optional field that is present. An absent endpoint, key, model or skills leaves that setting as it is, so an edit to a name never drops a key. Only whoever may manage the agent may change it: its owner for a private one, an admin for a public one. Only an admin may make an agent public. kind cannot change. Every Bot that uses the agent runs on the change from its next turn.
+ * @summary Change an agent
+ */
+export const updateBotAgent = async (
+ organizationId: string,
+ botAgentId: string,
+ updateBotAgentRequest: UpdateBotAgentRequest,
+ headers: UpdateBotAgentHeaders,
+ options?: Parameters[1],
+): Promise => {
+ const getHeaders = (
+ h?: NonNullable,
+ ): Record => {
+ if (!h) return {};
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
+ if (Symbol.iterator in h) {
+ return Object.fromEntries(
+ Array.from(
+ h as Iterable>,
+ (entry) => Array.from(entry) as [string, string],
+ ),
+ );
+ }
+ const headers: Record = {};
+ for (const [name, value] of Object.entries<
+ string | readonly string[] | undefined
+ >(h)) {
+ if (value !== undefined) headers[name] = value;
+ }
+ return headers;
+ };
+ return apiRequest(
+ getUpdateBotAgentUrl(organizationId, botAgentId),
+ {
+ ...options,
+ method: "PATCH",
+ headers: {
+ "Content-Type": "application/json",
+ ...headers,
+ ...getHeaders(options?.headers),
+ },
+ body: JSON.stringify(updateBotAgentRequest),
+ },
+ );
+};
+
+export const getUpdateBotAgentMutationKey = () => ["updateBotAgent"] as const;
+
+export const getUpdateBotAgentMutationOptions = <
+ TError =
+ | InvalidBotAgentResponse
+ | UnauthenticatedResponse
+ | BotAgentForbiddenResponse
+ | BotAgentNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ UpdateBotAgentMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+}): UseMutationOptions<
+ Awaited>,
+ TError,
+ UpdateBotAgentMutationVariables,
+ TContext
+> => {
+ const mutationKey = getUpdateBotAgentMutationKey();
+ const { mutation: mutationOptions, request: requestOptions } = options
+ ? options.mutation &&
+ "mutationKey" in options.mutation &&
+ options.mutation.mutationKey
+ ? options
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
+ : { mutation: { mutationKey }, request: undefined };
+
+ const mutationFn: MutationFunction<
+ Awaited>,
+ UpdateBotAgentMutationVariables
+ > = (props) => {
+ const { organizationId, botAgentId, data, headers } = props ?? {};
+
+ return updateBotAgent(
+ organizationId,
+ botAgentId,
+ data,
+ headers,
+ requestOptions,
+ );
+ };
+
+ return { mutationFn, ...mutationOptions };
+};
+
+export type UpdateBotAgentMutationResult = NonNullable<
+ Awaited>
+>;
+export type UpdateBotAgentMutationBody = UpdateBotAgentRequest;
+export type UpdateBotAgentMutationError =
+ | InvalidBotAgentResponse
+ | UnauthenticatedResponse
+ | BotAgentForbiddenResponse
+ | BotAgentNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse;
+export type UpdateBotAgentMutationVariables = {
+ organizationId: string;
+ botAgentId: string;
+ data: UpdateBotAgentRequest;
+ headers: UpdateBotAgentHeaders;
+};
+
+/**
+ * @summary Change an agent
+ */
+export const useUpdateBotAgent = <
+ TError =
+ | InvalidBotAgentResponse
+ | UnauthenticatedResponse
+ | BotAgentForbiddenResponse
+ | BotAgentNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(
+ options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ UpdateBotAgentMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseMutationResult<
+ Awaited>,
+ TError,
+ UpdateBotAgentMutationVariables,
+ TContext
+> => {
+ return useMutation(getUpdateBotAgentMutationOptions(options), queryClient);
+};
+export const getDeleteBotAgentUrl = (
+ organizationId: string,
+ botAgentId: string,
+) => {
+ return `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/bot-agents/${encodeURIComponent(String(botAgentId))}`;
+};
+
+/**
+ * Delete an agent and retire its key and callback token. It is taken off every Bot that may use it. Refused, with BOT_AGENT_IN_USE, while it is the only agent of any Bot, deleted Bots aside: give that Bot another agent first. The refusal names those Bots the caller can see and only counts the rest. Only whoever may manage the agent may delete it. Task threads it worked in stay readable. An agent that is already deleted is not found.
+ * @summary Delete an agent
+ */
+export const deleteBotAgent = async (
+ organizationId: string,
+ botAgentId: string,
+ headers: DeleteBotAgentHeaders,
+ options?: Parameters[1],
+): Promise => {
+ const getHeaders = (
+ h?: NonNullable,
+ ): Record => {
+ if (!h) return {};
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
+ if (Symbol.iterator in h) {
+ return Object.fromEntries(
+ Array.from(
+ h as Iterable>,
+ (entry) => Array.from(entry) as [string, string],
+ ),
+ );
+ }
+ const headers: Record = {};
+ for (const [name, value] of Object.entries<
+ string | readonly string[] | undefined
+ >(h)) {
+ if (value !== undefined) headers[name] = value;
+ }
+ return headers;
+ };
+ return apiRequest(getDeleteBotAgentUrl(organizationId, botAgentId), {
+ ...options,
+ method: "DELETE",
+ headers: { ...headers, ...getHeaders(options?.headers) },
+ });
+};
+
+export const getDeleteBotAgentMutationKey = () => ["deleteBotAgent"] as const;
+
+export const getDeleteBotAgentMutationOptions = <
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | BotAgentForbiddenResponse
+ | BotAgentNotFoundResponse
+ | BotAgentInUseResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ DeleteBotAgentMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+}): UseMutationOptions<
+ Awaited>,
+ TError,
+ DeleteBotAgentMutationVariables,
+ TContext
+> => {
+ const mutationKey = getDeleteBotAgentMutationKey();
+ const { mutation: mutationOptions, request: requestOptions } = options
+ ? options.mutation &&
+ "mutationKey" in options.mutation &&
+ options.mutation.mutationKey
+ ? options
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
+ : { mutation: { mutationKey }, request: undefined };
+
+ const mutationFn: MutationFunction<
+ Awaited>,
+ DeleteBotAgentMutationVariables
+ > = (props) => {
+ const { organizationId, botAgentId, headers } = props ?? {};
+
+ return deleteBotAgent(organizationId, botAgentId, headers, requestOptions);
+ };
+
+ return { mutationFn, ...mutationOptions };
+};
+
+export type DeleteBotAgentMutationResult = NonNullable<
+ Awaited>
+>;
+
+export type DeleteBotAgentMutationError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | BotAgentForbiddenResponse
+ | BotAgentNotFoundResponse
+ | BotAgentInUseResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse;
+export type DeleteBotAgentMutationVariables = {
+ organizationId: string;
+ botAgentId: string;
+ headers: DeleteBotAgentHeaders;
+};
+
+/**
+ * @summary Delete an agent
+ */
+export const useDeleteBotAgent = <
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | BotAgentForbiddenResponse
+ | BotAgentNotFoundResponse
+ | BotAgentInUseResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(
+ options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ DeleteBotAgentMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseMutationResult<
+ Awaited>,
+ TError,
+ DeleteBotAgentMutationVariables,
+ TContext
+> => {
+ return useMutation(getDeleteBotAgentMutationOptions(options), queryClient);
+};
+export const getIssueBotAgentCallbackTokenUrl = (
+ organizationId: string,
+ botAgentId: string,
+) => {
+ return `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/bot-agents/${encodeURIComponent(String(botAgentId))}/issue-callback-token`;
+};
+
+/**
+ * Give an agent at an address a new credential for calling OpenBot's tools back, and return it this once: it is never returned again, and the audit trail records that one was issued, never what it is. Issuing one for an agent that has one replaces it, which is how a leaked token is retired. A call made with it is allowed only for a run of a Bot that may use this agent, as the person that run is for. Only whoever may manage the agent may issue one. An agent that runs inside OpenBot, or at an address OpenBot runs itself, needs none and is refused.
+ * @summary Issue an agent's callback token
+ */
+export const issueBotAgentCallbackToken = async (
+ organizationId: string,
+ botAgentId: string,
+ headers: IssueBotAgentCallbackTokenHeaders,
+ options?: Parameters[1],
+): Promise => {
+ const getHeaders = (
+ h?: NonNullable,
+ ): Record => {
+ if (!h) return {};
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
+ if (Symbol.iterator in h) {
+ return Object.fromEntries(
+ Array.from(
+ h as Iterable>,
+ (entry) => Array.from(entry) as [string, string],
+ ),
+ );
+ }
+ const headers: Record = {};
+ for (const [name, value] of Object.entries<
+ string | readonly string[] | undefined
+ >(h)) {
+ if (value !== undefined) headers[name] = value;
+ }
+ return headers;
+ };
+ return apiRequest(
+ getIssueBotAgentCallbackTokenUrl(organizationId, botAgentId),
+ {
+ ...options,
+ method: "POST",
+ headers: { ...headers, ...getHeaders(options?.headers) },
+ },
+ );
+};
+
+export const getIssueBotAgentCallbackTokenMutationKey = () =>
+ ["issueBotAgentCallbackToken"] as const;
+
+export const getIssueBotAgentCallbackTokenMutationOptions = <
+ TError =
+ | InvalidBotAgentResponse
+ | UnauthenticatedResponse
+ | BotAgentForbiddenResponse
+ | BotAgentNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ IssueBotAgentCallbackTokenMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+}): UseMutationOptions<
+ Awaited>,
+ TError,
+ IssueBotAgentCallbackTokenMutationVariables,
+ TContext
+> => {
+ const mutationKey = getIssueBotAgentCallbackTokenMutationKey();
+ const { mutation: mutationOptions, request: requestOptions } = options
+ ? options.mutation &&
+ "mutationKey" in options.mutation &&
+ options.mutation.mutationKey
+ ? options
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
+ : { mutation: { mutationKey }, request: undefined };
+
+ const mutationFn: MutationFunction<
+ Awaited>,
+ IssueBotAgentCallbackTokenMutationVariables
+ > = (props) => {
+ const { organizationId, botAgentId, headers } = props ?? {};
+
+ return issueBotAgentCallbackToken(
+ organizationId,
+ botAgentId,
+ headers,
+ requestOptions,
+ );
+ };
+
+ return { mutationFn, ...mutationOptions };
+};
+
+export type IssueBotAgentCallbackTokenMutationResult = NonNullable<
+ Awaited>
+>;
+
+export type IssueBotAgentCallbackTokenMutationError =
+ | InvalidBotAgentResponse
+ | UnauthenticatedResponse
+ | BotAgentForbiddenResponse
+ | BotAgentNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse;
+export type IssueBotAgentCallbackTokenMutationVariables = {
+ organizationId: string;
+ botAgentId: string;
+ headers: IssueBotAgentCallbackTokenHeaders;
+};
+
+/**
+ * @summary Issue an agent's callback token
+ */
+export const useIssueBotAgentCallbackToken = <
+ TError =
+ | InvalidBotAgentResponse
+ | UnauthenticatedResponse
+ | BotAgentForbiddenResponse
+ | BotAgentNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(
+ options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ IssueBotAgentCallbackTokenMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseMutationResult<
+ Awaited>,
+ TError,
+ IssueBotAgentCallbackTokenMutationVariables,
+ TContext
+> => {
+ return useMutation(
+ getIssueBotAgentCallbackTokenMutationOptions(options),
+ queryClient,
+ );
+};
+export const getRevokeBotAgentCallbackTokenUrl = (
+ organizationId: string,
+ botAgentId: string,
+) => {
+ return `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/bot-agents/${encodeURIComponent(String(botAgentId))}/revoke-callback-token`;
+};
+
+/**
+ * Take away an agent's credential for calling OpenBot's tools back. It still answers in a conversation; it can't reach anything outside one. Only whoever may manage the agent may revoke it. Revoking a token that is not there changes nothing.
+ * @summary Revoke an agent's callback token
+ */
+export const revokeBotAgentCallbackToken = async (
+ organizationId: string,
+ botAgentId: string,
+ headers: RevokeBotAgentCallbackTokenHeaders,
+ options?: Parameters[1],
+): Promise => {
+ const getHeaders = (
+ h?: NonNullable,
+ ): Record => {
+ if (!h) return {};
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
+ if (Symbol.iterator in h) {
+ return Object.fromEntries(
+ Array.from(
+ h as Iterable>,
+ (entry) => Array.from(entry) as [string, string],
+ ),
+ );
+ }
+ const headers: Record = {};
+ for (const [name, value] of Object.entries<
+ string | readonly string[] | undefined
+ >(h)) {
+ if (value !== undefined) headers[name] = value;
+ }
+ return headers;
+ };
+ return apiRequest(
+ getRevokeBotAgentCallbackTokenUrl(organizationId, botAgentId),
+ {
+ ...options,
+ method: "POST",
+ headers: { ...headers, ...getHeaders(options?.headers) },
+ },
+ );
+};
+
+export const getRevokeBotAgentCallbackTokenMutationKey = () =>
+ ["revokeBotAgentCallbackToken"] as const;
+
+export const getRevokeBotAgentCallbackTokenMutationOptions = <
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | BotAgentForbiddenResponse
+ | BotAgentNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ RevokeBotAgentCallbackTokenMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+}): UseMutationOptions<
+ Awaited>,
+ TError,
+ RevokeBotAgentCallbackTokenMutationVariables,
+ TContext
+> => {
+ const mutationKey = getRevokeBotAgentCallbackTokenMutationKey();
+ const { mutation: mutationOptions, request: requestOptions } = options
+ ? options.mutation &&
+ "mutationKey" in options.mutation &&
+ options.mutation.mutationKey
+ ? options
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
+ : { mutation: { mutationKey }, request: undefined };
+
+ const mutationFn: MutationFunction<
+ Awaited>,
+ RevokeBotAgentCallbackTokenMutationVariables
+ > = (props) => {
+ const { organizationId, botAgentId, headers } = props ?? {};
+
+ return revokeBotAgentCallbackToken(
+ organizationId,
+ botAgentId,
+ headers,
+ requestOptions,
+ );
+ };
+
+ return { mutationFn, ...mutationOptions };
+};
+
+export type RevokeBotAgentCallbackTokenMutationResult = NonNullable<
+ Awaited>
+>;
+
+export type RevokeBotAgentCallbackTokenMutationError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | BotAgentForbiddenResponse
+ | BotAgentNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse;
+export type RevokeBotAgentCallbackTokenMutationVariables = {
+ organizationId: string;
+ botAgentId: string;
+ headers: RevokeBotAgentCallbackTokenHeaders;
+};
+
+/**
+ * @summary Revoke an agent's callback token
+ */
+export const useRevokeBotAgentCallbackToken = <
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | BotAgentForbiddenResponse
+ | BotAgentNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(
+ options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ RevokeBotAgentCallbackTokenMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseMutationResult<
+ Awaited>,
+ TError,
+ RevokeBotAgentCallbackTokenMutationVariables,
+ TContext
+> => {
+ return useMutation(
+ getRevokeBotAgentCallbackTokenMutationOptions(options),
+ queryClient,
+ );
+};
+export const getGetBotDelegationUrl = (
+ organizationId: string,
+ botId: string,
+) => {
+ return `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/bots/${encodeURIComponent(String(botId))}/delegation`;
+};
+
+/**
+ * Return how a Bot the caller can see works: on its own agent (mode self, every Bot made before agents were a list), or handing work to the agents it may use (mode orchestrate). The first agent is its default: a Bot in mode self runs on it, and a Bot in mode orchestrate hands it work the Bot names no agent for and every run nobody is waiting on (a routine, a check-in, a goal, another Bot's hand-off, a group conversation). Whoever uses a Bot uses its agents: an agent that is private to the Bot's owner still does the work for everybody the Bot is shared with, and to anybody else it is named Private agent, with its description withheld. An agent that was deleted, or that the Bot's owner can no longer use, is listed with available false, and the Bot hands it nothing.
+ * @summary Read a Bot's delegation
+ */
+export const getBotDelegation = async (
+ organizationId: string,
+ botId: string,
+ options?: Parameters[1],
+): Promise => {
+ return apiRequest(
+ getGetBotDelegationUrl(organizationId, botId),
+ {
+ ...options,
+ method: "GET",
+ },
+ );
+};
+
+export const getGetBotDelegationQueryKey = (
+ organizationId: string,
+ botId: string,
+) => {
+ return [
+ `/api/v2/organizations/${organizationId}/bots/${botId}/delegation`,
+ ] as const;
+};
+
+export const getGetBotDelegationQueryOptions = <
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | BotNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ botId: string,
+ options?: {
+ query?: Partial<
+ UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ >
+ >;
+ request?: SecondParameter;
+ },
+) => {
+ const { query: queryOptions, request: requestOptions } = options ?? {};
+
+ const queryKey =
+ queryOptions?.queryKey ??
+ getGetBotDelegationQueryKey(organizationId, botId);
+
+ const queryFn: QueryFunction<
+ Awaited>
+ > = ({ signal }) =>
+ getBotDelegation(organizationId, botId, { signal, ...requestOptions });
+
+ return {
+ queryKey,
+ queryFn,
+ enabled:
+ organizationId !== null &&
+ organizationId !== undefined &&
+ botId !== null &&
+ botId !== undefined,
+ ...queryOptions,
+ } as UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ > & { queryKey: DataTag };
+};
+
+export type GetBotDelegationQueryResult = NonNullable<
+ Awaited>
+>;
+export type GetBotDelegationQueryError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | BotNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse;
+
+export function useGetBotDelegation<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | BotNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ botId: string,
+ options: {
+ query: Partial<
+ UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ >
+ > &
+ Pick<
+ DefinedInitialDataOptions<
+ Awaited>,
+ TError,
+ Awaited>
+ >,
+ "initialData"
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): DefinedUseQueryResult & {
+ queryKey: DataTag;
+};
+export function useGetBotDelegation<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | BotNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ botId: string,
+ options?: {
+ query?: Partial<
+ UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ >
+ > &
+ Pick<
+ UndefinedInitialDataOptions<
+ Awaited>,
+ TError,
+ Awaited>
+ >,
+ "initialData"
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseQueryResult & {
+ queryKey: DataTag;
+};
+export function useGetBotDelegation<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | BotNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ botId: string,
+ options?: {
+ query?: Partial<
+ UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ >
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseQueryResult & {
+ queryKey: DataTag;
+};
+/**
+ * @summary Read a Bot's delegation
+ */
+
+export function useGetBotDelegation<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | BotNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ botId: string,
+ options?: {
+ query?: Partial<
+ UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ >
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseQueryResult & {
+ queryKey: DataTag;
+} {
+ const queryOptions = getGetBotDelegationQueryOptions(
+ organizationId,
+ botId,
+ options,
+ );
+
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<
+ TData,
+ TError
+ > & { queryKey: DataTag };
+
+ return withQueryKey(query, queryOptions.queryKey);
+}
+
+export const getReplaceBotDelegationUrl = (
+ organizationId: string,
+ botId: string,
+) => {
+ return `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/bots/${encodeURIComponent(String(botId))}/delegation`;
+};
+
+/**
+ * Replace how a Bot works. Mode self takes exactly one agent, which the Bot runs on with its apps, as every Bot did before agents were a list. Mode orchestrate takes one to twenty agents, in order, the first being the default: the Bot then answers on its own model with only the tools for replying, reacting, finding a task's thread and handing work to an agent, plus reading the person's memory, and each agent works with the Bot's apps as the person who asked. model and effort are the Bot's own when it orchestrates, one the model catalogue offers, or null for the organization's default; they are ignored in mode self. instructions steer how it hands work out and answers, and are read only in mode orchestrate. Every agent named must be one the caller can see, or one the Bot already has. Only whoever may manage the Bot may change it, and a Bot that comes with OpenBot cannot be changed.
+ * @summary Set a Bot's delegation
+ */
+export const replaceBotDelegation = async (
+ organizationId: string,
+ botId: string,
+ replaceBotDelegationRequest: ReplaceBotDelegationRequest,
+ headers: ReplaceBotDelegationHeaders,
+ options?: Parameters[1],
+): Promise => {
+ const getHeaders = (
+ h?: NonNullable,
+ ): Record => {
+ if (!h) return {};
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
+ if (Symbol.iterator in h) {
+ return Object.fromEntries(
+ Array.from(
+ h as Iterable>,
+ (entry) => Array.from(entry) as [string, string],
+ ),
+ );
+ }
+ const headers: Record = {};
+ for (const [name, value] of Object.entries<
+ string | readonly string[] | undefined
+ >(h)) {
+ if (value !== undefined) headers[name] = value;
+ }
+ return headers;
+ };
+ return apiRequest(
+ getReplaceBotDelegationUrl(organizationId, botId),
+ {
+ ...options,
+ method: "PUT",
+ headers: {
+ "Content-Type": "application/json",
+ ...headers,
+ ...getHeaders(options?.headers),
+ },
+ body: JSON.stringify(replaceBotDelegationRequest),
+ },
+ );
+};
+
+export const getReplaceBotDelegationMutationKey = () =>
+ ["replaceBotDelegation"] as const;
+
+export const getReplaceBotDelegationMutationOptions = <
+ TError =
+ | InvalidBotDelegationResponse
+ | UnauthenticatedResponse
+ | BotForbiddenResponse
+ | BotNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ ReplaceBotDelegationMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+}): UseMutationOptions<
+ Awaited>,
+ TError,
+ ReplaceBotDelegationMutationVariables,
+ TContext
+> => {
+ const mutationKey = getReplaceBotDelegationMutationKey();
+ const { mutation: mutationOptions, request: requestOptions } = options
+ ? options.mutation &&
+ "mutationKey" in options.mutation &&
+ options.mutation.mutationKey
+ ? options
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
+ : { mutation: { mutationKey }, request: undefined };
+
+ const mutationFn: MutationFunction<
+ Awaited>,
+ ReplaceBotDelegationMutationVariables
+ > = (props) => {
+ const { organizationId, botId, data, headers } = props ?? {};
+
+ return replaceBotDelegation(
+ organizationId,
+ botId,
+ data,
+ headers,
+ requestOptions,
+ );
+ };
+
+ return { mutationFn, ...mutationOptions };
+};
+
+export type ReplaceBotDelegationMutationResult = NonNullable<
+ Awaited>
+>;
+export type ReplaceBotDelegationMutationBody = ReplaceBotDelegationRequest;
+export type ReplaceBotDelegationMutationError =
+ | InvalidBotDelegationResponse
+ | UnauthenticatedResponse
+ | BotForbiddenResponse
+ | BotNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse;
+export type ReplaceBotDelegationMutationVariables = {
+ organizationId: string;
+ botId: string;
+ data: ReplaceBotDelegationRequest;
+ headers: ReplaceBotDelegationHeaders;
+};
+
+/**
+ * @summary Set a Bot's delegation
+ */
+export const useReplaceBotDelegation = <
+ TError =
+ | InvalidBotDelegationResponse
+ | UnauthenticatedResponse
+ | BotForbiddenResponse
+ | BotNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(
+ options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ ReplaceBotDelegationMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseMutationResult<
+ Awaited>,
+ TError,
+ ReplaceBotDelegationMutationVariables,
+ TContext
+> => {
+ return useMutation(
+ getReplaceBotDelegationMutationOptions(options),
+ queryClient,
+ );
+};
diff --git a/app/src/lib/api/generated/agents/agents.zod.ts b/app/src/lib/api/generated/agents/agents.zod.ts
new file mode 100644
index 0000000000..1d6bf909c6
--- /dev/null
+++ b/app/src/lib/api/generated/agents/agents.zod.ts
@@ -0,0 +1,1445 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import * as zod from "zod";
+
+/**
+ * Return one page of the agents the caller can see: the organization's public agents and the caller's own private ones, oldest first, and by id among agents made at the same moment. Somebody else's private agent is never among them. scope=organization lists every agent in the organization, people's private ones included, for an admin's screens; it is refused to anybody who is not an admin of the organization. A missing cursor starts at the first page and nextCursor null ends the list.
+ * @summary List agents
+ */
+
+export const ListBotAgentsParams = zod.object({
+ organizationId: zod
+ .string()
+ .min(1)
+ .describe(
+ "The organization, by its id or its slug. One the caller is not a member of answers as one that does not exist, `default` included.",
+ ),
+});
+
+export const listBotAgentsQueryScopeDefault = `caller`;
+export const listBotAgentsQueryLimitDefault = 50;
+export const listBotAgentsQueryLimitMax = 100;
+
+export const listBotAgentsQueryCursorMax = 4096;
+
+export const listBotAgentsQueryCursorRegExp = new RegExp("^[A-Za-z0-9_-]+$");
+
+export const ListBotAgentsQueryParams = zod.object({
+ scope: zod
+ .enum(["caller", "organization"])
+ .default(listBotAgentsQueryScopeDefault)
+ .describe(
+ "Whose agents: caller, the agents the caller can see; organization, every agent in the organization, for an admin of it only.",
+ ),
+ limit: zod
+ .int()
+ .min(1)
+ .max(listBotAgentsQueryLimitMax)
+ .default(listBotAgentsQueryLimitDefault)
+ .describe("Most items in one page."),
+ cursor: zod
+ .string()
+ .min(1)
+ .max(listBotAgentsQueryCursorMax)
+ .regex(listBotAgentsQueryCursorRegExp)
+ .optional()
+ .describe(
+ "Opaque continuation from the previous page's nextCursor, bound to the organization and the filters that made it. The server only ever issues cursors written in URL-safe base64 (letters, digits, - and _, no padding) and refuses anything else, so the pattern says so. A cursor that fits the pattern can still be refused: one this list never gave out, or one made for another organization or other filters.",
+ ),
+});
+
+export const listBotAgentsResponseAgentsItemSkillsItemNameMax = 80;
+
+export const listBotAgentsResponseAgentsItemSkillsItemNameRegExp = new RegExp(
+ "\\S",
+);
+export const listBotAgentsResponseAgentsItemSkillsItemDescriptionMax = 500;
+
+export const listBotAgentsResponseAgentsItemSkillsItemDescriptionRegExp =
+ new RegExp("\\S");
+export const listBotAgentsResponseAgentsItemSkillsItemExamplesItemMax = 200;
+
+export const listBotAgentsResponseAgentsItemSkillsItemExamplesItemRegExp =
+ new RegExp("\\S");
+export const listBotAgentsResponseAgentsItemSkillsItemExamplesMax = 5;
+
+export const listBotAgentsResponseAgentsItemBotCountMin = 0;
+
+export const listBotAgentsResponseNextCursorMax = 4096;
+
+export const listBotAgentsResponseNextCursorRegExp = new RegExp(
+ "^[A-Za-z0-9_-]+$",
+);
+
+export const ListBotAgentsResponse = zod.object({
+ agents: zod.array(
+ zod
+ .object({
+ id: zod.string().describe("The agent's id."),
+ name: zod.string().describe("What the agent is called."),
+ description: zod
+ .string()
+ .describe(
+ "What it is good at, in its owner's words. A Bot reads it when it decides which agent to hand work to.",
+ ),
+ kind: zod
+ .enum(["openbot", "address"])
+ .describe(
+ "openbot: runs inside OpenBot. address: runs at an AG-UI address, somebody's own or a framework OpenBot runs itself.",
+ ),
+ visibility: zod
+ .enum(["public", "private"])
+ .describe(
+ "public: every member's Bots may use it, and only an admin may make one. private: only its owner's Bots may use it.",
+ ),
+ endpoint: zod
+ .string()
+ .nullable()
+ .describe(
+ "The AG-UI address it runs at, as it was stored. Null for an agent that runs inside OpenBot.",
+ ),
+ framework: zod
+ .string()
+ .optional()
+ .describe(
+ 'What runs it, by the name a person reads ("LangChain", "OpenBot"). Absent when OpenBot doesn\'t know.',
+ ),
+ model: zod
+ .string()
+ .nullable()
+ .describe(
+ "The model it runs on, for an agent whose model is OpenBot's to choose. Null for the organization's default, or for an agent that picks its own.",
+ ),
+ skills: zod.array(
+ zod
+ .object({
+ name: zod
+ .string()
+ .min(1)
+ .max(listBotAgentsResponseAgentsItemSkillsItemNameMax)
+ .regex(listBotAgentsResponseAgentsItemSkillsItemNameRegExp)
+ .describe("The skill's name, 1 to 80 characters once trimmed."),
+ description: zod
+ .string()
+ .min(1)
+ .max(listBotAgentsResponseAgentsItemSkillsItemDescriptionMax)
+ .regex(
+ listBotAgentsResponseAgentsItemSkillsItemDescriptionRegExp,
+ )
+ .describe("What it does, 1 to 500 characters once trimmed."),
+ examples: zod
+ .array(
+ zod
+ .string()
+ .min(1)
+ .max(
+ listBotAgentsResponseAgentsItemSkillsItemExamplesItemMax,
+ )
+ .regex(
+ listBotAgentsResponseAgentsItemSkillsItemExamplesItemRegExp,
+ ),
+ )
+ .max(listBotAgentsResponseAgentsItemSkillsItemExamplesMax)
+ .optional()
+ .describe(
+ "Up to five things a person might ask for that it handles.",
+ ),
+ })
+ .describe(
+ "One thing the agent is good at, in the shape of an A2A Agent Card's skill. A Bot reads its agents' skills when it decides which to hand work to.",
+ ),
+ ),
+ hasAuth: zod
+ .boolean()
+ .describe("Whether a key is set for its address. Never the key."),
+ hasCallbackToken: zod
+ .boolean()
+ .describe(
+ "Whether it holds a credential for calling OpenBot's tools back. Never the credential.",
+ ),
+ builtIn: zod
+ .boolean()
+ .describe(
+ "Whether OpenBot runs it, inside OpenBot or at an address OpenBot started, so it needs no callback token of its own.",
+ ),
+ canManage: zod
+ .boolean()
+ .describe("Whether the caller may change and delete it."),
+ mine: zod.boolean().describe("Whether the caller added it."),
+ botCount: zod
+ .int()
+ .min(listBotAgentsResponseAgentsItemBotCountMin)
+ .describe(
+ "How many of the Bots the caller can see may use it, deleted Bots aside. A count only: which Bots is not said. With scope=organization, every Bot in the organization.",
+ ),
+ createdAt: zod.iso
+ .datetime({ offset: true })
+ .describe("When it was added."),
+ updatedAt: zod.iso
+ .datetime({ offset: true })
+ .describe("When it last changed."),
+ })
+ .describe(
+ "An agent as the caller sees it. canManage, mine and builtIn are the server's verdicts for this caller; a client renders them and never recomputes them. No secret is ever part of an agent: hasAuth and hasCallbackToken say whether one is set.",
+ ),
+ ),
+ nextCursor: zod
+ .string()
+ .max(listBotAgentsResponseNextCursorMax)
+ .regex(listBotAgentsResponseNextCursorRegExp)
+ .nullable()
+ .describe(
+ "Pass as cursor for the next page. Null ends the list. Written in URL-safe base64, the only form the cursor parameter accepts.",
+ ),
+});
+
+/**
+ * Add an agent for Bots to hand work to. kind openbot runs inside OpenBot, on the model given or the organization's default. kind address runs at an AG-UI address, which the server checks before saving; a key, when given, is stored encrypted and never returned. Anybody may add a private agent, for their own Bots; only an admin of the organization may add a public one, which every member's Bots may use. A repeated request with the same Idempotency-Key and body returns the first result.
+ * @summary Add an agent
+ */
+
+export const CreateBotAgentParams = zod.object({
+ organizationId: zod
+ .string()
+ .min(1)
+ .describe(
+ "The organization, by its id or its slug. One the caller is not a member of answers as one that does not exist, `default` included.",
+ ),
+});
+
+export const createBotAgentHeaderIdempotencyKeyMax = 128;
+
+export const CreateBotAgentHeader = zod.object({
+ "Idempotency-Key": zod
+ .string()
+ .min(1)
+ .max(createBotAgentHeaderIdempotencyKeyMax)
+ .describe(
+ "Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.",
+ ),
+});
+
+export const createBotAgentBodyNameMax = 80;
+
+export const createBotAgentBodyNameRegExp = new RegExp("\\S");
+export const createBotAgentBodyDescriptionMax = 1000;
+
+export const createBotAgentBodyDescriptionRegExp = new RegExp("\\S");
+export const createBotAgentBodyEndpointMax = 2048;
+
+export const createBotAgentBodyEndpointRegExp = new RegExp(
+ "^[Hh][Tt][Tt][Pp][Ss]?:/",
+);
+export const createBotAgentBodyAuthHeaderMax = 200;
+
+export const createBotAgentBodyAuthHeaderRegExp = new RegExp("^[A-Za-z0-9-]*$");
+export const createBotAgentBodyAuthValueMax = 8000;
+
+export const createBotAgentBodyModelMax = 500;
+
+export const createBotAgentBodyModelRegExp = new RegExp("\\S");
+export const createBotAgentBodySkillsItemNameMax = 80;
+
+export const createBotAgentBodySkillsItemNameRegExp = new RegExp("\\S");
+export const createBotAgentBodySkillsItemDescriptionMax = 500;
+
+export const createBotAgentBodySkillsItemDescriptionRegExp = new RegExp("\\S");
+export const createBotAgentBodySkillsItemExamplesItemMax = 200;
+
+export const createBotAgentBodySkillsItemExamplesItemRegExp = new RegExp("\\S");
+export const createBotAgentBodySkillsItemExamplesMax = 5;
+
+export const createBotAgentBodySkillsMax = 20;
+
+export const CreateBotAgentBody = zod
+ .object({
+ name: zod
+ .string()
+ .min(1)
+ .max(createBotAgentBodyNameMax)
+ .regex(createBotAgentBodyNameRegExp)
+ .describe("What the agent is called, 1 to 80 characters once trimmed."),
+ description: zod
+ .string()
+ .min(1)
+ .max(createBotAgentBodyDescriptionMax)
+ .regex(createBotAgentBodyDescriptionRegExp)
+ .describe(
+ "What it is good at, 1 to 1000 characters once trimmed. A Bot reads it when it decides which agent to hand work to, so say what to send it.",
+ ),
+ visibility: zod
+ .enum(["public", "private"])
+ .describe(
+ "public: every member's Bots may use it, and only an admin may make one. private: only its owner's Bots may use it.",
+ ),
+ kind: zod
+ .enum(["openbot", "address"])
+ .describe(
+ "openbot: runs inside OpenBot. address: runs at an AG-UI address, somebody's own or a framework OpenBot runs itself.",
+ ),
+ endpoint: zod
+ .url()
+ .max(createBotAgentBodyEndpointMax)
+ .regex(createBotAgentBodyEndpointRegExp)
+ .optional()
+ .describe(
+ "The AG-UI address it runs at: an absolute http or https address. An address that fits can still be refused: the server refuses one this organization may not reach, and one that does not answer a real AG-UI run.",
+ ),
+ auth: zod
+ .object({
+ header: zod
+ .string()
+ .max(createBotAgentBodyAuthHeaderMax)
+ .regex(createBotAgentBodyAuthHeaderRegExp)
+ .optional()
+ .describe(
+ "The header it is sent in. Blank or absent means Authorization.",
+ ),
+ value: zod
+ .string()
+ .max(createBotAgentBodyAuthValueMax)
+ .describe("The header's value."),
+ })
+ .optional()
+ .describe(
+ "A key the agent's address sits behind. Write-only: stored encrypted and never returned. A blank value sets no key.",
+ ),
+ harness: zod
+ .enum([
+ "",
+ "crewai",
+ "llamaindex",
+ "agno",
+ "langgraph",
+ "google-adk",
+ "antigravity",
+ "pydantic-ai",
+ "microsoft-agent-framework",
+ "claude-agent-sdk",
+ "strands",
+ "ag2",
+ "langroid",
+ "mastra",
+ ])
+ .optional()
+ .describe(
+ "The framework an agent at an address is built on, by its id in OpenBot's harness list (shared/harnesses.json). Empty means none was named. Kept only for kind address.",
+ ),
+ model: zod
+ .string()
+ .min(1)
+ .max(createBotAgentBodyModelMax)
+ .regex(createBotAgentBodyModelRegExp)
+ .nullish()
+ .describe(
+ "A model the catalogue offers, or null for the organization's default. Read only for an agent whose model is OpenBot's to choose.",
+ ),
+ skills: zod
+ .array(
+ zod
+ .object({
+ name: zod
+ .string()
+ .min(1)
+ .max(createBotAgentBodySkillsItemNameMax)
+ .regex(createBotAgentBodySkillsItemNameRegExp)
+ .describe("The skill's name, 1 to 80 characters once trimmed."),
+ description: zod
+ .string()
+ .min(1)
+ .max(createBotAgentBodySkillsItemDescriptionMax)
+ .regex(createBotAgentBodySkillsItemDescriptionRegExp)
+ .describe("What it does, 1 to 500 characters once trimmed."),
+ examples: zod
+ .array(
+ zod
+ .string()
+ .min(1)
+ .max(createBotAgentBodySkillsItemExamplesItemMax)
+ .regex(createBotAgentBodySkillsItemExamplesItemRegExp),
+ )
+ .max(createBotAgentBodySkillsItemExamplesMax)
+ .optional()
+ .describe(
+ "Up to five things a person might ask for that it handles.",
+ ),
+ })
+ .describe(
+ "One thing the agent is good at, in the shape of an A2A Agent Card's skill. A Bot reads its agents' skills when it decides which to hand work to.",
+ ),
+ )
+ .max(createBotAgentBodySkillsMax)
+ .optional()
+ .describe(
+ "Up to twenty things it is good at. Absent on a change leaves them as they are.",
+ ),
+ })
+ .describe(
+ "A new agent. endpoint is required for kind address and refused for kind openbot.",
+ );
+
+export const createBotAgentResponseAgentSkillsItemNameMax = 80;
+
+export const createBotAgentResponseAgentSkillsItemNameRegExp = new RegExp(
+ "\\S",
+);
+export const createBotAgentResponseAgentSkillsItemDescriptionMax = 500;
+
+export const createBotAgentResponseAgentSkillsItemDescriptionRegExp =
+ new RegExp("\\S");
+export const createBotAgentResponseAgentSkillsItemExamplesItemMax = 200;
+
+export const createBotAgentResponseAgentSkillsItemExamplesItemRegExp =
+ new RegExp("\\S");
+export const createBotAgentResponseAgentSkillsItemExamplesMax = 5;
+
+export const createBotAgentResponseAgentBotCountMin = 0;
+
+export const CreateBotAgentResponse = zod.object({
+ agent: zod
+ .object({
+ id: zod.string().describe("The agent's id."),
+ name: zod.string().describe("What the agent is called."),
+ description: zod
+ .string()
+ .describe(
+ "What it is good at, in its owner's words. A Bot reads it when it decides which agent to hand work to.",
+ ),
+ kind: zod
+ .enum(["openbot", "address"])
+ .describe(
+ "openbot: runs inside OpenBot. address: runs at an AG-UI address, somebody's own or a framework OpenBot runs itself.",
+ ),
+ visibility: zod
+ .enum(["public", "private"])
+ .describe(
+ "public: every member's Bots may use it, and only an admin may make one. private: only its owner's Bots may use it.",
+ ),
+ endpoint: zod
+ .string()
+ .nullable()
+ .describe(
+ "The AG-UI address it runs at, as it was stored. Null for an agent that runs inside OpenBot.",
+ ),
+ framework: zod
+ .string()
+ .optional()
+ .describe(
+ 'What runs it, by the name a person reads ("LangChain", "OpenBot"). Absent when OpenBot doesn\'t know.',
+ ),
+ model: zod
+ .string()
+ .nullable()
+ .describe(
+ "The model it runs on, for an agent whose model is OpenBot's to choose. Null for the organization's default, or for an agent that picks its own.",
+ ),
+ skills: zod.array(
+ zod
+ .object({
+ name: zod
+ .string()
+ .min(1)
+ .max(createBotAgentResponseAgentSkillsItemNameMax)
+ .regex(createBotAgentResponseAgentSkillsItemNameRegExp)
+ .describe("The skill's name, 1 to 80 characters once trimmed."),
+ description: zod
+ .string()
+ .min(1)
+ .max(createBotAgentResponseAgentSkillsItemDescriptionMax)
+ .regex(createBotAgentResponseAgentSkillsItemDescriptionRegExp)
+ .describe("What it does, 1 to 500 characters once trimmed."),
+ examples: zod
+ .array(
+ zod
+ .string()
+ .min(1)
+ .max(createBotAgentResponseAgentSkillsItemExamplesItemMax)
+ .regex(
+ createBotAgentResponseAgentSkillsItemExamplesItemRegExp,
+ ),
+ )
+ .max(createBotAgentResponseAgentSkillsItemExamplesMax)
+ .optional()
+ .describe(
+ "Up to five things a person might ask for that it handles.",
+ ),
+ })
+ .describe(
+ "One thing the agent is good at, in the shape of an A2A Agent Card's skill. A Bot reads its agents' skills when it decides which to hand work to.",
+ ),
+ ),
+ hasAuth: zod
+ .boolean()
+ .describe("Whether a key is set for its address. Never the key."),
+ hasCallbackToken: zod
+ .boolean()
+ .describe(
+ "Whether it holds a credential for calling OpenBot's tools back. Never the credential.",
+ ),
+ builtIn: zod
+ .boolean()
+ .describe(
+ "Whether OpenBot runs it, inside OpenBot or at an address OpenBot started, so it needs no callback token of its own.",
+ ),
+ canManage: zod
+ .boolean()
+ .describe("Whether the caller may change and delete it."),
+ mine: zod.boolean().describe("Whether the caller added it."),
+ botCount: zod
+ .int()
+ .min(createBotAgentResponseAgentBotCountMin)
+ .describe(
+ "How many of the Bots the caller can see may use it, deleted Bots aside. A count only: which Bots is not said. With scope=organization, every Bot in the organization.",
+ ),
+ createdAt: zod.iso
+ .datetime({ offset: true })
+ .describe("When it was added."),
+ updatedAt: zod.iso
+ .datetime({ offset: true })
+ .describe("When it last changed."),
+ })
+ .describe(
+ "An agent as the caller sees it. canManage, mine and builtIn are the server's verdicts for this caller; a client renders them and never recomputes them. No secret is ever part of an agent: hasAuth and hasCallbackToken say whether one is set.",
+ ),
+});
+
+/**
+ * Return one agent the caller can see. An agent that does not exist, was deleted, or is private to somebody else is not found.
+ * @summary Read one agent
+ */
+
+export const getBotAgentPathBotAgentIdMax = 200;
+
+export const getBotAgentPathBotAgentIdRegExp = new RegExp("\\S");
+
+export const GetBotAgentParams = zod.object({
+ organizationId: zod
+ .string()
+ .min(1)
+ .describe(
+ "The organization, by its id or its slug. One the caller is not a member of answers as one that does not exist, `default` included.",
+ ),
+ botAgentId: zod
+ .string()
+ .min(1)
+ .max(getBotAgentPathBotAgentIdMax)
+ .regex(getBotAgentPathBotAgentIdRegExp)
+ .describe("The agent's id."),
+});
+
+export const getBotAgentResponseAgentSkillsItemNameMax = 80;
+
+export const getBotAgentResponseAgentSkillsItemNameRegExp = new RegExp("\\S");
+export const getBotAgentResponseAgentSkillsItemDescriptionMax = 500;
+
+export const getBotAgentResponseAgentSkillsItemDescriptionRegExp = new RegExp(
+ "\\S",
+);
+export const getBotAgentResponseAgentSkillsItemExamplesItemMax = 200;
+
+export const getBotAgentResponseAgentSkillsItemExamplesItemRegExp = new RegExp(
+ "\\S",
+);
+export const getBotAgentResponseAgentSkillsItemExamplesMax = 5;
+
+export const getBotAgentResponseAgentBotCountMin = 0;
+
+export const GetBotAgentResponse = zod.object({
+ agent: zod
+ .object({
+ id: zod.string().describe("The agent's id."),
+ name: zod.string().describe("What the agent is called."),
+ description: zod
+ .string()
+ .describe(
+ "What it is good at, in its owner's words. A Bot reads it when it decides which agent to hand work to.",
+ ),
+ kind: zod
+ .enum(["openbot", "address"])
+ .describe(
+ "openbot: runs inside OpenBot. address: runs at an AG-UI address, somebody's own or a framework OpenBot runs itself.",
+ ),
+ visibility: zod
+ .enum(["public", "private"])
+ .describe(
+ "public: every member's Bots may use it, and only an admin may make one. private: only its owner's Bots may use it.",
+ ),
+ endpoint: zod
+ .string()
+ .nullable()
+ .describe(
+ "The AG-UI address it runs at, as it was stored. Null for an agent that runs inside OpenBot.",
+ ),
+ framework: zod
+ .string()
+ .optional()
+ .describe(
+ 'What runs it, by the name a person reads ("LangChain", "OpenBot"). Absent when OpenBot doesn\'t know.',
+ ),
+ model: zod
+ .string()
+ .nullable()
+ .describe(
+ "The model it runs on, for an agent whose model is OpenBot's to choose. Null for the organization's default, or for an agent that picks its own.",
+ ),
+ skills: zod.array(
+ zod
+ .object({
+ name: zod
+ .string()
+ .min(1)
+ .max(getBotAgentResponseAgentSkillsItemNameMax)
+ .regex(getBotAgentResponseAgentSkillsItemNameRegExp)
+ .describe("The skill's name, 1 to 80 characters once trimmed."),
+ description: zod
+ .string()
+ .min(1)
+ .max(getBotAgentResponseAgentSkillsItemDescriptionMax)
+ .regex(getBotAgentResponseAgentSkillsItemDescriptionRegExp)
+ .describe("What it does, 1 to 500 characters once trimmed."),
+ examples: zod
+ .array(
+ zod
+ .string()
+ .min(1)
+ .max(getBotAgentResponseAgentSkillsItemExamplesItemMax)
+ .regex(getBotAgentResponseAgentSkillsItemExamplesItemRegExp),
+ )
+ .max(getBotAgentResponseAgentSkillsItemExamplesMax)
+ .optional()
+ .describe(
+ "Up to five things a person might ask for that it handles.",
+ ),
+ })
+ .describe(
+ "One thing the agent is good at, in the shape of an A2A Agent Card's skill. A Bot reads its agents' skills when it decides which to hand work to.",
+ ),
+ ),
+ hasAuth: zod
+ .boolean()
+ .describe("Whether a key is set for its address. Never the key."),
+ hasCallbackToken: zod
+ .boolean()
+ .describe(
+ "Whether it holds a credential for calling OpenBot's tools back. Never the credential.",
+ ),
+ builtIn: zod
+ .boolean()
+ .describe(
+ "Whether OpenBot runs it, inside OpenBot or at an address OpenBot started, so it needs no callback token of its own.",
+ ),
+ canManage: zod
+ .boolean()
+ .describe("Whether the caller may change and delete it."),
+ mine: zod.boolean().describe("Whether the caller added it."),
+ botCount: zod
+ .int()
+ .min(getBotAgentResponseAgentBotCountMin)
+ .describe(
+ "How many of the Bots the caller can see may use it, deleted Bots aside. A count only: which Bots is not said. With scope=organization, every Bot in the organization.",
+ ),
+ createdAt: zod.iso
+ .datetime({ offset: true })
+ .describe("When it was added."),
+ updatedAt: zod.iso
+ .datetime({ offset: true })
+ .describe("When it last changed."),
+ })
+ .describe(
+ "An agent as the caller sees it. canManage, mine and builtIn are the server's verdicts for this caller; a client renders them and never recomputes them. No secret is ever part of an agent: hasAuth and hasCallbackToken say whether one is set.",
+ ),
+});
+
+/**
+ * Replace an agent's name, description and visibility, which are all required, and change any optional field that is present. An absent endpoint, key, model or skills leaves that setting as it is, so an edit to a name never drops a key. Only whoever may manage the agent may change it: its owner for a private one, an admin for a public one. Only an admin may make an agent public. kind cannot change. Every Bot that uses the agent runs on the change from its next turn.
+ * @summary Change an agent
+ */
+
+export const updateBotAgentPathBotAgentIdMax = 200;
+
+export const updateBotAgentPathBotAgentIdRegExp = new RegExp("\\S");
+
+export const UpdateBotAgentParams = zod.object({
+ organizationId: zod
+ .string()
+ .min(1)
+ .describe(
+ "The organization, by its id or its slug. One the caller is not a member of answers as one that does not exist, `default` included.",
+ ),
+ botAgentId: zod
+ .string()
+ .min(1)
+ .max(updateBotAgentPathBotAgentIdMax)
+ .regex(updateBotAgentPathBotAgentIdRegExp)
+ .describe("The agent's id."),
+});
+
+export const updateBotAgentHeaderIdempotencyKeyMax = 128;
+
+export const UpdateBotAgentHeader = zod.object({
+ "Idempotency-Key": zod
+ .string()
+ .min(1)
+ .max(updateBotAgentHeaderIdempotencyKeyMax)
+ .describe(
+ "Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.",
+ ),
+});
+
+export const updateBotAgentBodyNameMax = 80;
+
+export const updateBotAgentBodyNameRegExp = new RegExp("\\S");
+export const updateBotAgentBodyDescriptionMax = 1000;
+
+export const updateBotAgentBodyDescriptionRegExp = new RegExp("\\S");
+export const updateBotAgentBodyEndpointMax = 2048;
+
+export const updateBotAgentBodyEndpointRegExp = new RegExp(
+ "^[Hh][Tt][Tt][Pp][Ss]?:/",
+);
+export const updateBotAgentBodyAuthHeaderMax = 200;
+
+export const updateBotAgentBodyAuthHeaderRegExp = new RegExp("^[A-Za-z0-9-]*$");
+export const updateBotAgentBodyAuthValueMax = 8000;
+
+export const updateBotAgentBodyModelMax = 500;
+
+export const updateBotAgentBodyModelRegExp = new RegExp("\\S");
+export const updateBotAgentBodySkillsItemNameMax = 80;
+
+export const updateBotAgentBodySkillsItemNameRegExp = new RegExp("\\S");
+export const updateBotAgentBodySkillsItemDescriptionMax = 500;
+
+export const updateBotAgentBodySkillsItemDescriptionRegExp = new RegExp("\\S");
+export const updateBotAgentBodySkillsItemExamplesItemMax = 200;
+
+export const updateBotAgentBodySkillsItemExamplesItemRegExp = new RegExp("\\S");
+export const updateBotAgentBodySkillsItemExamplesMax = 5;
+
+export const updateBotAgentBodySkillsMax = 20;
+
+export const UpdateBotAgentBody = zod
+ .object({
+ name: zod
+ .string()
+ .min(1)
+ .max(updateBotAgentBodyNameMax)
+ .regex(updateBotAgentBodyNameRegExp)
+ .describe("What the agent is called, 1 to 80 characters once trimmed."),
+ description: zod
+ .string()
+ .min(1)
+ .max(updateBotAgentBodyDescriptionMax)
+ .regex(updateBotAgentBodyDescriptionRegExp)
+ .describe(
+ "What it is good at, 1 to 1000 characters once trimmed. A Bot reads it when it decides which agent to hand work to, so say what to send it.",
+ ),
+ visibility: zod
+ .enum(["public", "private"])
+ .describe(
+ "public: every member's Bots may use it, and only an admin may make one. private: only its owner's Bots may use it.",
+ ),
+ endpoint: zod
+ .url()
+ .max(updateBotAgentBodyEndpointMax)
+ .regex(updateBotAgentBodyEndpointRegExp)
+ .optional()
+ .describe(
+ "The AG-UI address it runs at: an absolute http or https address. An address that fits can still be refused: the server refuses one this organization may not reach, and one that does not answer a real AG-UI run.",
+ ),
+ auth: zod
+ .object({
+ header: zod
+ .string()
+ .max(updateBotAgentBodyAuthHeaderMax)
+ .regex(updateBotAgentBodyAuthHeaderRegExp)
+ .optional()
+ .describe(
+ "The header it is sent in. Blank or absent means Authorization.",
+ ),
+ value: zod
+ .string()
+ .max(updateBotAgentBodyAuthValueMax)
+ .describe("The header's value."),
+ })
+ .optional()
+ .describe(
+ "A key the agent's address sits behind. Write-only: stored encrypted and never returned. A blank value sets no key.",
+ ),
+ model: zod
+ .string()
+ .min(1)
+ .max(updateBotAgentBodyModelMax)
+ .regex(updateBotAgentBodyModelRegExp)
+ .nullish()
+ .describe(
+ "A model the catalogue offers, or null for the organization's default. Read only for an agent whose model is OpenBot's to choose.",
+ ),
+ skills: zod
+ .array(
+ zod
+ .object({
+ name: zod
+ .string()
+ .min(1)
+ .max(updateBotAgentBodySkillsItemNameMax)
+ .regex(updateBotAgentBodySkillsItemNameRegExp)
+ .describe("The skill's name, 1 to 80 characters once trimmed."),
+ description: zod
+ .string()
+ .min(1)
+ .max(updateBotAgentBodySkillsItemDescriptionMax)
+ .regex(updateBotAgentBodySkillsItemDescriptionRegExp)
+ .describe("What it does, 1 to 500 characters once trimmed."),
+ examples: zod
+ .array(
+ zod
+ .string()
+ .min(1)
+ .max(updateBotAgentBodySkillsItemExamplesItemMax)
+ .regex(updateBotAgentBodySkillsItemExamplesItemRegExp),
+ )
+ .max(updateBotAgentBodySkillsItemExamplesMax)
+ .optional()
+ .describe(
+ "Up to five things a person might ask for that it handles.",
+ ),
+ })
+ .describe(
+ "One thing the agent is good at, in the shape of an A2A Agent Card's skill. A Bot reads its agents' skills when it decides which to hand work to.",
+ ),
+ )
+ .max(updateBotAgentBodySkillsMax)
+ .optional()
+ .describe(
+ "Up to twenty things it is good at. Absent on a change leaves them as they are.",
+ ),
+ })
+ .describe(
+ "An agent's fields after the change. Absent optional fields stay as they are.",
+ );
+
+export const updateBotAgentResponseAgentSkillsItemNameMax = 80;
+
+export const updateBotAgentResponseAgentSkillsItemNameRegExp = new RegExp(
+ "\\S",
+);
+export const updateBotAgentResponseAgentSkillsItemDescriptionMax = 500;
+
+export const updateBotAgentResponseAgentSkillsItemDescriptionRegExp =
+ new RegExp("\\S");
+export const updateBotAgentResponseAgentSkillsItemExamplesItemMax = 200;
+
+export const updateBotAgentResponseAgentSkillsItemExamplesItemRegExp =
+ new RegExp("\\S");
+export const updateBotAgentResponseAgentSkillsItemExamplesMax = 5;
+
+export const updateBotAgentResponseAgentBotCountMin = 0;
+
+export const UpdateBotAgentResponse = zod.object({
+ agent: zod
+ .object({
+ id: zod.string().describe("The agent's id."),
+ name: zod.string().describe("What the agent is called."),
+ description: zod
+ .string()
+ .describe(
+ "What it is good at, in its owner's words. A Bot reads it when it decides which agent to hand work to.",
+ ),
+ kind: zod
+ .enum(["openbot", "address"])
+ .describe(
+ "openbot: runs inside OpenBot. address: runs at an AG-UI address, somebody's own or a framework OpenBot runs itself.",
+ ),
+ visibility: zod
+ .enum(["public", "private"])
+ .describe(
+ "public: every member's Bots may use it, and only an admin may make one. private: only its owner's Bots may use it.",
+ ),
+ endpoint: zod
+ .string()
+ .nullable()
+ .describe(
+ "The AG-UI address it runs at, as it was stored. Null for an agent that runs inside OpenBot.",
+ ),
+ framework: zod
+ .string()
+ .optional()
+ .describe(
+ 'What runs it, by the name a person reads ("LangChain", "OpenBot"). Absent when OpenBot doesn\'t know.',
+ ),
+ model: zod
+ .string()
+ .nullable()
+ .describe(
+ "The model it runs on, for an agent whose model is OpenBot's to choose. Null for the organization's default, or for an agent that picks its own.",
+ ),
+ skills: zod.array(
+ zod
+ .object({
+ name: zod
+ .string()
+ .min(1)
+ .max(updateBotAgentResponseAgentSkillsItemNameMax)
+ .regex(updateBotAgentResponseAgentSkillsItemNameRegExp)
+ .describe("The skill's name, 1 to 80 characters once trimmed."),
+ description: zod
+ .string()
+ .min(1)
+ .max(updateBotAgentResponseAgentSkillsItemDescriptionMax)
+ .regex(updateBotAgentResponseAgentSkillsItemDescriptionRegExp)
+ .describe("What it does, 1 to 500 characters once trimmed."),
+ examples: zod
+ .array(
+ zod
+ .string()
+ .min(1)
+ .max(updateBotAgentResponseAgentSkillsItemExamplesItemMax)
+ .regex(
+ updateBotAgentResponseAgentSkillsItemExamplesItemRegExp,
+ ),
+ )
+ .max(updateBotAgentResponseAgentSkillsItemExamplesMax)
+ .optional()
+ .describe(
+ "Up to five things a person might ask for that it handles.",
+ ),
+ })
+ .describe(
+ "One thing the agent is good at, in the shape of an A2A Agent Card's skill. A Bot reads its agents' skills when it decides which to hand work to.",
+ ),
+ ),
+ hasAuth: zod
+ .boolean()
+ .describe("Whether a key is set for its address. Never the key."),
+ hasCallbackToken: zod
+ .boolean()
+ .describe(
+ "Whether it holds a credential for calling OpenBot's tools back. Never the credential.",
+ ),
+ builtIn: zod
+ .boolean()
+ .describe(
+ "Whether OpenBot runs it, inside OpenBot or at an address OpenBot started, so it needs no callback token of its own.",
+ ),
+ canManage: zod
+ .boolean()
+ .describe("Whether the caller may change and delete it."),
+ mine: zod.boolean().describe("Whether the caller added it."),
+ botCount: zod
+ .int()
+ .min(updateBotAgentResponseAgentBotCountMin)
+ .describe(
+ "How many of the Bots the caller can see may use it, deleted Bots aside. A count only: which Bots is not said. With scope=organization, every Bot in the organization.",
+ ),
+ createdAt: zod.iso
+ .datetime({ offset: true })
+ .describe("When it was added."),
+ updatedAt: zod.iso
+ .datetime({ offset: true })
+ .describe("When it last changed."),
+ })
+ .describe(
+ "An agent as the caller sees it. canManage, mine and builtIn are the server's verdicts for this caller; a client renders them and never recomputes them. No secret is ever part of an agent: hasAuth and hasCallbackToken say whether one is set.",
+ ),
+});
+
+/**
+ * Delete an agent and retire its key and callback token. It is taken off every Bot that may use it. Refused, with BOT_AGENT_IN_USE, while it is the only agent of any Bot, deleted Bots aside: give that Bot another agent first. The refusal names those Bots the caller can see and only counts the rest. Only whoever may manage the agent may delete it. Task threads it worked in stay readable. An agent that is already deleted is not found.
+ * @summary Delete an agent
+ */
+
+export const deleteBotAgentPathBotAgentIdMax = 200;
+
+export const deleteBotAgentPathBotAgentIdRegExp = new RegExp("\\S");
+
+export const DeleteBotAgentParams = zod.object({
+ organizationId: zod
+ .string()
+ .min(1)
+ .describe(
+ "The organization, by its id or its slug. One the caller is not a member of answers as one that does not exist, `default` included.",
+ ),
+ botAgentId: zod
+ .string()
+ .min(1)
+ .max(deleteBotAgentPathBotAgentIdMax)
+ .regex(deleteBotAgentPathBotAgentIdRegExp)
+ .describe("The agent's id."),
+});
+
+export const deleteBotAgentHeaderIdempotencyKeyMax = 128;
+
+export const DeleteBotAgentHeader = zod.object({
+ "Idempotency-Key": zod
+ .string()
+ .min(1)
+ .max(deleteBotAgentHeaderIdempotencyKeyMax)
+ .describe(
+ "Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.",
+ ),
+});
+
+export const DeleteBotAgentResponse = zod.void();
+
+/**
+ * Give an agent at an address a new credential for calling OpenBot's tools back, and return it this once: it is never returned again, and the audit trail records that one was issued, never what it is. Issuing one for an agent that has one replaces it, which is how a leaked token is retired. A call made with it is allowed only for a run of a Bot that may use this agent, as the person that run is for. Only whoever may manage the agent may issue one. An agent that runs inside OpenBot, or at an address OpenBot runs itself, needs none and is refused.
+ * @summary Issue an agent's callback token
+ */
+
+export const issueBotAgentCallbackTokenPathBotAgentIdMax = 200;
+
+export const issueBotAgentCallbackTokenPathBotAgentIdRegExp = new RegExp("\\S");
+
+export const IssueBotAgentCallbackTokenParams = zod.object({
+ organizationId: zod
+ .string()
+ .min(1)
+ .describe(
+ "The organization, by its id or its slug. One the caller is not a member of answers as one that does not exist, `default` included.",
+ ),
+ botAgentId: zod
+ .string()
+ .min(1)
+ .max(issueBotAgentCallbackTokenPathBotAgentIdMax)
+ .regex(issueBotAgentCallbackTokenPathBotAgentIdRegExp)
+ .describe("The agent's id."),
+});
+
+export const issueBotAgentCallbackTokenHeaderIdempotencyKeyMax = 128;
+
+export const IssueBotAgentCallbackTokenHeader = zod.object({
+ "Idempotency-Key": zod
+ .string()
+ .min(1)
+ .max(issueBotAgentCallbackTokenHeaderIdempotencyKeyMax)
+ .describe(
+ "Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.",
+ ),
+});
+
+export const IssueBotAgentCallbackTokenResponse = zod.object({
+ token: zod
+ .string()
+ .min(1)
+ .describe(
+ "The agent's credential for calling OpenBot's tools back. Returned this once and never again.",
+ ),
+});
+
+/**
+ * Take away an agent's credential for calling OpenBot's tools back. It still answers in a conversation; it can't reach anything outside one. Only whoever may manage the agent may revoke it. Revoking a token that is not there changes nothing.
+ * @summary Revoke an agent's callback token
+ */
+
+export const revokeBotAgentCallbackTokenPathBotAgentIdMax = 200;
+
+export const revokeBotAgentCallbackTokenPathBotAgentIdRegExp = new RegExp(
+ "\\S",
+);
+
+export const RevokeBotAgentCallbackTokenParams = zod.object({
+ organizationId: zod
+ .string()
+ .min(1)
+ .describe(
+ "The organization, by its id or its slug. One the caller is not a member of answers as one that does not exist, `default` included.",
+ ),
+ botAgentId: zod
+ .string()
+ .min(1)
+ .max(revokeBotAgentCallbackTokenPathBotAgentIdMax)
+ .regex(revokeBotAgentCallbackTokenPathBotAgentIdRegExp)
+ .describe("The agent's id."),
+});
+
+export const revokeBotAgentCallbackTokenHeaderIdempotencyKeyMax = 128;
+
+export const RevokeBotAgentCallbackTokenHeader = zod.object({
+ "Idempotency-Key": zod
+ .string()
+ .min(1)
+ .max(revokeBotAgentCallbackTokenHeaderIdempotencyKeyMax)
+ .describe(
+ "Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.",
+ ),
+});
+
+export const revokeBotAgentCallbackTokenResponseAgentSkillsItemNameMax = 80;
+
+export const revokeBotAgentCallbackTokenResponseAgentSkillsItemNameRegExp =
+ new RegExp("\\S");
+export const revokeBotAgentCallbackTokenResponseAgentSkillsItemDescriptionMax = 500;
+
+export const revokeBotAgentCallbackTokenResponseAgentSkillsItemDescriptionRegExp =
+ new RegExp("\\S");
+export const revokeBotAgentCallbackTokenResponseAgentSkillsItemExamplesItemMax = 200;
+
+export const revokeBotAgentCallbackTokenResponseAgentSkillsItemExamplesItemRegExp =
+ new RegExp("\\S");
+export const revokeBotAgentCallbackTokenResponseAgentSkillsItemExamplesMax = 5;
+
+export const revokeBotAgentCallbackTokenResponseAgentBotCountMin = 0;
+
+export const RevokeBotAgentCallbackTokenResponse = zod.object({
+ agent: zod
+ .object({
+ id: zod.string().describe("The agent's id."),
+ name: zod.string().describe("What the agent is called."),
+ description: zod
+ .string()
+ .describe(
+ "What it is good at, in its owner's words. A Bot reads it when it decides which agent to hand work to.",
+ ),
+ kind: zod
+ .enum(["openbot", "address"])
+ .describe(
+ "openbot: runs inside OpenBot. address: runs at an AG-UI address, somebody's own or a framework OpenBot runs itself.",
+ ),
+ visibility: zod
+ .enum(["public", "private"])
+ .describe(
+ "public: every member's Bots may use it, and only an admin may make one. private: only its owner's Bots may use it.",
+ ),
+ endpoint: zod
+ .string()
+ .nullable()
+ .describe(
+ "The AG-UI address it runs at, as it was stored. Null for an agent that runs inside OpenBot.",
+ ),
+ framework: zod
+ .string()
+ .optional()
+ .describe(
+ 'What runs it, by the name a person reads ("LangChain", "OpenBot"). Absent when OpenBot doesn\'t know.',
+ ),
+ model: zod
+ .string()
+ .nullable()
+ .describe(
+ "The model it runs on, for an agent whose model is OpenBot's to choose. Null for the organization's default, or for an agent that picks its own.",
+ ),
+ skills: zod.array(
+ zod
+ .object({
+ name: zod
+ .string()
+ .min(1)
+ .max(revokeBotAgentCallbackTokenResponseAgentSkillsItemNameMax)
+ .regex(
+ revokeBotAgentCallbackTokenResponseAgentSkillsItemNameRegExp,
+ )
+ .describe("The skill's name, 1 to 80 characters once trimmed."),
+ description: zod
+ .string()
+ .min(1)
+ .max(
+ revokeBotAgentCallbackTokenResponseAgentSkillsItemDescriptionMax,
+ )
+ .regex(
+ revokeBotAgentCallbackTokenResponseAgentSkillsItemDescriptionRegExp,
+ )
+ .describe("What it does, 1 to 500 characters once trimmed."),
+ examples: zod
+ .array(
+ zod
+ .string()
+ .min(1)
+ .max(
+ revokeBotAgentCallbackTokenResponseAgentSkillsItemExamplesItemMax,
+ )
+ .regex(
+ revokeBotAgentCallbackTokenResponseAgentSkillsItemExamplesItemRegExp,
+ ),
+ )
+ .max(
+ revokeBotAgentCallbackTokenResponseAgentSkillsItemExamplesMax,
+ )
+ .optional()
+ .describe(
+ "Up to five things a person might ask for that it handles.",
+ ),
+ })
+ .describe(
+ "One thing the agent is good at, in the shape of an A2A Agent Card's skill. A Bot reads its agents' skills when it decides which to hand work to.",
+ ),
+ ),
+ hasAuth: zod
+ .boolean()
+ .describe("Whether a key is set for its address. Never the key."),
+ hasCallbackToken: zod
+ .boolean()
+ .describe(
+ "Whether it holds a credential for calling OpenBot's tools back. Never the credential.",
+ ),
+ builtIn: zod
+ .boolean()
+ .describe(
+ "Whether OpenBot runs it, inside OpenBot or at an address OpenBot started, so it needs no callback token of its own.",
+ ),
+ canManage: zod
+ .boolean()
+ .describe("Whether the caller may change and delete it."),
+ mine: zod.boolean().describe("Whether the caller added it."),
+ botCount: zod
+ .int()
+ .min(revokeBotAgentCallbackTokenResponseAgentBotCountMin)
+ .describe(
+ "How many of the Bots the caller can see may use it, deleted Bots aside. A count only: which Bots is not said. With scope=organization, every Bot in the organization.",
+ ),
+ createdAt: zod.iso
+ .datetime({ offset: true })
+ .describe("When it was added."),
+ updatedAt: zod.iso
+ .datetime({ offset: true })
+ .describe("When it last changed."),
+ })
+ .describe(
+ "An agent as the caller sees it. canManage, mine and builtIn are the server's verdicts for this caller; a client renders them and never recomputes them. No secret is ever part of an agent: hasAuth and hasCallbackToken say whether one is set.",
+ ),
+});
+
+/**
+ * Return how a Bot the caller can see works: on its own agent (mode self, every Bot made before agents were a list), or handing work to the agents it may use (mode orchestrate). The first agent is its default: a Bot in mode self runs on it, and a Bot in mode orchestrate hands it work the Bot names no agent for and every run nobody is waiting on (a routine, a check-in, a goal, another Bot's hand-off, a group conversation). Whoever uses a Bot uses its agents: an agent that is private to the Bot's owner still does the work for everybody the Bot is shared with, and to anybody else it is named Private agent, with its description withheld. An agent that was deleted, or that the Bot's owner can no longer use, is listed with available false, and the Bot hands it nothing.
+ * @summary Read a Bot's delegation
+ */
+
+export const getBotDelegationPathBotIdRegExp = new RegExp("\\S");
+
+export const GetBotDelegationParams = zod.object({
+ organizationId: zod
+ .string()
+ .min(1)
+ .describe(
+ "The organization, by its id or its slug. One the caller is not a member of answers as one that does not exist, `default` included.",
+ ),
+ botId: zod
+ .string()
+ .min(1)
+ .regex(getBotDelegationPathBotIdRegExp)
+ .describe("The Bot's id."),
+});
+
+export const GetBotDelegationResponse = zod
+ .object({
+ botId: zod.string().describe("The Bot's id."),
+ mode: zod
+ .enum(["self", "orchestrate"])
+ .describe(
+ "self: the Bot runs on its one agent with its apps. orchestrate: the Bot answers on its own model and hands work to the agents it may use.",
+ ),
+ model: zod
+ .string()
+ .nullable()
+ .describe(
+ "The model the Bot answers on when it orchestrates, or null for the organization's default.",
+ ),
+ effort: zod
+ .string()
+ .nullable()
+ .describe(
+ "How hard it thinks when it orchestrates, or null for the model's own.",
+ ),
+ instructions: zod
+ .string()
+ .describe(
+ "How it hands work out and answers when it orchestrates. May be empty. Empty for a caller who can't change the Bot, since it can name an agent private to its owner.",
+ ),
+ agents: zod
+ .array(
+ zod
+ .object({
+ id: zod.string().describe("The agent's id."),
+ name: zod
+ .string()
+ .describe(
+ "What the agent is called. An agent private to somebody other than the caller is named Private agent.",
+ ),
+ description: zod
+ .string()
+ .describe(
+ "What it is good at. Empty for an agent private to somebody other than the caller.",
+ ),
+ kind: zod
+ .enum(["openbot", "address"])
+ .describe(
+ "openbot: runs inside OpenBot. address: runs at an AG-UI address, somebody's own or a framework OpenBot runs itself.",
+ ),
+ framework: zod
+ .string()
+ .optional()
+ .describe(
+ "What runs it, by the name a person reads. Absent when OpenBot doesn't know.",
+ ),
+ available: zod
+ .boolean()
+ .describe(
+ "Whether the Bot may still hand it work: false once the agent is deleted, or private to somebody other than the Bot's owner.",
+ ),
+ })
+ .describe("One agent a Bot may use, as the caller sees it."),
+ )
+ .min(1),
+ canManage: zod.boolean().describe("Whether the caller may change it."),
+ })
+ .describe(
+ "How a Bot works, and the agents it may use, the first being its default.",
+ );
+
+/**
+ * Replace how a Bot works. Mode self takes exactly one agent, which the Bot runs on with its apps, as every Bot did before agents were a list. Mode orchestrate takes one to twenty agents, in order, the first being the default: the Bot then answers on its own model with only the tools for replying, reacting, finding a task's thread and handing work to an agent, plus reading the person's memory, and each agent works with the Bot's apps as the person who asked. model and effort are the Bot's own when it orchestrates, one the model catalogue offers, or null for the organization's default; they are ignored in mode self. instructions steer how it hands work out and answers, and are read only in mode orchestrate. Every agent named must be one the caller can see, or one the Bot already has. Only whoever may manage the Bot may change it, and a Bot that comes with OpenBot cannot be changed.
+ * @summary Set a Bot's delegation
+ */
+
+export const replaceBotDelegationPathBotIdRegExp = new RegExp("\\S");
+
+export const ReplaceBotDelegationParams = zod.object({
+ organizationId: zod
+ .string()
+ .min(1)
+ .describe(
+ "The organization, by its id or its slug. One the caller is not a member of answers as one that does not exist, `default` included.",
+ ),
+ botId: zod
+ .string()
+ .min(1)
+ .regex(replaceBotDelegationPathBotIdRegExp)
+ .describe("The Bot's id."),
+});
+
+export const replaceBotDelegationHeaderIdempotencyKeyMax = 128;
+
+export const ReplaceBotDelegationHeader = zod.object({
+ "Idempotency-Key": zod
+ .string()
+ .min(1)
+ .max(replaceBotDelegationHeaderIdempotencyKeyMax)
+ .describe(
+ "Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.",
+ ),
+});
+
+export const replaceBotDelegationBodyModelMax = 500;
+
+export const replaceBotDelegationBodyModelRegExp = new RegExp("\\S");
+export const replaceBotDelegationBodyEffortMax = 40;
+
+export const replaceBotDelegationBodyEffortRegExp = new RegExp("\\S");
+export const replaceBotDelegationBodyInstructionsMax = 4000;
+
+export const replaceBotDelegationBodyAgentIdsItemMax = 200;
+
+export const replaceBotDelegationBodyAgentIdsItemRegExp = new RegExp("\\S");
+export const replaceBotDelegationBodyAgentIdsMax = 20;
+
+export const ReplaceBotDelegationBody = zod.object({
+ mode: zod
+ .enum(["self", "orchestrate"])
+ .describe(
+ "self: the Bot runs on its one agent with its apps. orchestrate: the Bot answers on its own model and hands work to the agents it may use.",
+ ),
+ model: zod
+ .string()
+ .min(1)
+ .max(replaceBotDelegationBodyModelMax)
+ .regex(replaceBotDelegationBodyModelRegExp)
+ .nullable()
+ .describe(
+ "A model the catalogue offers, or null for the default. Trimmed.",
+ ),
+ effort: zod
+ .string()
+ .min(1)
+ .max(replaceBotDelegationBodyEffortMax)
+ .regex(replaceBotDelegationBodyEffortRegExp)
+ .nullable()
+ .describe(
+ "An effort the model takes, or null for its own. Trimmed, and read in lower case.",
+ ),
+ instructions: zod
+ .string()
+ .max(replaceBotDelegationBodyInstructionsMax)
+ .describe(
+ "How it hands work out and answers, up to 4000 characters. May be empty.",
+ ),
+ agentIds: zod
+ .array(
+ zod
+ .string()
+ .min(1)
+ .max(replaceBotDelegationBodyAgentIdsItemMax)
+ .regex(replaceBotDelegationBodyAgentIdsItemRegExp),
+ )
+ .min(1)
+ .max(replaceBotDelegationBodyAgentIdsMax)
+ .describe(
+ "The agents it may use, in order, the first being its default. Exactly one in mode self.",
+ ),
+});
+
+export const ReplaceBotDelegationResponse = zod
+ .object({
+ botId: zod.string().describe("The Bot's id."),
+ mode: zod
+ .enum(["self", "orchestrate"])
+ .describe(
+ "self: the Bot runs on its one agent with its apps. orchestrate: the Bot answers on its own model and hands work to the agents it may use.",
+ ),
+ model: zod
+ .string()
+ .nullable()
+ .describe(
+ "The model the Bot answers on when it orchestrates, or null for the organization's default.",
+ ),
+ effort: zod
+ .string()
+ .nullable()
+ .describe(
+ "How hard it thinks when it orchestrates, or null for the model's own.",
+ ),
+ instructions: zod
+ .string()
+ .describe(
+ "How it hands work out and answers when it orchestrates. May be empty. Empty for a caller who can't change the Bot, since it can name an agent private to its owner.",
+ ),
+ agents: zod
+ .array(
+ zod
+ .object({
+ id: zod.string().describe("The agent's id."),
+ name: zod
+ .string()
+ .describe(
+ "What the agent is called. An agent private to somebody other than the caller is named Private agent.",
+ ),
+ description: zod
+ .string()
+ .describe(
+ "What it is good at. Empty for an agent private to somebody other than the caller.",
+ ),
+ kind: zod
+ .enum(["openbot", "address"])
+ .describe(
+ "openbot: runs inside OpenBot. address: runs at an AG-UI address, somebody's own or a framework OpenBot runs itself.",
+ ),
+ framework: zod
+ .string()
+ .optional()
+ .describe(
+ "What runs it, by the name a person reads. Absent when OpenBot doesn't know.",
+ ),
+ available: zod
+ .boolean()
+ .describe(
+ "Whether the Bot may still hand it work: false once the agent is deleted, or private to somebody other than the Bot's owner.",
+ ),
+ })
+ .describe("One agent a Bot may use, as the caller sees it."),
+ )
+ .min(1),
+ canManage: zod.boolean().describe("Whether the caller may change it."),
+ })
+ .describe(
+ "How a Bot works, and the agents it may use, the first being its default.",
+ );
diff --git a/app/src/lib/api/generated/index.ts b/app/src/lib/api/generated/index.ts
index 53b6931232..aa4496d6fa 100644
--- a/app/src/lib/api/generated/index.ts
+++ b/app/src/lib/api/generated/index.ts
@@ -1,3 +1,4 @@
+export * from "./agents/agents";
export * from "./api-keys/api-keys";
export * from "./app-access-requests/app-access-requests";
export * from "./approval-rules/approval-rules";
diff --git a/app/src/lib/api/generated/index.zod.ts b/app/src/lib/api/generated/index.zod.ts
index 711468dee9..313d3fedbc 100644
--- a/app/src/lib/api/generated/index.zod.ts
+++ b/app/src/lib/api/generated/index.zod.ts
@@ -1,3 +1,4 @@
+export * from "./agents/agents.zod";
export * from "./api-keys/api-keys.zod";
export * from "./app-access-requests/app-access-requests.zod";
export * from "./approval-rules/approval-rules.zod";
diff --git a/app/src/lib/api/generated/model/botAgent.ts b/app/src/lib/api/generated/model/botAgent.ts
new file mode 100644
index 0000000000..a9d5ea6544
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgent.ts
@@ -0,0 +1,52 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { BotAgentKind } from "./botAgentKind";
+import type { BotAgentSkill } from "./botAgentSkill";
+import type { BotAgentVisibility } from "./botAgentVisibility";
+
+/**
+ * An agent as the caller sees it. canManage, mine and builtIn are the server's verdicts for this caller; a client renders them and never recomputes them. No secret is ever part of an agent: hasAuth and hasCallbackToken say whether one is set.
+ */
+export interface BotAgent {
+ /** The agent's id. */
+ id: string;
+ /** What the agent is called. */
+ name: string;
+ /** What it is good at, in its owner's words. A Bot reads it when it decides which agent to hand work to. */
+ description: string;
+ kind: BotAgentKind;
+ visibility: BotAgentVisibility;
+ /**
+ * The AG-UI address it runs at, as it was stored. Null for an agent that runs inside OpenBot.
+ * @nullable
+ */
+ endpoint: string | null;
+ /** What runs it, by the name a person reads ("LangChain", "OpenBot"). Absent when OpenBot doesn't know. */
+ framework?: string;
+ /**
+ * The model it runs on, for an agent whose model is OpenBot's to choose. Null for the organization's default, or for an agent that picks its own.
+ * @nullable
+ */
+ model: string | null;
+ skills: BotAgentSkill[];
+ /** Whether a key is set for its address. Never the key. */
+ hasAuth: boolean;
+ /** Whether it holds a credential for calling OpenBot's tools back. Never the credential. */
+ hasCallbackToken: boolean;
+ /** Whether OpenBot runs it, inside OpenBot or at an address OpenBot started, so it needs no callback token of its own. */
+ builtIn: boolean;
+ /** Whether the caller may change and delete it. */
+ canManage: boolean;
+ /** Whether the caller added it. */
+ mine: boolean;
+ /**
+ * How many of the Bots the caller can see may use it, deleted Bots aside. A count only: which Bots is not said. With scope=organization, every Bot in the organization.
+ * @minimum 0
+ */
+ botCount: number;
+ /** When it was added. */
+ createdAt: string;
+ /** When it last changed. */
+ updatedAt: string;
+}
diff --git a/app/src/lib/api/generated/model/botAgentCallbackToken.ts b/app/src/lib/api/generated/model/botAgentCallbackToken.ts
new file mode 100644
index 0000000000..452a9229d1
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentCallbackToken.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+export interface BotAgentCallbackToken {
+ /**
+ * The agent's credential for calling OpenBot's tools back. Returned this once and never again.
+ * @minLength 1
+ */
+ token: string;
+}
diff --git a/app/src/lib/api/generated/model/botAgentDescription.ts b/app/src/lib/api/generated/model/botAgentDescription.ts
new file mode 100644
index 0000000000..f04c3d3612
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentDescription.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * What it is good at, 1 to 1000 characters once trimmed. A Bot reads it when it decides which agent to hand work to, so say what to send it.
+ * @minLength 1
+ * @maxLength 1000
+ * @pattern \S
+ */
+export type BotAgentDescription = string;
diff --git a/app/src/lib/api/generated/model/botAgentEndpoint.ts b/app/src/lib/api/generated/model/botAgentEndpoint.ts
new file mode 100644
index 0000000000..4a85ca1a5a
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentEndpoint.ts
@@ -0,0 +1,10 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * The AG-UI address it runs at: an absolute http or https address. An address that fits can still be refused: the server refuses one this organization may not reach, and one that does not answer a real AG-UI run.
+ * @maxLength 2048
+ * @pattern ^[Hh][Tt][Tt][Pp][Ss]?://
+ */
+export type BotAgentEndpoint = string;
diff --git a/app/src/lib/api/generated/model/botAgentForbiddenResponse.ts b/app/src/lib/api/generated/model/botAgentForbiddenResponse.ts
new file mode 100644
index 0000000000..18af737e25
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentForbiddenResponse.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { Problem } from "./problem";
+
+/**
+ * The caller may not manage this agent, or only an admin may make an agent public.
+ */
+export type BotAgentForbiddenResponse = Problem;
diff --git a/app/src/lib/api/generated/model/botAgentHarness.ts b/app/src/lib/api/generated/model/botAgentHarness.ts
new file mode 100644
index 0000000000..b20260f2fe
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentHarness.ts
@@ -0,0 +1,26 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * The framework an agent at an address is built on, by its id in OpenBot's harness list (shared/harnesses.json). Empty means none was named. Kept only for kind address.
+ */
+export type BotAgentHarness =
+ (typeof BotAgentHarness)[keyof typeof BotAgentHarness];
+
+export const BotAgentHarness = {
+ "": "",
+ crewai: "crewai",
+ llamaindex: "llamaindex",
+ agno: "agno",
+ langgraph: "langgraph",
+ "google-adk": "google-adk",
+ antigravity: "antigravity",
+ "pydantic-ai": "pydantic-ai",
+ "microsoft-agent-framework": "microsoft-agent-framework",
+ "claude-agent-sdk": "claude-agent-sdk",
+ strands: "strands",
+ ag2: "ag2",
+ langroid: "langroid",
+ mastra: "mastra",
+} as const;
diff --git a/app/src/lib/api/generated/model/botAgentInUseResponse.ts b/app/src/lib/api/generated/model/botAgentInUseResponse.ts
new file mode 100644
index 0000000000..1f19d3ac08
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentInUseResponse.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { Problem } from "./problem";
+
+/**
+ * The agent is the only agent of a Bot, or a repeated request with the same Idempotency-Key had a different body.
+ */
+export type BotAgentInUseResponse = Problem;
diff --git a/app/src/lib/api/generated/model/botAgentKey.ts b/app/src/lib/api/generated/model/botAgentKey.ts
new file mode 100644
index 0000000000..0c5a1deb9e
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentKey.ts
@@ -0,0 +1,20 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * A key the agent's address sits behind. Write-only: stored encrypted and never returned. A blank value sets no key.
+ */
+export interface BotAgentKey {
+ /**
+ * The header it is sent in. Blank or absent means Authorization.
+ * @maxLength 200
+ * @pattern ^[A-Za-z0-9-]*$
+ */
+ header?: string;
+ /**
+ * The header's value.
+ * @maxLength 8000
+ */
+ value: string;
+}
diff --git a/app/src/lib/api/generated/model/botAgentKind.ts b/app/src/lib/api/generated/model/botAgentKind.ts
new file mode 100644
index 0000000000..ef78d6409b
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentKind.ts
@@ -0,0 +1,13 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * openbot: runs inside OpenBot. address: runs at an AG-UI address, somebody's own or a framework OpenBot runs itself.
+ */
+export type BotAgentKind = (typeof BotAgentKind)[keyof typeof BotAgentKind];
+
+export const BotAgentKind = {
+ openbot: "openbot",
+ address: "address",
+} as const;
diff --git a/app/src/lib/api/generated/model/botAgentModel.ts b/app/src/lib/api/generated/model/botAgentModel.ts
new file mode 100644
index 0000000000..35b21a7d87
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentModel.ts
@@ -0,0 +1,12 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * A model the catalogue offers, or null for the organization's default. Read only for an agent whose model is OpenBot's to choose.
+ * @minLength 1
+ * @maxLength 500
+ * @nullable
+ * @pattern \S
+ */
+export type BotAgentModel = string | null;
diff --git a/app/src/lib/api/generated/model/botAgentName.ts b/app/src/lib/api/generated/model/botAgentName.ts
new file mode 100644
index 0000000000..e74f6404ee
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentName.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * What the agent is called, 1 to 80 characters once trimmed.
+ * @minLength 1
+ * @maxLength 80
+ * @pattern \S
+ */
+export type BotAgentName = string;
diff --git a/app/src/lib/api/generated/model/botAgentNotFoundResponse.ts b/app/src/lib/api/generated/model/botAgentNotFoundResponse.ts
new file mode 100644
index 0000000000..bb4c3c3bae
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentNotFoundResponse.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { Problem } from "./problem";
+
+/**
+ * The agent does not exist, was deleted, or is not visible to the caller, or the organization is not.
+ */
+export type BotAgentNotFoundResponse = Problem;
diff --git a/app/src/lib/api/generated/model/botAgentPage.ts b/app/src/lib/api/generated/model/botAgentPage.ts
new file mode 100644
index 0000000000..e391a919d9
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentPage.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { BotAgent } from "./botAgent";
+
+export interface BotAgentPage {
+ agents: BotAgent[];
+ /**
+ * Pass as cursor for the next page. Null ends the list. Written in URL-safe base64, the only form the cursor parameter accepts.
+ * @maxLength 4096
+ * @nullable
+ * @pattern ^[A-Za-z0-9_-]+$
+ */
+ nextCursor: string | null;
+}
diff --git a/app/src/lib/api/generated/model/botAgentResponse.ts b/app/src/lib/api/generated/model/botAgentResponse.ts
new file mode 100644
index 0000000000..a883735f62
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentResponse.ts
@@ -0,0 +1,8 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { BotAgent } from "./botAgent";
+
+export interface BotAgentResponse {
+ agent: BotAgent;
+}
diff --git a/app/src/lib/api/generated/model/botAgentSkill.ts b/app/src/lib/api/generated/model/botAgentSkill.ts
new file mode 100644
index 0000000000..a22e6cc9d4
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentSkill.ts
@@ -0,0 +1,31 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * One thing the agent is good at, in the shape of an A2A Agent Card's skill. A Bot reads its agents' skills when it decides which to hand work to.
+ */
+export interface BotAgentSkill {
+ /**
+ * The skill's name, 1 to 80 characters once trimmed.
+ * @minLength 1
+ * @maxLength 80
+ * @pattern \S
+ */
+ name: string;
+ /**
+ * What it does, 1 to 500 characters once trimmed.
+ * @minLength 1
+ * @maxLength 500
+ * @pattern \S
+ */
+ description: string;
+ /**
+ * Up to five things a person might ask for that it handles.
+ * @maxItems 5
+ * @items.minLength 1
+ * @items.maxLength 200
+ * @items.pattern \S
+ */
+ examples?: string[];
+}
diff --git a/app/src/lib/api/generated/model/botAgentSkills.ts b/app/src/lib/api/generated/model/botAgentSkills.ts
new file mode 100644
index 0000000000..be9c9ba2fc
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentSkills.ts
@@ -0,0 +1,10 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { BotAgentSkill } from "./botAgentSkill";
+
+/**
+ * Up to twenty things it is good at. Absent on a change leaves them as they are.
+ * @maxItems 20
+ */
+export type BotAgentSkills = BotAgentSkill[];
diff --git a/app/src/lib/api/generated/model/botAgentVisibility.ts b/app/src/lib/api/generated/model/botAgentVisibility.ts
new file mode 100644
index 0000000000..07d9f72579
--- /dev/null
+++ b/app/src/lib/api/generated/model/botAgentVisibility.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * public: every member's Bots may use it, and only an admin may make one. private: only its owner's Bots may use it.
+ */
+export type BotAgentVisibility =
+ (typeof BotAgentVisibility)[keyof typeof BotAgentVisibility];
+
+export const BotAgentVisibility = {
+ public: "public",
+ private: "private",
+} as const;
diff --git a/app/src/lib/api/generated/model/botDelegation.ts b/app/src/lib/api/generated/model/botDelegation.ts
new file mode 100644
index 0000000000..c47ebda80c
--- /dev/null
+++ b/app/src/lib/api/generated/model/botDelegation.ts
@@ -0,0 +1,30 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { BotDelegationAgent } from "./botDelegationAgent";
+import type { BotDelegationMode } from "./botDelegationMode";
+
+/**
+ * How a Bot works, and the agents it may use, the first being its default.
+ */
+export interface BotDelegation {
+ /** The Bot's id. */
+ botId: string;
+ mode: BotDelegationMode;
+ /**
+ * The model the Bot answers on when it orchestrates, or null for the organization's default.
+ * @nullable
+ */
+ model: string | null;
+ /**
+ * How hard it thinks when it orchestrates, or null for the model's own.
+ * @nullable
+ */
+ effort: string | null;
+ /** How it hands work out and answers when it orchestrates. May be empty. Empty for a caller who can't change the Bot, since it can name an agent private to its owner. */
+ instructions: string;
+ /** @minItems 1 */
+ agents: BotDelegationAgent[];
+ /** Whether the caller may change it. */
+ canManage: boolean;
+}
diff --git a/app/src/lib/api/generated/model/botDelegationAgent.ts b/app/src/lib/api/generated/model/botDelegationAgent.ts
new file mode 100644
index 0000000000..654c3402d2
--- /dev/null
+++ b/app/src/lib/api/generated/model/botDelegationAgent.ts
@@ -0,0 +1,21 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { BotAgentKind } from "./botAgentKind";
+
+/**
+ * One agent a Bot may use, as the caller sees it.
+ */
+export interface BotDelegationAgent {
+ /** The agent's id. */
+ id: string;
+ /** What the agent is called. An agent private to somebody other than the caller is named Private agent. */
+ name: string;
+ /** What it is good at. Empty for an agent private to somebody other than the caller. */
+ description: string;
+ kind: BotAgentKind;
+ /** What runs it, by the name a person reads. Absent when OpenBot doesn't know. */
+ framework?: string;
+ /** Whether the Bot may still hand it work: false once the agent is deleted, or private to somebody other than the Bot's owner. */
+ available: boolean;
+}
diff --git a/app/src/lib/api/generated/model/botDelegationMode.ts b/app/src/lib/api/generated/model/botDelegationMode.ts
new file mode 100644
index 0000000000..afa2aeee89
--- /dev/null
+++ b/app/src/lib/api/generated/model/botDelegationMode.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * self: the Bot runs on its one agent with its apps. orchestrate: the Bot answers on its own model and hands work to the agents it may use.
+ */
+export type BotDelegationMode =
+ (typeof BotDelegationMode)[keyof typeof BotDelegationMode];
+
+export const BotDelegationMode = {
+ self: "self",
+ orchestrate: "orchestrate",
+} as const;
diff --git a/app/src/lib/api/generated/model/createBotAgentHeaders.ts b/app/src/lib/api/generated/model/createBotAgentHeaders.ts
new file mode 100644
index 0000000000..6b6fa8e4ca
--- /dev/null
+++ b/app/src/lib/api/generated/model/createBotAgentHeaders.ts
@@ -0,0 +1,13 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { IdempotencyKeyParameter } from "./idempotencyKeyParameter";
+
+export type CreateBotAgentHeaders = {
+ /**
+ * Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.
+ * @minLength 1
+ * @maxLength 128
+ */
+ "Idempotency-Key": IdempotencyKeyParameter;
+};
diff --git a/app/src/lib/api/generated/model/createBotAgentRequest.ts b/app/src/lib/api/generated/model/createBotAgentRequest.ts
new file mode 100644
index 0000000000..b971f98249
--- /dev/null
+++ b/app/src/lib/api/generated/model/createBotAgentRequest.ts
@@ -0,0 +1,27 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { BotAgentDescription } from "./botAgentDescription";
+import type { BotAgentEndpoint } from "./botAgentEndpoint";
+import type { BotAgentHarness } from "./botAgentHarness";
+import type { BotAgentKey } from "./botAgentKey";
+import type { BotAgentKind } from "./botAgentKind";
+import type { BotAgentModel } from "./botAgentModel";
+import type { BotAgentName } from "./botAgentName";
+import type { BotAgentSkills } from "./botAgentSkills";
+import type { BotAgentVisibility } from "./botAgentVisibility";
+
+/**
+ * A new agent. endpoint is required for kind address and refused for kind openbot.
+ */
+export interface CreateBotAgentRequest {
+ name: BotAgentName;
+ description: BotAgentDescription;
+ visibility: BotAgentVisibility;
+ kind: BotAgentKind;
+ endpoint?: BotAgentEndpoint;
+ auth?: BotAgentKey;
+ harness?: BotAgentHarness;
+ model?: BotAgentModel | null;
+ skills?: BotAgentSkills;
+}
diff --git a/app/src/lib/api/generated/model/deleteBotAgentHeaders.ts b/app/src/lib/api/generated/model/deleteBotAgentHeaders.ts
new file mode 100644
index 0000000000..af10d87c54
--- /dev/null
+++ b/app/src/lib/api/generated/model/deleteBotAgentHeaders.ts
@@ -0,0 +1,13 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { IdempotencyKeyParameter } from "./idempotencyKeyParameter";
+
+export type DeleteBotAgentHeaders = {
+ /**
+ * Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.
+ * @minLength 1
+ * @maxLength 128
+ */
+ "Idempotency-Key": IdempotencyKeyParameter;
+};
diff --git a/app/src/lib/api/generated/model/index.ts b/app/src/lib/api/generated/model/index.ts
index a247735d93..a54a9db852 100644
--- a/app/src/lib/api/generated/model/index.ts
+++ b/app/src/lib/api/generated/model/index.ts
@@ -195,6 +195,23 @@ export * from "./bot";
export * from "./botActivity";
export * from "./botActivityItem";
export * from "./botActivityItemKind";
+export * from "./botAgent";
+export * from "./botAgentCallbackToken";
+export * from "./botAgentDescription";
+export * from "./botAgentEndpoint";
+export * from "./botAgentForbiddenResponse";
+export * from "./botAgentHarness";
+export * from "./botAgentInUseResponse";
+export * from "./botAgentKey";
+export * from "./botAgentKind";
+export * from "./botAgentModel";
+export * from "./botAgentName";
+export * from "./botAgentNotFoundResponse";
+export * from "./botAgentPage";
+export * from "./botAgentResponse";
+export * from "./botAgentSkill";
+export * from "./botAgentSkills";
+export * from "./botAgentVisibility";
export * from "./botApp";
export * from "./botAppAccount";
export * from "./botAppAccountHolder";
@@ -225,6 +242,9 @@ export * from "./botConnectionTest";
export * from "./botConnectionTestRequest";
export * from "./botConnectionTestRequestHeaders";
export * from "./botDeclineReport";
+export * from "./botDelegation";
+export * from "./botDelegationAgent";
+export * from "./botDelegationMode";
export * from "./botEndpoint";
export * from "./botFields";
export * from "./botForbiddenResponse";
@@ -558,6 +578,8 @@ export * from "./createAppHeaders";
export * from "./createAppRequest";
export * from "./createApprovalRuleHeaders";
export * from "./createAutomaticLearningSpaceHeaders";
+export * from "./createBotAgentHeaders";
+export * from "./createBotAgentRequest";
export * from "./createBotHeaders";
export * from "./createBotRequest";
export * from "./createBotRequestHarness";
@@ -626,6 +648,7 @@ export * from "./deleteAppAccessRequestHeaders";
export * from "./deleteAppHeaders";
export * from "./deleteApprovalRuleHeaders";
export * from "./deleteAttachmentHeaders";
+export * from "./deleteBotAgentHeaders";
export * from "./deleteBotGrantHeaders";
export * from "./deleteBotHeaders";
export * from "./deleteCheckInHeaders";
@@ -776,6 +799,8 @@ export * from "./invalidAppChangeResponse";
export * from "./invalidAppResponse";
export * from "./invalidApprovalRuleDraftsResponse";
export * from "./invalidAuditQuestionResponse";
+export * from "./invalidBotAgentResponse";
+export * from "./invalidBotDelegationResponse";
export * from "./invalidBotGrantChangesResponse";
export * from "./invalidBotResponse";
export * from "./invalidCapabilityChangesResponse";
@@ -808,6 +833,7 @@ export * from "./invitationPage";
export * from "./invitationResponse";
export * from "./invitationSender";
export * from "./invitationStatus";
+export * from "./issueBotAgentCallbackTokenHeaders";
export * from "./issueBotCallbackTokenHeaders";
export * from "./lastCheckIn";
export * from "./lastCheckInOutcome";
@@ -891,6 +917,8 @@ export * from "./listApprovalRulesParams";
export * from "./listApprovalsParams";
export * from "./listAppsParams";
export * from "./listAuditEventsParams";
+export * from "./listBotAgentsParams";
+export * from "./listBotAgentsScope";
export * from "./listBotAppsParams";
export * from "./listBotAttentionParams";
export * from "./listBotComponentsParams";
@@ -954,6 +982,7 @@ export * from "./listSignInRequestsParams";
export * from "./listSkillSharingRequestsParams";
export * from "./listSkillsParams";
export * from "./listTasksParams";
+export * from "./listTaskTurnsParams";
export * from "./listTeamBotsParams";
export * from "./listTeamMembersParams";
export * from "./listTeamsParams";
@@ -1169,6 +1198,8 @@ export * from "./reopenTaskHeaders";
export * from "./replaceAppHeaders";
export * from "./replaceAppRequest";
export * from "./replaceAppTeamGrantsHeaders";
+export * from "./replaceBotDelegationHeaders";
+export * from "./replaceBotDelegationRequest";
export * from "./replaceBotGrantHeaders";
export * from "./replaceBoundariesHeaders";
export * from "./replaceComponentDraftHeaders";
@@ -1214,6 +1245,7 @@ export * from "./reviewerGuidanceReplaySample";
export * from "./reviewerGuidanceReplaySizeParameter";
export * from "./reviewerGuidanceReplayUnavailableResponse";
export * from "./reviewerGuidanceSaved";
+export * from "./revokeBotAgentCallbackTokenHeaders";
export * from "./revokeBotCallbackTokenHeaders";
export * from "./revokeComponentFunctionHeaders";
export * from "./revokeCredentialHeaders";
@@ -1348,6 +1380,7 @@ export * from "./stopComputerHeaders";
export * from "./stopHostAccessHeaders";
export * from "./stopInactiveComputersHeaders";
export * from "./stopPersonComputersHeaders";
+export * from "./stopTaskHeaders";
export * from "./submitSignInCodeHeaders";
export * from "./submitSignInCodeRequest";
export * from "./submitSignInHeaders";
@@ -1359,6 +1392,7 @@ export * from "./takeBackBotAppHeaders";
export * from "./takeComputerControlHeaders";
export * from "./takeOverSignInHeaders";
export * from "./task";
+export * from "./taskAgent";
export * from "./taskConflictResponse";
export * from "./taskNotFoundResponse";
export * from "./taskOrigin";
@@ -1366,6 +1400,8 @@ export * from "./taskPage";
export * from "./taskResponse";
export * from "./taskStatus";
export * from "./taskSteer";
+export * from "./taskTurn";
+export * from "./taskTurnPage";
export * from "./team";
export * from "./teamBot";
export * from "./teamBotAudience";
@@ -1416,6 +1452,8 @@ export * from "./updateApprovalPreferencesRequest";
export * from "./updateApprovalRuleHeaders";
export * from "./updateApprovalSettingsHeaders";
export * from "./updateApprovalSettingsRequest";
+export * from "./updateBotAgentHeaders";
+export * from "./updateBotAgentRequest";
export * from "./updateBotHeaders";
export * from "./updateBotNotificationSettingsHeaders";
export * from "./updateBotNotificationSettingsRequest";
diff --git a/app/src/lib/api/generated/model/invalidBotAgentResponse.ts b/app/src/lib/api/generated/model/invalidBotAgentResponse.ts
new file mode 100644
index 0000000000..2bc0cdd4ba
--- /dev/null
+++ b/app/src/lib/api/generated/model/invalidBotAgentResponse.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { Problem } from "./problem";
+
+/**
+ * A field is missing or out of bounds, kind and endpoint don't agree, the address is one this organization may not reach or did not answer a real AG-UI run, the model is not one the catalogue offers, or the agent runs inside OpenBot and so takes no callback token.
+ */
+export type InvalidBotAgentResponse = Problem;
diff --git a/app/src/lib/api/generated/model/invalidBotDelegationResponse.ts b/app/src/lib/api/generated/model/invalidBotDelegationResponse.ts
new file mode 100644
index 0000000000..ef2eaa2492
--- /dev/null
+++ b/app/src/lib/api/generated/model/invalidBotDelegationResponse.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { Problem } from "./problem";
+
+/**
+ * A field is missing or out of bounds, mode self names other than one agent, an agent named is not one the caller can see, or the model or effort is not one the catalogue offers.
+ */
+export type InvalidBotDelegationResponse = Problem;
diff --git a/app/src/lib/api/generated/model/issueBotAgentCallbackTokenHeaders.ts b/app/src/lib/api/generated/model/issueBotAgentCallbackTokenHeaders.ts
new file mode 100644
index 0000000000..fae1c4fa45
--- /dev/null
+++ b/app/src/lib/api/generated/model/issueBotAgentCallbackTokenHeaders.ts
@@ -0,0 +1,13 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { IdempotencyKeyParameter } from "./idempotencyKeyParameter";
+
+export type IssueBotAgentCallbackTokenHeaders = {
+ /**
+ * Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.
+ * @minLength 1
+ * @maxLength 128
+ */
+ "Idempotency-Key": IdempotencyKeyParameter;
+};
diff --git a/app/src/lib/api/generated/model/listBotAgentsParams.ts b/app/src/lib/api/generated/model/listBotAgentsParams.ts
new file mode 100644
index 0000000000..096f1b140a
--- /dev/null
+++ b/app/src/lib/api/generated/model/listBotAgentsParams.ts
@@ -0,0 +1,26 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { CursorParameter } from "./cursorParameter";
+import type { LimitParameter } from "./limitParameter";
+import type { ListBotAgentsScope } from "./listBotAgentsScope";
+
+export type ListBotAgentsParams = {
+ /**
+ * Whose agents: caller, the agents the caller can see; organization, every agent in the organization, for an admin of it only.
+ */
+ scope?: ListBotAgentsScope;
+ /**
+ * Most items in one page.
+ * @minimum 1
+ * @maximum 100
+ */
+ limit?: LimitParameter;
+ /**
+ * Opaque continuation from the previous page's nextCursor, bound to the organization and the filters that made it. The server only ever issues cursors written in URL-safe base64 (letters, digits, - and _, no padding) and refuses anything else, so the pattern says so. A cursor that fits the pattern can still be refused: one this list never gave out, or one made for another organization or other filters.
+ * @minLength 1
+ * @maxLength 4096
+ * @pattern ^[A-Za-z0-9_-]+$
+ */
+ cursor?: CursorParameter;
+};
diff --git a/app/src/lib/api/generated/model/listBotAgentsScope.ts b/app/src/lib/api/generated/model/listBotAgentsScope.ts
new file mode 100644
index 0000000000..869485ee29
--- /dev/null
+++ b/app/src/lib/api/generated/model/listBotAgentsScope.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+export type ListBotAgentsScope =
+ (typeof ListBotAgentsScope)[keyof typeof ListBotAgentsScope];
+
+export const ListBotAgentsScope = {
+ caller: "caller",
+ organization: "organization",
+} as const;
diff --git a/app/src/lib/api/generated/model/listTaskTurnsParams.ts b/app/src/lib/api/generated/model/listTaskTurnsParams.ts
new file mode 100644
index 0000000000..e7957aeb41
--- /dev/null
+++ b/app/src/lib/api/generated/model/listTaskTurnsParams.ts
@@ -0,0 +1,21 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { CursorParameter } from "./cursorParameter";
+import type { LimitParameter } from "./limitParameter";
+
+export type ListTaskTurnsParams = {
+ /**
+ * Most items in one page.
+ * @minimum 1
+ * @maximum 100
+ */
+ limit?: LimitParameter;
+ /**
+ * Opaque continuation from the previous page's nextCursor, bound to the organization and the filters that made it. The server only ever issues cursors written in URL-safe base64 (letters, digits, - and _, no padding) and refuses anything else, so the pattern says so. A cursor that fits the pattern can still be refused: one this list never gave out, or one made for another organization or other filters.
+ * @minLength 1
+ * @maxLength 4096
+ * @pattern ^[A-Za-z0-9_-]+$
+ */
+ cursor?: CursorParameter;
+};
diff --git a/app/src/lib/api/generated/model/replaceBotDelegationHeaders.ts b/app/src/lib/api/generated/model/replaceBotDelegationHeaders.ts
new file mode 100644
index 0000000000..c777ce3449
--- /dev/null
+++ b/app/src/lib/api/generated/model/replaceBotDelegationHeaders.ts
@@ -0,0 +1,13 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { IdempotencyKeyParameter } from "./idempotencyKeyParameter";
+
+export type ReplaceBotDelegationHeaders = {
+ /**
+ * Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.
+ * @minLength 1
+ * @maxLength 128
+ */
+ "Idempotency-Key": IdempotencyKeyParameter;
+};
diff --git a/app/src/lib/api/generated/model/replaceBotDelegationRequest.ts b/app/src/lib/api/generated/model/replaceBotDelegationRequest.ts
new file mode 100644
index 0000000000..51838ac528
--- /dev/null
+++ b/app/src/lib/api/generated/model/replaceBotDelegationRequest.ts
@@ -0,0 +1,38 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { BotDelegationMode } from "./botDelegationMode";
+
+export interface ReplaceBotDelegationRequest {
+ mode: BotDelegationMode;
+ /**
+ * A model the catalogue offers, or null for the default. Trimmed.
+ * @minLength 1
+ * @maxLength 500
+ * @nullable
+ * @pattern \S
+ */
+ model: string | null;
+ /**
+ * An effort the model takes, or null for its own. Trimmed, and read in lower case.
+ * @minLength 1
+ * @maxLength 40
+ * @nullable
+ * @pattern \S
+ */
+ effort: string | null;
+ /**
+ * How it hands work out and answers, up to 4000 characters. May be empty.
+ * @maxLength 4000
+ */
+ instructions: string;
+ /**
+ * The agents it may use, in order, the first being its default. Exactly one in mode self.
+ * @minItems 1
+ * @maxItems 20
+ * @items.minLength 1
+ * @items.maxLength 200
+ * @items.pattern \S
+ */
+ agentIds: string[];
+}
diff --git a/app/src/lib/api/generated/model/revokeBotAgentCallbackTokenHeaders.ts b/app/src/lib/api/generated/model/revokeBotAgentCallbackTokenHeaders.ts
new file mode 100644
index 0000000000..eb343b9542
--- /dev/null
+++ b/app/src/lib/api/generated/model/revokeBotAgentCallbackTokenHeaders.ts
@@ -0,0 +1,13 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { IdempotencyKeyParameter } from "./idempotencyKeyParameter";
+
+export type RevokeBotAgentCallbackTokenHeaders = {
+ /**
+ * Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.
+ * @minLength 1
+ * @maxLength 128
+ */
+ "Idempotency-Key": IdempotencyKeyParameter;
+};
diff --git a/app/src/lib/api/generated/model/stopTaskHeaders.ts b/app/src/lib/api/generated/model/stopTaskHeaders.ts
new file mode 100644
index 0000000000..29f20a626d
--- /dev/null
+++ b/app/src/lib/api/generated/model/stopTaskHeaders.ts
@@ -0,0 +1,13 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { IdempotencyKeyParameter } from "./idempotencyKeyParameter";
+
+export type StopTaskHeaders = {
+ /**
+ * Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.
+ * @minLength 1
+ * @maxLength 128
+ */
+ "Idempotency-Key": IdempotencyKeyParameter;
+};
diff --git a/app/src/lib/api/generated/model/task.ts b/app/src/lib/api/generated/model/task.ts
index a4e8d92663..5de9fa4009 100644
--- a/app/src/lib/api/generated/model/task.ts
+++ b/app/src/lib/api/generated/model/task.ts
@@ -1,6 +1,7 @@
/**
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
+import type { TaskAgent } from "./taskAgent";
import type { TaskOrigin } from "./taskOrigin";
import type { TaskStatus } from "./taskStatus";
import type { TaskSteer } from "./taskSteer";
@@ -13,6 +14,11 @@ export interface Task {
id: string;
/** The Bot doing it. */
botId: string;
+ /**
+ * The agent doing the work, when the Bot handed it to one of the agents it may use. Null for a task the Bot does itself, which is every task before agents were a list. Absent from a server that does not name it.
+ * @nullable
+ */
+ agent?: TaskAgent;
/** The task's own conversation, where the person reads it and replies. */
conversationId: string;
/**
diff --git a/app/src/lib/api/generated/model/taskAgent.ts b/app/src/lib/api/generated/model/taskAgent.ts
new file mode 100644
index 0000000000..3784f2f8fb
--- /dev/null
+++ b/app/src/lib/api/generated/model/taskAgent.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * The agent doing the work, when the Bot handed it to one of the agents it may use. Null for a task the Bot does itself, which is every task before agents were a list. Absent from a server that does not name it.
+ * @nullable
+ */
+export type TaskAgent = {
+ /** The agent's id. */
+ id: string;
+ /** What the agent is called. An agent private to somebody other than the caller is named Private agent. */
+ name: string;
+} | null;
diff --git a/app/src/lib/api/generated/model/taskTurn.ts b/app/src/lib/api/generated/model/taskTurn.ts
new file mode 100644
index 0000000000..9221a6276b
--- /dev/null
+++ b/app/src/lib/api/generated/model/taskTurn.ts
@@ -0,0 +1,30 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * One finished turn of a task's work, answering one thing it was asked in its conversation.
+ */
+export interface TaskTurn {
+ /** The id of the message the turn answered, as the conversation's history names it. */
+ askId: string;
+ /** When its first run began. */
+ startedAt: string;
+ /** When its last run ended. */
+ endedAt: string;
+ /**
+ * How long its runs took, added up. A wait on the person between two runs (an approval, a question) is not counted.
+ * @minimum 0
+ */
+ workedSeconds: number;
+ /**
+ * How many runs it took. More than one when it stopped for the person and carried on after.
+ * @minimum 1
+ */
+ runs: number;
+ /**
+ * The model its last run used. Null when the Bot chooses its own model and did not name it.
+ * @nullable
+ */
+ model: string | null;
+}
diff --git a/app/src/lib/api/generated/model/taskTurnPage.ts b/app/src/lib/api/generated/model/taskTurnPage.ts
new file mode 100644
index 0000000000..3d1a08721f
--- /dev/null
+++ b/app/src/lib/api/generated/model/taskTurnPage.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { TaskTurn } from "./taskTurn";
+
+export interface TaskTurnPage {
+ turns: TaskTurn[];
+ /**
+ * Pass as cursor for the next page. Null ends the list. Written in URL-safe base64, the only form the cursor parameter accepts.
+ * @maxLength 4096
+ * @nullable
+ * @pattern ^[A-Za-z0-9_-]+$
+ */
+ nextCursor: string | null;
+}
diff --git a/app/src/lib/api/generated/model/updateBotAgentHeaders.ts b/app/src/lib/api/generated/model/updateBotAgentHeaders.ts
new file mode 100644
index 0000000000..d22a1bd78d
--- /dev/null
+++ b/app/src/lib/api/generated/model/updateBotAgentHeaders.ts
@@ -0,0 +1,13 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { IdempotencyKeyParameter } from "./idempotencyKeyParameter";
+
+export type UpdateBotAgentHeaders = {
+ /**
+ * Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.
+ * @minLength 1
+ * @maxLength 128
+ */
+ "Idempotency-Key": IdempotencyKeyParameter;
+};
diff --git a/app/src/lib/api/generated/model/updateBotAgentRequest.ts b/app/src/lib/api/generated/model/updateBotAgentRequest.ts
new file mode 100644
index 0000000000..0d0ed168f3
--- /dev/null
+++ b/app/src/lib/api/generated/model/updateBotAgentRequest.ts
@@ -0,0 +1,23 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { BotAgentDescription } from "./botAgentDescription";
+import type { BotAgentEndpoint } from "./botAgentEndpoint";
+import type { BotAgentKey } from "./botAgentKey";
+import type { BotAgentModel } from "./botAgentModel";
+import type { BotAgentName } from "./botAgentName";
+import type { BotAgentSkills } from "./botAgentSkills";
+import type { BotAgentVisibility } from "./botAgentVisibility";
+
+/**
+ * An agent's fields after the change. Absent optional fields stay as they are.
+ */
+export interface UpdateBotAgentRequest {
+ name: BotAgentName;
+ description: BotAgentDescription;
+ visibility: BotAgentVisibility;
+ endpoint?: BotAgentEndpoint;
+ auth?: BotAgentKey;
+ model?: BotAgentModel | null;
+ skills?: BotAgentSkills;
+}
diff --git a/app/src/lib/api/generated/tasks/tasks.msw.ts b/app/src/lib/api/generated/tasks/tasks.msw.ts
index 4604677095..b37a2c136f 100644
--- a/app/src/lib/api/generated/tasks/tasks.msw.ts
+++ b/app/src/lib/api/generated/tasks/tasks.msw.ts
@@ -4,7 +4,7 @@
import { HttpResponse, http } from "msw";
import type { HttpResponseResolver, RequestHandlerOptions } from "msw";
-import type { TaskPage, TaskResponse } from "../model";
+import type { TaskPage, TaskResponse, TaskTurnPage } from "../model";
export const getListTasksResponseMock = (): TaskPage => ({
tasks: [
@@ -61,6 +61,20 @@ export const getGetTaskResponseMock = (): TaskResponse => ({
},
});
+export const getListTaskTurnsResponseMock = (): TaskTurnPage => ({
+ turns: [
+ {
+ askId: "3a1c9e2b-5d40-4f7a-8b61-0e9d2c4f7a13",
+ startedAt: "2026-11-14T09:00:02.000Z",
+ endedAt: "2026-11-14T09:00:54.000Z",
+ workedSeconds: 52,
+ runs: 1,
+ model: "gpt-5.1",
+ },
+ ],
+ nextCursor: null,
+});
+
export const getResolveTaskResponseMock = (): TaskResponse => ({
task: {
id: "7c2d6b1f-6f10-4a53-9d51-5f0d6c0e2f1a",
@@ -139,6 +153,32 @@ export const getRetryTaskResponseMock = (): TaskResponse => ({
},
});
+export const getStopTaskResponseMock = (): TaskResponse => ({
+ task: {
+ id: "7c2d6b1f-6f10-4a53-9d51-5f0d6c0e2f1a",
+ botId: "general-assistant",
+ conversationId: "5f0d6c0e-2f1a-4a53-9d51-6f3d6b1f6f10",
+ threadId: "6f3d6b1f-6f10-8a53-9d51-5f0d6c0e2f1a",
+ title: "Reply to Sam about the spec",
+ why: "Sam asked for the spec by Friday.",
+ origin: "check_in",
+ suggestionId: "0b1c6f0e-7f0e-4c1e-9d55-2f4a8c1b6e21",
+ sourceApp: "Gmail",
+ sourceLink: null,
+ originConversationId: null,
+ status: "ready_for_review",
+ failure: null,
+ failedAt: null,
+ stoppedAt: null,
+ next: "Read the draft and send it.",
+ workingSince: null,
+ lastActivityAt: "2026-11-14T09:05:00.000Z",
+ resolvedAt: null,
+ createdAt: "2026-11-14T09:00:00.000Z",
+ updatedAt: "2026-11-14T09:05:00.000Z",
+ },
+});
+
export const getListTasksMockHandler = (
overrideResponse?:
| TaskPage
@@ -195,6 +235,36 @@ export const getGetTaskMockHandler = (
);
};
+export const getListTaskTurnsMockHandler = (
+ overrideResponse?:
+ | TaskTurnPage
+ | ((
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string; taskId: string }>
+ >[0],
+ ) => Promise | TaskTurnPage),
+ options?: RequestHandlerOptions,
+) => {
+ return http.get<{ organizationId: string; taskId: string }>(
+ "*/api/v2/organizations/:organizationId/tasks/:taskId/turns",
+ async (
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string; taskId: string }>
+ >[0],
+ ) => {
+ return HttpResponse.json(
+ overrideResponse !== undefined
+ ? typeof overrideResponse === "function"
+ ? await overrideResponse(info)
+ : overrideResponse
+ : getListTaskTurnsResponseMock(),
+ { status: 200 },
+ );
+ },
+ options,
+ );
+};
+
export const getResolveTaskMockHandler = (
overrideResponse?:
| TaskResponse
@@ -284,10 +354,42 @@ export const getRetryTaskMockHandler = (
options,
);
};
+
+export const getStopTaskMockHandler = (
+ overrideResponse?:
+ | TaskResponse
+ | ((
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string; taskId: string }>
+ >[0],
+ ) => Promise | TaskResponse),
+ options?: RequestHandlerOptions,
+) => {
+ return http.post<{ organizationId: string; taskId: string }>(
+ "*/api/v2/organizations/:organizationId/tasks/:taskId/stop",
+ async (
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string; taskId: string }>
+ >[0],
+ ) => {
+ return HttpResponse.json(
+ overrideResponse !== undefined
+ ? typeof overrideResponse === "function"
+ ? await overrideResponse(info)
+ : overrideResponse
+ : getStopTaskResponseMock(),
+ { status: 200 },
+ );
+ },
+ options,
+ );
+};
export const getTasksMock = () => [
getListTasksMockHandler(),
getGetTaskMockHandler(),
+ getListTaskTurnsMockHandler(),
getResolveTaskMockHandler(),
getReopenTaskMockHandler(),
getRetryTaskMockHandler(),
+ getStopTaskMockHandler(),
];
diff --git a/app/src/lib/api/generated/tasks/tasks.ts b/app/src/lib/api/generated/tasks/tasks.ts
index 3ba017a5af..4960a267ba 100644
--- a/app/src/lib/api/generated/tasks/tasks.ts
+++ b/app/src/lib/api/generated/tasks/tasks.ts
@@ -20,6 +20,7 @@ import type {
import type {
ForbiddenResponse,
InvalidRequestResponse,
+ ListTaskTurnsParams,
ListTasksParams,
OrganizationNotFoundResponse,
ReopenTaskHeaders,
@@ -27,10 +28,12 @@ import type {
RetryTaskHeaders,
ServerErrorResponse,
ServiceUnavailableResponse,
+ StopTaskHeaders,
TaskConflictResponse,
TaskNotFoundResponse,
TaskPage,
TaskResponse,
+ TaskTurnPage,
UnauthenticatedResponse,
UnexpectedErrorResponse,
} from "../model";
@@ -482,6 +485,250 @@ export function useGetTask<
return withQueryKey(query, queryOptions.queryKey);
}
+export const getListTaskTurnsUrl = (
+ organizationId: string,
+ taskId: string,
+ params?: ListTaskTurnsParams,
+) => {
+ const normalizedParams = new URLSearchParams();
+
+ Object.entries(params || {}).forEach(([key, value]) => {
+ if (value !== undefined) {
+ normalizedParams.append(key, value === null ? "null" : String(value));
+ }
+ });
+
+ const stringifiedParams = normalizedParams.toString();
+
+ return stringifiedParams.length > 0
+ ? `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/tasks/${encodeURIComponent(String(taskId))}/turns?${stringifiedParams}`
+ : `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/tasks/${encodeURIComponent(String(taskId))}/turns`;
+};
+
+/**
+ * Return one page of the turns a task has finished, oldest first: each time its Bot worked on something it was asked in the task's conversation, the Bot's brief or a line the person said there. Each says how long the Bot worked on it, counting only the time its runs took, never the time it waited on the person, and which model answered. A turn still running is not listed until it ends. Another person's task is not found. A missing cursor starts at the first page and nextCursor null ends the list.
+ * @summary List a task's turns
+ */
+export const listTaskTurns = async (
+ organizationId: string,
+ taskId: string,
+ params?: ListTaskTurnsParams,
+ options?: Parameters[1],
+): Promise => {
+ return apiRequest(
+ getListTaskTurnsUrl(organizationId, taskId, params),
+ {
+ ...options,
+ method: "GET",
+ },
+ );
+};
+
+export const getListTaskTurnsQueryKey = (
+ organizationId: string,
+ taskId: string,
+ params?: ListTaskTurnsParams,
+) => {
+ return [
+ `/api/v2/organizations/${organizationId}/tasks/${taskId}/turns`,
+ ...(params ? [params] : []),
+ ] as const;
+};
+
+export const getListTaskTurnsQueryOptions = <
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | TaskNotFoundResponse
+ | ServerErrorResponse
+ | ServiceUnavailableResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ taskId: string,
+ params?: ListTaskTurnsParams,
+ options?: {
+ query?: Partial<
+ UseQueryOptions>, TError, TData>
+ >;
+ request?: SecondParameter;
+ },
+) => {
+ const { query: queryOptions, request: requestOptions } = options ?? {};
+
+ const queryKey =
+ queryOptions?.queryKey ??
+ getListTaskTurnsQueryKey(organizationId, taskId, params);
+
+ const queryFn: QueryFunction>> = ({
+ signal,
+ }) =>
+ listTaskTurns(organizationId, taskId, params, {
+ signal,
+ ...requestOptions,
+ });
+
+ return {
+ queryKey,
+ queryFn,
+ enabled:
+ organizationId !== null &&
+ organizationId !== undefined &&
+ taskId !== null &&
+ taskId !== undefined,
+ ...queryOptions,
+ } as UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ > & { queryKey: DataTag };
+};
+
+export type ListTaskTurnsQueryResult = NonNullable<
+ Awaited>
+>;
+export type ListTaskTurnsQueryError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | TaskNotFoundResponse
+ | ServerErrorResponse
+ | ServiceUnavailableResponse
+ | UnexpectedErrorResponse;
+
+export function useListTaskTurns<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | TaskNotFoundResponse
+ | ServerErrorResponse
+ | ServiceUnavailableResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ taskId: string,
+ params: undefined | ListTaskTurnsParams,
+ options: {
+ query: Partial<
+ UseQueryOptions>, TError, TData>
+ > &
+ Pick<
+ DefinedInitialDataOptions<
+ Awaited>,
+ TError,
+ Awaited>
+ >,
+ "initialData"
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): DefinedUseQueryResult & {
+ queryKey: DataTag;
+};
+export function useListTaskTurns<
+ TData = Awaited