{
  "info": {
    "name": "AI manager desktop",
    "description": "Hand this to the desktop app.\n\nOrder: sign in on PHP, exchange that login for an ai_manager token, then call the AI manager endpoint. The site login JWT is not accepted by the AI manager endpoint.\n\nSet `node_base` to `http://127.0.0.1:3001` for local development, or `https://dev.admedia.com/nodejs_search` for the development server. Do not add a trailing slash.\n\nThe ai_manager token lasts 15 minutes (`expires_in` 900). Keep the 7-day login refresh token. When the login access token is expired, PHP answers the exchange with a new `access_token` and does not reach the token route. Save that access token and call exchange again.\n\nChats are in MySQL and belong to the user id inside the ai_manager token. List, get, and delete only return that user's chats.\n\n`POST /api/agent/agents/new/messages` creates an agent. `POST` with any unused id of letters, numbers, `_`, or `-` (max 64 characters) creates that agent. `GET` of an unknown id returns 404 `That agent no longer exists.` `DELETE` of an unknown id returns the remaining agents.\n\nSend message is an SSE stream. Read it until `done`. Body is `{ text, clientMessageId, timezone, latitude, longitude, model, mode }`. `model` is an id from `GET /api/agent/models` (default, gpt_6_astra, gpt_56, openai_41, openai; Gemini returns 400 for now). `mode` is `research` for deep research (long cited report plus PDF) or `chat`. `client` is `web` for the website (no desktop tools; browser steps in the cloud) or `desktop` (default). Each reply has a token budget (250k input tokens, 800k in research) after which the agent answers with what it has. `clientMessageId` is optional, up to 64 characters. Sending the same id again returns the saved reply and does not start another run. `timezone` is optional: the device IANA timezone such as `Asia/Kolkata`. Send it on every message so times in answers and scheduled tasks are right; an invalid value is ignored. `latitude` and `longitude` are optional: the device location for \"near me\" questions (schools, restaurants nearby). Without them the agent asks the user for their area.\n\nEvents:\n- `started` `{ runId, agentId, conversationId }` (`agentId` and `conversationId` are the same agent id)\n- `status` `{ type, message }` progress text and the agent's short notes on what it is doing next\n- `message` `{ type, text }` the next piece of the answer. Append it to the reply bubble and render the HTML collected so far while it streams\n- `reset` `{ type }` the streamed text was a step before a tool call, not the answer. Clear it; the next `message` starts again\n- `tool` `{ type, phase, name, detail, label }` for tools that already ran. Show `label` (readable text such as \"Writing server.js\" or \"Running npm install\"); fall back to `name` and `detail` when it is empty\n- `tool_request` `{ callId, name, args }` when the desktop must run the tool. The stream stays open until `POST /runs/{runId}/tool-result`.\n- `tool_request_done` `{ callId }` that desktop call finished (used when replaying)\n- `connect_required` `{ type, apps }` show a Connect button per app\n- `sources` `{ type, index, total, content: { id, title, url, domain, snippet, favicon }, provider }` one Zenserp source card per event while the agent searches the web\n- `shopping_result` `{ type, query, offers: [{ merchant, price, price_label, currency, title, image, rating, reviews, product_url, domain }], sources }` real offers from online stores (Google Shopping, never Amazon) for product cards\n- `browser_screenshot` `{ type, image }` JPEG data URL of the cloud browser after each step (live view)\n- `browser_closed` `{ type, message }`\n- `html_code_preview` `{ type, html }` the built web page as one responsive HTML document; show a Preview button\n- `artifacts` `{ type, artifacts: [{ name, url }] }` files to download, signed links valid 1 hour\n- `failed` `{ type, message }` the reply failed\n- `stopped` `{ type }` the user stopped the reply\n- `follow_ups` `{ type, questions }` up to 3 suggested next questions\n- `topKeywords` / `brands` `{ type, items }` and `promptKeywords` / `bestMatchedCategory` `{ type, value }` ad data, not sent for code or file tasks\n- `usage` `{ type, worked_seconds, credits_used, text, image, video, audio, tool, tokens }` credits for the reply (1 per 100 tokens, 10 per image, 0.25 per web search)\n- `done` `{ type }` only, always last, no other data. Refresh the list with List agents for the title. Saved messages come from `GET /agents/{id}`.\n\n`message` is the only event with answer text, for every kind of prompt (chat, connected apps, files, browser, code).\n\nThe thread is stored once, on the agent. A run is the reply attempt behind that `runId`. Full tool results stay on the run and are not returned in the thread.\n\nDesktop tool names (the app runs these): search_files, read_file, read_file_lines, search_file_content, search_documents, regex_search_files, list_directory, directory_tree, file_info, diff_files, write_file, edit_file, replace_file_content, append_to_file, apply_patch, create_directory, move_file, copy_file, trash_file, extract_archive, create_archive, run_command, browser_open, browser_get_text, browser_click, browser_fill, browser_screenshot, browser_click_at, browser_press_key, browser_scroll, browser_back, browser_links, browser_wait_for, browser_tab_manager, browser_select_option, browser_upload_file.\n\nServer tool names (no `tool_request`, only `tool` events): calculate, current_time, show_code, open_connectors, research_notes, schedule_task, page_check (website checks in a cloud browser), view_image (reads an image URL), create_file (makes a PDF, Excel or CSV report to attach to mail, Slack or a ticket), and connected app tools loaded by open_connectors such as `jira__get_issue`. App tools now also write: `slack__post_message`, `gmail__send_message`, Jira and Confluence create and comment, calendar events, `bitbucket__post`. The agent sends directly when the user asks to send, post, mail or create, and only drafts when the user asks for a draft or a review first. Web search runs inside the model and sends `tool` events named `web_search` (label \"Searching the web\"). `create_image` makes images and `edit_image` edits uploaded or earlier images (\"add a butterfly\"); `compare_prices` sends real shopping offers as `shopping_result` (price alerts are a scheduled price watch); `transform_image` removes backgrounds, upscales, makes variations and sketch/photo conversions; `analyze_data` runs Python (pandas, charts) on uploaded CSV/Excel; `edit_document` edits an uploaded Word/Excel/PowerPoint in place keeping formatting; `create_file` pptx takes a `theme` (forest, midnight, ocean, ember, slate, sunshine) and slide charts; the image comes in the answer as <img> and in `artifacts`. `find_places` finds real places on Google Maps and adds a ```map block (JSON query and places, same as search.com Computer) to the answer.\n\n- `write_file` accepts any text or code file at a relative path inside the allowed folder and creates missing folders. Replacing an existing file asks the user first.\n- `run_command` `{ command, cwd }` runs one shell command inside the allowed folder. Show the exact command and folder and ask Allow or Deny. If denied, post `ok: false` with `The user declined to run this command.` Otherwise post `{ exitCode, stdout, stderr }`, keeping the last 8000 characters of each. The server waits up to 15 minutes for it; every other desktop tool waits up to 120 seconds.\n\nOne reply at a time per agent. A second send on that same agent returns 409. A different agent can run at the same time. Tool result and stop must use the same user's Bearer token. Another user's run id returns 404.\n\nBackground replies:\n- A reply keeps running on the server when the stream closes (the user switches chat, closes the app, or the network drops). Only `POST /runs/{runId}/stop` stops it.\n- When the user opens a chat, call `GET /api/agent/agents/{id}`. If `activeRun` is not null, that chat is still replying: call `GET /api/agent/runs/{activeRun.runId}/events?from=0` and show that stream like a normal send. It replays every event so far, then continues live until `done`.\n- If `activeRun` is null, the reply is finished and the answer is already in `messages`.\n- To resume after a network drop without showing events twice, pass `from` = the number of events already received.\n- File tools need the chat open. If one is needed while the user is elsewhere, it fails and the agent continues with its other sources. Browser tools move to a cloud browser on the server instead (a `status` event says \"The app is closed, continuing in a cloud browser\"), so website tests keep going.\n- A reattached app runs `tool_request` like on a normal send and posts `tool-result`. Every finished desktop call is followed by `tool_request_done` with the same `callId`; when replaying, skip any `tool_request` that already has a `tool_request_done`, so a reconnect never repeats a click, a file write or a command.\n- The event replay is kept for 1 hour after the last event. The answer itself is always saved in `messages`.\n\nFiles:\n- Upload what the user attaches with `POST /api/agent/files` (raw bytes, `X-File-Name` header, up to 25 MB) and send the returned ids as `fileIds` with the message. Any PDF (including scanned pages and images inside), Word, PowerPoint, Excel, CSV, text and PNG/JPEG/GIF/WebP image can be read.\n- New desktop tool `read_file_bytes` `{ path }`: when the user names a file in their folder, the agent asks the app for its bytes. Read the file inside the allowed folder and post `{ name, mimeType, base64 }` as the tool result (up to 25 MB; tool results up to 40 MB are accepted). Refuse paths outside the allowed folder.\n- Files the agent creates are linked in the answer as `/api/agent/files/{fileId}`. Download them with the Bearer token.\n\nScheduled tasks and notifications:\n- When the user asks to be reminded, to get something on a repeat, or to be told when a mail or ticket gets a reply, the agent calls `schedule_task` and answers with what was scheduled. The `tool` event label is \"Scheduling <name>\".\n- Tasks run on this server, separate from search.com Computer. Each result is posted in the chat where the task was made (an assistant message starting with \"⏰ task name\").\n- `GET /api/agent/tasks` lists them; `POST /api/agent/tasks/{taskId}/pause`, `/resume`, `/cancel` change them.\n- `GET /api/agent/notifications?after={ISO time}` returns new results (`status` notify, done or failed; quiet watch checks are left out). Poll it to show notifications.\n\nFeedback: `POST /api/agent/agents/{id}/messages/{messageId}/feedback` with `{ value: \"up\" | \"down\" | null, comment }`. Messages return `feedback`.\n\nAnswer format (assistant message):\n- `content`: HTML with everything to show (same format as search.com Computer). Tags: h2, h3, p, ul, ol, li, strong, em, a, span, br, sup, sub, table, pre, code, blockquote, hr. Fenced blocks inside the HTML carry code (```python …), charts (```chart with JSON type/title/labels/datasets), diagrams (```mermaid), drawings (```svg) and maps (```map from find_places). Created images are <img> tags. Formulas use real symbols with sup/sub, no LaTeX.\n- `html_code_preview`: the whole web page as one responsive HTML document (CSS and JS inlined) when the agent built a page; empty string otherwise. When it has a value, show a Preview button that loads it in a sandboxed webview.\n- `artifacts`: files to download, `[{ name, url }]`, possibly several. `url` is a signed S3 link valid for 1 hour (no Bearer token); reopening the chat returns fresh links. Images made by create_image or edit_image have a public link that never expires.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "php_base",
      "value": "https://dev.admedia.com/php81/johnty/api.search.com/public/?/"
    },
    {
      "key": "node_base",
      "value": "http://127.0.0.1:3001"
    },
    {
      "key": "email",
      "value": ""
    },
    {
      "key": "password",
      "value": ""
    },
    {
      "key": "login_access_token",
      "value": ""
    },
    {
      "key": "login_refresh_token",
      "value": ""
    },
    {
      "key": "ai_manager_token",
      "value": ""
    },
    {
      "key": "conversation_id",
      "value": "new"
    },
    {
      "key": "run_id",
      "value": ""
    },
    {
      "key": "specialist_run_id",
      "value": ""
    },
    {
      "key": "call_id",
      "value": ""
    },
    {
      "key": "tool_name",
      "value": ""
    },
    {
      "key": "event_from",
      "value": "0"
    },
    {
      "key": "file_id",
      "value": ""
    },
    {
      "key": "message_id",
      "value": ""
    }
  ],
  "item": [
    {
      "name": "1. Sign in",
      "request": {
        "method": "POST",
        "header": [],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "email",
              "value": "{{email}}",
              "type": "text"
            },
            {
              "key": "password",
              "value": "{{password}}",
              "type": "text"
            }
          ]
        },
        "url": "{{php_base}}signin",
        "description": "Form body, not JSON. Saves `data.access_token` and `data.refresh_token`. The access token lasts about 1 hour. The refresh token lasts 7 days."
      },
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "const body = pm.response.json();",
              "pm.test('signed in', () => pm.expect(body.success).to.eql(true));",
              "pm.collectionVariables.set('login_access_token', body.data.access_token);",
              "pm.collectionVariables.set('login_refresh_token', body.data.refresh_token);"
            ]
          }
        }
      ]
    },
    {
      "name": "2. Exchange for ai_manager token",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "{{login_access_token}}",
              "type": "string"
            }
          ]
        },
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "X-Refresh-Token",
            "value": "{{login_refresh_token}}"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"app\": \"agent\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": "{{php_base}}ai-manager/token",
        "description": "Send the login access token as Bearer. `app` must be `agent`. Saves `data.token` as `ai_manager_token`.\n\nIf the login access token is already expired and `X-Refresh-Token` is valid, the body is `{ success: true, message: \"Access token refreshed.\", access_token }` and there is no `data.token`. This script saves that new login token. Run this request again."
      },
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "const body = pm.response.json();",
              "if (body.access_token) {",
              "  pm.collectionVariables.set('login_access_token', body.access_token);",
              "  pm.test('login token renewed; run exchange again', () => pm.expect(body.success).to.eql(true));",
              "} else {",
              "  pm.test('ai_manager token issued', () => {",
              "    pm.expect(body.success).to.eql(true);",
              "    pm.expect(body.data.token_type).to.eql('Bearer');",
              "    pm.expect(body.data.app).to.eql('agent');",
              "    pm.expect(body.data.expires_in).to.be.a('number');",
              "  });",
              "  pm.collectionVariables.set('ai_manager_token', body.data.token);",
              "}"
            ]
          }
        }
      ]
    },
    {
      "name": "3. Session",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "{{ai_manager_token}}",
              "type": "string"
            }
          ]
        },
        "method": "GET",
        "header": [],
        "url": "{{node_base}}/api/auth/session",
        "description": "Checks the ai_manager token. Response includes `sub` (the user id stored on chats), `app` = agent, and `expires_at`."
      },
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "const body = pm.response.json();",
              "pm.test('session is agent', () => {",
              "  pm.expect(pm.response.code).to.eql(200);",
              "  pm.expect(body.ok).to.eql(true);",
              "  pm.expect(body.app).to.eql('agent');",
              "  pm.expect(body.sub).to.be.a('string').and.not.empty;",
              "});"
            ]
          }
        }
      ]
    },
    {
      "name": "4. Missing token",
      "request": {
        "auth": {
          "type": "noauth"
        },
        "method": "GET",
        "header": [],
        "url": "{{node_base}}/api/agent/agents",
        "description": "Expect 401 `MISSING_TOKEN`."
      },
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test('missing token', () => {",
              "  pm.expect(pm.response.code).to.eql(401);",
              "  pm.expect(pm.response.json().error.code).to.eql('MISSING_TOKEN');",
              "});"
            ]
          }
        }
      ]
    },
    {
      "name": "5. Bad token",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "not-a-token",
              "type": "string"
            }
          ]
        },
        "method": "GET",
        "header": [],
        "url": "{{node_base}}/api/auth/session",
        "description": "Expect 401. A site login JWT also fails here because it is signed with a different key."
      },
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test('bad token', () => pm.expect(pm.response.code).to.eql(401));"
            ]
          }
        }
      ]
    },
    {
      "name": "6. Exchange without login",
      "request": {
        "auth": {
          "type": "noauth"
        },
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"app\": \"agent\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": "{{php_base}}ai-manager/token",
        "description": "Expect 401 from PHP. There is no public route that signs an ai_manager token."
      },
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test('exchange requires login', () => pm.expect(pm.response.code).to.eql(401));"
            ]
          }
        }
      ]
    },
    {
      "name": "Desktop agent",
      "item": [
        {
          "name": "Health",
          "request": {
            "auth": {
              "type": "noauth"
            },
            "method": "GET",
            "header": [],
            "url": "{{node_base}}/api/agent/health",
            "description": "Public. `{ ok: true }`. No Bearer token."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('health', () => {",
                  "  pm.expect(pm.response.code).to.eql(200);",
                  "  pm.expect(pm.response.json().ok).to.eql(true);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Get app update",
          "request": {
            "auth": {
              "type": "noauth"
            },
            "method": "GET",
            "header": [],
            "url": "{{node_base}}/api/agent/app-update",
            "description": "Public. No Bearer token. Returns the newest row: `{ id, app_update }`. `id` is ignored if sent. 404 when no row exists."
          }
        },
        {
          "name": "Save app update",
          "request": {
            "auth": {
              "type": "noauth"
            },
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"version\": \"1.2.0\",\n  \"force\": false\n}"
            },
            "url": "{{node_base}}/api/agent/app-update",
            "description": "Public. No Bearer token and no x-code. Inserts a new row. `id` is assigned by MySQL. Returns `{ id, app_update }`."
          }
        },
        {
          "name": "Info",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{node_base}}/api/agent/info",
            "description": "Requires the ai_manager token. Returns `{ model }`."
          }
        },
        {
          "name": "Create agent",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"agent_name\": \"abcd\",\n  \"agent_shape\": \"circle\",\n  \"agent_color\": \"red\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": "{{node_base}}/api/agent/agents/create",
            "description": "Creates one agent for this token's user. `agent_name`, `agent_shape`, and `agent_color` are required strings. `title` starts as `New agent` and is replaced by the first user message.\n\nReturns `201` with `{ agent, agents, hasMore }`. `agent` is the new row. `agents` is the first page of the sidebar list, newest first. Each item is `{ id, title, updatedAt, agent_name, agent_shape, agent_color }`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const body = pm.response.json();",
                  "pm.test('created', () => {",
                  "  pm.expect(pm.response.code).to.eql(201);",
                  "  pm.expect(body.agent.agent_name).to.eql('abcd');",
                  "  pm.expect(body.agent.agent_shape).to.eql('circle');",
                  "  pm.expect(body.agent.agent_color).to.eql('red');",
                  "  pm.expect(body.agent.id).to.be.a('string');",
                  "});",
                  "if (body.agent && body.agent.id) {",
                  "  pm.collectionVariables.set('conversation_id', body.agent.id);",
                  "}"
                ]
              }
            }
          ]
        },
        {
          "name": "Edit agent",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"agent_name\": \"abcd\",\n  \"agent_shape\": \"circle\",\n  \"agent_color\": \"red\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": "{{node_base}}/api/agent/agents/{{conversation_id}}/edit",
            "description": "Updates name, shape, and/or color for one agent. Send only the fields to change. `title` is not edited here. Returns `{ agent, agents, hasMore }` with the first page of the list."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const body = pm.response.json();",
                  "pm.test('edited', () => {",
                  "  pm.expect(pm.response.code).to.eql(200);",
                  "  pm.expect(body.agent.id).to.be.a('string');",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "List models",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{node_base}}/api/agent/models",
            "description": "Models the user can pick for the agent. Send the chosen `id` as `model` with a message. Same ids as the search.com Computer picker; Gemini is not available for the agent yet."
          }
        },
        {
          "name": "List agents",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{node_base}}/api/agent/agents?limit=50",
            "description": "Agents for this token's user only, newest first. Response is `{ agents, hasMore }`. `limit` defaults to 50 and cannot be more than 100. To load older agents, set `before` to the id of the oldest agent on the current page. Each item is `{ id, title, updatedAt, agent_name, agent_shape, agent_color }`. Example: `{ \"id\": \"asdasd\", \"title\": \"explain me this\", \"updatedAt\": \"2026-10-21T08:00:00.000Z\", \"agent_name\": \"abcd\", \"agent_shape\": \"circle\", \"agent_color\": \"red\" }`. Messages are not included."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const body = pm.response.json();",
                  "pm.test('list', () => {",
                  "  pm.expect(pm.response.code).to.eql(200);",
                  "  pm.expect(body.agents).to.be.an('array');",
                  "  pm.expect(body.hasMore).to.be.a('boolean');",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Get agent",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{node_base}}/api/agent/agents/{{conversation_id}}",
            "description": "Latest page of this user's thread: `{ id, title, updatedAt, messages, hasMore }`. Default `limit` is 50, maximum 100. Messages are oldest-first inside the page.\n\nTo load older messages, call again with `before` set to the id of the oldest message you already have: `?limit=50&before={messageId}`.\n\nUser messages are `{ id, role, content, createdAt }`. Assistant messages also include `error`, `stopped`, `tools`, and when present `inputTokens`, `outputTokens`, `runId`. Tool rows on the message are summaries. The full tool result stays on the run and is not included here.\n\nUnknown id, or an agent owned by someone else, is 404. This does not create an agent.\n\n`activeRun` is `{ runId }` while a reply in this chat is still running, otherwise `null`. When it is set, open **Reattach to a running reply** with that `runId` to show the reply. The test saves it as `run_id`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const body = pm.response.json();",
                  "pm.test(\"agent returned\", () => pm.expect(body.id).to.be.a(\"string\"));",
                  "pm.test(\"activeRun is present\", () => pm.expect(body).to.have.property(\"activeRun\"));",
                  "if (body.activeRun) {",
                  "  pm.collectionVariables.set(\"run_id\", body.activeRun.runId);",
                  "  console.log(\"Still running: \" + body.activeRun.runId + \". Open Reattach to a running reply.\");",
                  "} else {",
                  "  console.log(\"No reply running. The answer is in messages.\");",
                  "}"
                ]
              }
            }
          ]
        },
        {
          "name": "Download chat",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{node_base}}/api/agent/agents/{{conversation_id}}/export",
            "description": "Downloads this user's whole chat as a Markdown file (`text/markdown`). The filename comes from the chat title. Images are in the file as image links. Other files are links that last 7 days. Unknown id, or another user's chat, is 404."
          }
        },
        {
          "name": "Reply feedback",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": "{{node_base}}/api/agent/agents/{{conversation_id}}/messages/{{message_id}}/feedback",
            "description": "Thumbs up or down on one assistant reply, like search.com Computer. `value` is `up`, `down` or `null` to clear; `comment` is optional. Set `message_id` to the id of an assistant message from Get agent. Returns `{ messageId, feedback }`. Messages in Get agent return `feedback`.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"value\": \"up\",\n  \"comment\": \"\"\n}"
            }
          }
        },
        {
          "name": "Reattach to a running reply",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "function readEvents(text) {",
                  "  const events = [];",
                  "  for (const block of text.split(/\\n\\n/)) {",
                  "    let name = \"message\";",
                  "    let data = \"\";",
                  "    for (const line of block.split(/\\n/)) {",
                  "      if (line.startsWith(\"event:\")) name = line.slice(6).trim();",
                  "      if (line.startsWith(\"data:\")) data += line.slice(5).trim();",
                  "    }",
                  "    if (!data) continue;",
                  "    try { events.push({ name, data: JSON.parse(data) }); } catch (e) {}",
                  "  }",
                  "  return events;",
                  "}",
                  "if (pm.response.code === 404) {",
                  "  pm.test(\"reply no longer available (finished more than 1 hour ago); read messages instead\", () => pm.expect(pm.response.json().error).to.be.a(\"string\"));",
                  "  return;",
                  "}",
                  "const events = readEvents(pm.response.text());",
                  "const from = Number(pm.request.url.query.get(\"from\") || 0);",
                  "pm.collectionVariables.set(\"event_from\", String(from + events.length));",
                  "console.log(\"Events received: \" + events.map((e) => e.name).join(\" > \"));",
                  "pm.test(\"stream returned events or ended\", () => pm.expect(pm.response.code).to.eql(200));",
                  "const done = events.find((e) => e.name === \"done\");",
                  "if (done) pm.test(\"reply finished with done\", () => pm.expect(done.data).to.eql({ type: \"done\" }));"
                ]
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "text/event-stream"
              }
            ],
            "url": "{{node_base}}/api/agent/runs/{{run_id}}/events?from={{event_from}}",
            "description": "Use when the user comes back to a chat whose `GET /agents/{id}` has `activeRun` set.\n\nSSE, same events as Send message (`started`, `status`, `message`, `reset`, `tool`, `tool_request`, `tool_request_done`, `connect_required`, `sources`, `shopping_result`, `browser_screenshot`, `browser_closed`, `html_code_preview`, `artifacts`, `failed`, `stopped`, `follow_ups`, `topKeywords`, `brands`, `promptKeywords`, `bestMatchedCategory`, `usage`, `done`). It first replays the events stored for this run starting at index `from`, then streams new ones live, and closes after `done`.\n\n`from=0` shows the whole reply so far. After a network drop, pass the number of events you already received so nothing is shown twice; the test saves that as `event_from`.\n\nIf the reply already finished, the stream replays to `done` and closes. If it finished more than 1 hour ago, or the run belongs to another user, it is 404 `That reply is no longer available.` Read the answer from `GET /agents/{id}` instead.\n\nClosing this stream does not stop the reply. Use Stop for that.\n\nIf a `tool_request` arrives, run it and post Tool result as usual. Skip replayed `tool_request` events that already have a matching `tool_request_done`."
          }
        },
        {
          "name": "Send message",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "text/event-stream"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"text\": \"What is 2 + 2?\",\n  \"clientMessageId\": \"{{$guid}}\",\n  \"timezone\": \"Asia/Kolkata\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": "{{node_base}}/api/agent/agents/{{conversation_id}}/messages",
            "description": "SSE. `conversation_id` starts as `new`, which creates a chat and the test below stores its id.\n\nSend the same request again after that to continue the chat. To force a specific id, set `conversation_id` to a new UUID before sending. If that id does not exist for this user, the chat is created with it.\n\n`text` is required, trimmed, and at most 8000 characters.\n\n`What is 2 + 2?` uses the server `calculate` tool, so the stream should finish with `done` and no `tool_request`. The test saves `run_id` and `conversation_id` from `started`.\n\nClosing this stream does not stop the reply. It keeps running on the server; reopen it with Get agent (`activeRun`) and Reattach to a running reply."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "function readEvents(text) {",
                  "  const events = [];",
                  "  for (const block of text.split(/\\n\\n/)) {",
                  "    let name = 'message';",
                  "    let data = '';",
                  "    for (const line of block.split(/\\n/)) {",
                  "      if (line.startsWith('event:')) name = line.slice(6).trim();",
                  "      if (line.startsWith('data:')) data += line.slice(5).trim();",
                  "    }",
                  "    if (!data) continue;",
                  "    try { events.push({ name, data: JSON.parse(data) }); } catch (e) {}",
                  "  }",
                  "  return events;",
                  "}",
                  "const events = readEvents(pm.response.text());",
                  "const started = events.find((event) => event.name === 'started');",
                  "const toolRequest = events.find((event) => event.name === 'tool_request');",
                  "pm.test('stream started', () => {",
                  "  pm.expect(pm.response.code).to.eql(200);",
                  "  pm.expect(started, 'started event').to.be.an('object');",
                  "  pm.expect(started.data.runId).to.be.a('string');",
                  "  pm.expect(started.data.conversationId).to.be.a('string');",
                  "});",
                  "if (started) {",
                  "  pm.collectionVariables.set('run_id', started.data.runId);",
                  "  pm.collectionVariables.set('conversation_id', started.data.conversationId);",
                  "}",
                  "if (toolRequest) {",
                  "  pm.collectionVariables.set('call_id', toolRequest.data.callId);",
                  "  pm.collectionVariables.set('tool_name', toolRequest.data.name);",
                  "}"
                ]
              }
            }
          ]
        },
        {
          "name": "Send message that schedules a task",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "text/event-stream"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"text\": \"Remind me every weekday at 9 am with the top AI news\",\n  \"clientMessageId\": \"{{$guid}}\",\n  \"timezone\": \"Asia/Kolkata\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": "{{node_base}}/api/agent/agents/{{conversation_id}}/messages",
            "description": "The agent calls schedule_task (a tool event labelled \"Scheduling ...\") and the answer says what was scheduled and when it runs next. The task is listed by GET /api/agent/tasks and each result is posted in the chat and listed by GET /api/agent/notifications. Watching works the same way, for example \"Tell me when anyone from acme.com replies to my mail\"."
          }
        },
        {
          "name": "Upload a file",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "const body = pm.response.json();",
                  "if (body.fileId) pm.collectionVariables.set('file_id', body.fileId);"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{agent_token}}"
              },
              {
                "key": "X-File-Name",
                "value": "lab-report.pdf"
              },
              {
                "key": "Content-Type",
                "value": "application/pdf"
              }
            ],
            "body": {
              "mode": "file",
              "file": {
                "src": ""
              }
            },
            "url": "{{node_base}}/api/agent/files",
            "description": "Upload any file the user attaches: PDF, Word, PowerPoint, Excel, CSV, text, or an image (PNG, JPEG, GIF, WebP). Up to 25 MB.\n\nBody: the raw file bytes (choose the file in Body > binary).\nHeaders: X-File-Name (required, URL-encoded if it has special characters) and Content-Type (the file's type; optional).\n\n201: { fileId, name, mimeType, size }. Files are kept for 24 hours and only the same user can use them."
          }
        },
        {
          "name": "Send message with attached files",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "text/event-stream"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"text\": \"Summarise this report and list any values outside the normal range\",\n  \"clientMessageId\": \"{{$guid}}\",\n  \"timezone\": \"Asia/Kolkata\",\n  \"fileIds\": [\"{{file_id}}\"]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": "{{node_base}}/api/agent/agents/{{conversation_id}}/messages",
            "description": "Send the fileId values from Upload a file in fileIds (up to 10). The agent reads every attached file before answering. text can be empty when files are attached. An unknown or expired file id returns 400."
          }
        },
        {
          "name": "Download a created file",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{agent_token}}"
              }
            ],
            "url": "{{node_base}}/api/agent/files/{{file_id}}",
            "description": "Answers link files the agent made (PDF, Word, PowerPoint, Excel, CSV) as /api/agent/files/{fileId}. The link needs the Bearer token, so download it with the token (prefix node_base) and save or open it; a plain link in a browser will get 401."
          }
        },
        {
          "name": "Send message that shows code",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "text/event-stream"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"text\": \"Create a simple HTML landing page for a coffee shop\",\n  \"clientMessageId\": \"{{$guid}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": "{{node_base}}/api/agent/agents/new/messages",
            "description": "Asks for a single HTML page. `show_code` runs on the server, so no desktop tool is needed.\n\nThe answer streams in `message` events: the text, then the code in fenced code blocks. After it comes `html_code_preview` with the whole page for the Preview button, then `done`. The tests check all three.\n\nTry a script too, for example \"Write a Python script that adds two numbers\": the `message` text ends with the code, the sample input and the output."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "function readEvents(text) {",
                  "  const events = [];",
                  "  for (const block of text.split(/\\n\\n/)) {",
                  "    let name = 'message';",
                  "    let data = '';",
                  "    for (const line of block.split(/\\n/)) {",
                  "      if (line.startsWith('event:')) name = line.slice(6).trim();",
                  "      if (line.startsWith('data:')) data += line.slice(5).trim();",
                  "    }",
                  "    if (!data) continue;",
                  "    try { events.push({ name, data: JSON.parse(data) }); } catch (e) {}",
                  "  }",
                  "  return events;",
                  "}",
                  "const events = readEvents(pm.response.text());",
                  "const started = events.find((event) => event.name === 'started');",
                  "const toolRequest = events.find((event) => event.name === 'tool_request');",
                  "pm.test('stream started', () => {",
                  "  pm.expect(pm.response.code).to.eql(200);",
                  "  pm.expect(started, 'started event').to.be.an('object');",
                  "  pm.expect(started.data.runId).to.be.a('string');",
                  "  pm.expect(started.data.conversationId).to.be.a('string');",
                  "});",
                  "if (started) {",
                  "  pm.collectionVariables.set('run_id', started.data.runId);",
                  "  pm.collectionVariables.set('conversation_id', started.data.conversationId);",
                  "}",
                  "if (toolRequest) {",
                  "  pm.collectionVariables.set('call_id', toolRequest.data.callId);",
                  "  pm.collectionVariables.set('tool_name', toolRequest.data.name);",
                  "}",
                  "let answer = '';",
                  "events.forEach((event) => { if (event.name === 'reset') answer = ''; if (event.name === 'message') answer += event.data.text; });",
                  "pm.test(\"answer streamed in message events with the code\", () => pm.expect(answer).to.include('```html'));",
                  "pm.test(\"html_code_preview event has the page\", () => pm.expect(events.some((event) => event.name === 'html_code_preview' && event.data.html.includes('<'))).to.be.true);",
                  "pm.test(\"done has no data\", () => pm.expect(events.find((event) => event.name === 'done').data).to.eql({ type: 'done' }));"
                ]
              }
            }
          ]
        },
        {
          "name": "Send message that creates an image",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "text/event-stream"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"text\": \"Create an image of a horse\",\n  \"clientMessageId\": \"{{$guid}}\",\n  \"timezone\": \"Asia/Kolkata\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": "{{node_base}}/api/agent/agents/new/messages",
            "description": "Asks for a picture. The server `create_image` tool makes it (a `tool` event \"Creating the image\"). The answer streams in `message` events and ends with an `<img>` of the picture; `artifacts` has the PNG to download.\n\nTo edit, upload an image with Upload file and send its id in `fileIds` with text like \"Add a butterfly to this image\": `edit_image` runs (label \"Editing the image\"). A follow-up such as \"make it night time\" edits the last image."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "function readEvents(text) {",
                  "  const events = [];",
                  "  for (const block of text.split(/\\n\\n/)) {",
                  "    let name = 'message';",
                  "    let data = '';",
                  "    for (const line of block.split(/\\n/)) {",
                  "      if (line.startsWith('event:')) name = line.slice(6).trim();",
                  "      if (line.startsWith('data:')) data += line.slice(5).trim();",
                  "    }",
                  "    if (!data) continue;",
                  "    try { events.push({ name, data: JSON.parse(data) }); } catch (e) {}",
                  "  }",
                  "  return events;",
                  "}",
                  "const events = readEvents(pm.response.text());",
                  "const started = events.find((event) => event.name === 'started');",
                  "const toolRequest = events.find((event) => event.name === 'tool_request');",
                  "pm.test('stream started', () => {",
                  "  pm.expect(pm.response.code).to.eql(200);",
                  "  pm.expect(started, 'started event').to.be.an('object');",
                  "  pm.expect(started.data.runId).to.be.a('string');",
                  "  pm.expect(started.data.conversationId).to.be.a('string');",
                  "});",
                  "if (started) {",
                  "  pm.collectionVariables.set('run_id', started.data.runId);",
                  "  pm.collectionVariables.set('conversation_id', started.data.conversationId);",
                  "}",
                  "if (toolRequest) {",
                  "  pm.collectionVariables.set('call_id', toolRequest.data.callId);",
                  "  pm.collectionVariables.set('tool_name', toolRequest.data.name);",
                  "}",
                  "let answer = '';",
                  "events.forEach((event) => { if (event.name === 'reset') answer = ''; if (event.name === 'message') answer += event.data.text; });",
                  "pm.test(\"answer shows the image\", () => pm.expect(answer).to.include('<img'));",
                  "pm.test(\"artifacts event has the png\", () => pm.expect(events.some((event) => event.name === 'artifacts' && event.data.artifacts.some((file) => file.name.endsWith('.png')))).to.be.true);"
                ]
              }
            }
          ]
        },
        {
          "name": "Send message that finds places nearby",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "text/event-stream"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"text\": \"Schools near me\",\n  \"clientMessageId\": \"{{$guid}}\",\n  \"timezone\": \"Asia/Kolkata\",\n  \"latitude\": 18.5204,\n  \"longitude\": 73.8567\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": "{{node_base}}/api/agent/agents/new/messages",
            "description": "Sends the device location with the message. The server `find_places` tool searches Google Maps around it (a `tool` event \"Finding schools on the map\"). The answer streams a short list of real schools and ends with a fenced `map` block: JSON `{ query, places }` the app draws as a map, the same as search.com Computer.\n\nWithout `latitude` and `longitude` the agent asks for the user's area."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "function readEvents(text) {",
                  "  const events = [];",
                  "  for (const block of text.split(/\\n\\n/)) {",
                  "    let name = 'message';",
                  "    let data = '';",
                  "    for (const line of block.split(/\\n/)) {",
                  "      if (line.startsWith('event:')) name = line.slice(6).trim();",
                  "      if (line.startsWith('data:')) data += line.slice(5).trim();",
                  "    }",
                  "    if (!data) continue;",
                  "    try { events.push({ name, data: JSON.parse(data) }); } catch (e) {}",
                  "  }",
                  "  return events;",
                  "}",
                  "const events = readEvents(pm.response.text());",
                  "const started = events.find((event) => event.name === 'started');",
                  "const toolRequest = events.find((event) => event.name === 'tool_request');",
                  "pm.test('stream started', () => {",
                  "  pm.expect(pm.response.code).to.eql(200);",
                  "  pm.expect(started, 'started event').to.be.an('object');",
                  "  pm.expect(started.data.runId).to.be.a('string');",
                  "  pm.expect(started.data.conversationId).to.be.a('string');",
                  "});",
                  "if (started) {",
                  "  pm.collectionVariables.set('run_id', started.data.runId);",
                  "  pm.collectionVariables.set('conversation_id', started.data.conversationId);",
                  "}",
                  "if (toolRequest) {",
                  "  pm.collectionVariables.set('call_id', toolRequest.data.callId);",
                  "  pm.collectionVariables.set('tool_name', toolRequest.data.name);",
                  "}",
                  "let answer = '';",
                  "events.forEach((event) => { if (event.name === 'reset') answer = ''; if (event.name === 'message') answer += event.data.text; });",
                  "pm.test(\"answer has a map block\", () => pm.expect(answer).to.include('```map'));"
                ]
              }
            }
          ]
        },
        {
          "name": "Send message that compares prices",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "text/event-stream"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"text\": \"Compare prices for noise cancelling wireless earbuds under $150\",\n  \"clientMessageId\": \"{{$guid}}\",\n  \"timezone\": \"America/New_York\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": "{{node_base}}/api/agent/agents/new/messages",
            "description": "The server `compare_prices` tool finds real offers from shopping sites (a `tool` event \"Checking prices\"). The stream sends `shopping_result` with the offers for product cards, then the answer with a comparison table, then `follow_ups`, the ad events and `usage`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "function readEvents(text) {",
                  "  const events = [];",
                  "  for (const block of text.split(/\\n\\n/)) {",
                  "    let name = 'message';",
                  "    let data = '';",
                  "    for (const line of block.split(/\\n/)) {",
                  "      if (line.startsWith('event:')) name = line.slice(6).trim();",
                  "      if (line.startsWith('data:')) data += line.slice(5).trim();",
                  "    }",
                  "    if (!data) continue;",
                  "    try { events.push({ name, data: JSON.parse(data) }); } catch (e) {}",
                  "  }",
                  "  return events;",
                  "}",
                  "const events = readEvents(pm.response.text());",
                  "const started = events.find((event) => event.name === 'started');",
                  "const toolRequest = events.find((event) => event.name === 'tool_request');",
                  "pm.test('stream started', () => {",
                  "  pm.expect(pm.response.code).to.eql(200);",
                  "  pm.expect(started, 'started event').to.be.an('object');",
                  "  pm.expect(started.data.runId).to.be.a('string');",
                  "  pm.expect(started.data.conversationId).to.be.a('string');",
                  "});",
                  "if (started) {",
                  "  pm.collectionVariables.set('run_id', started.data.runId);",
                  "  pm.collectionVariables.set('conversation_id', started.data.conversationId);",
                  "}",
                  "if (toolRequest) {",
                  "  pm.collectionVariables.set('call_id', toolRequest.data.callId);",
                  "  pm.collectionVariables.set('tool_name', toolRequest.data.name);",
                  "}",
                  "let answer = '';",
                  "events.forEach((event) => { if (event.name === 'reset') answer = ''; if (event.name === 'message') answer += event.data.text; });",
                  "pm.test(\"shopping_result has offers\", () => pm.expect(events.some((event) => event.name === 'shopping_result' && event.data.offers.length > 0)).to.be.true);",
                  "pm.test(\"usage sent before done\", () => pm.expect(events.some((event) => event.name === 'usage')).to.be.true);"
                ]
              }
            }
          ]
        },
        {
          "name": "Send message that needs the desktop",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "text/event-stream"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"text\": \"List the files in my downloads folder\",\n  \"clientMessageId\": \"{{$guid}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": "{{node_base}}/api/agent/agents/{{conversation_id}}/messages",
            "description": "Leaves the SSE open on `tool_request` until the desktop posts a tool result, or 120 seconds pass (15 minutes for `run_command`, which also asks the user to Allow or Deny first).\n\nPostman runs the next request only after this one ends, so send Tool result from a second tab while this stream is still open. Use the `callId`, `name`, and `args` from `tool_request`, and the `runId` from `started`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "function readEvents(text) {",
                  "  const events = [];",
                  "  for (const block of text.split(/\\n\\n/)) {",
                  "    let name = 'message';",
                  "    let data = '';",
                  "    for (const line of block.split(/\\n/)) {",
                  "      if (line.startsWith('event:')) name = line.slice(6).trim();",
                  "      if (line.startsWith('data:')) data += line.slice(5).trim();",
                  "    }",
                  "    if (!data) continue;",
                  "    try { events.push({ name, data: JSON.parse(data) }); } catch (e) {}",
                  "  }",
                  "  return events;",
                  "}",
                  "const events = readEvents(pm.response.text());",
                  "const started = events.find((event) => event.name === 'started');",
                  "const toolRequest = events.find((event) => event.name === 'tool_request');",
                  "if (started) {",
                  "  pm.collectionVariables.set('run_id', started.data.runId);",
                  "  pm.collectionVariables.set('conversation_id', started.data.conversationId);",
                  "}",
                  "if (toolRequest) {",
                  "  pm.collectionVariables.set('call_id', toolRequest.data.callId);",
                  "  pm.collectionVariables.set('tool_name', toolRequest.data.name);",
                  "}"
                ]
              }
            }
          ]
        },
        {
          "name": "Tool result",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"callId\": \"{{call_id}}\",\n  \"ok\": true,\n  \"result\": {\n    \"searchedFolder\": \"/Users/me/Downloads\",\n    \"files\": []\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": "{{node_base}}/api/agent/runs/{{run_id}}/tool-result",
            "description": "Answer the open `tool_request`. Body limit is 8MB.\n\nSuccess: `{ callId, ok: true, result }`.\nFailure: `{ callId, ok: false, error: \"what went wrong\" }`.\n\n`callId` must match the waiting request, `run_id` must match `started.runId`, and the Bearer token must be the same user. Otherwise 404 `That tool request is not waiting.`\n\nReplace `result` with the real tool payload. This sample is only a shape for `search_files`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('tool result accepted or not waiting', () => {",
                  "  pm.expect([200, 404]).to.include(pm.response.code);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Stop",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{node_base}}/api/agent/runs/{{run_id}}/stop",
            "description": "Aborts the reply for this user. `{ stopped: true }`. Unknown run, or another user's run, is 404 `That reply is not running.` This is the only way to stop a reply. Closing a stream does not stop it."
          }
        },
        {
          "name": "Delete agent",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": "{{node_base}}/api/agent/agents/{{conversation_id}}",
            "description": "Deletes this user's agent, its messages, and its runs. Response is `{ agents, hasMore }` for the first page of remaining agents.\n\nDeleting an unknown id still returns that list. Deleting the agent that is currently replying returns 409."
          }
        }
      ],
      "auth": {
        "type": "bearer",
        "bearer": [
          {
            "key": "token",
            "value": "{{ai_manager_token}}",
            "type": "string"
          }
        ]
      },
      "description": "Every request in this folder sends `Authorization: Bearer {{ai_manager_token}}`, except Health, Get app update, and Save app update."
    }
  ]
}