Bases
Use the base written on each call. Do not mix them. {php_base} already ends with ?/, so PHP paths have no extra slash. {node_base} has no trailing slash.
| Name | Value | Use for |
|---|---|---|
{php_base} |
https://dev.admedia.com/php81/johnty/api.search.com/public/?/ |
Sign in and token exchange only |
{node_base} local |
http://127.0.0.1:3001 |
AI manager, local development |
{node_base} development server |
https://dev.admedia.com/nodejs_search |
AI manager, development server |
The same AI manager path works on either {node_base}:
GET http://127.0.0.1:3001/api/agent/agents GET https://dev.admedia.com/nodejs_search/api/agent/agents
In Postman those are {{php_base}} and {{node_base}}. Send Authorization: Bearer on every {node_base} call except health, app update, this page, and the collection download. The site login JWT is not accepted by the AI manager endpoint. It is signed with a different key.
1. Sign in
POST {php_base}signin
POST https://dev.admedia.com/php81/johnty/api.search.com/public/?/signin
Form body, not JSON.
email=user@example.com&password=secret
Save both tokens from data.
{
"success": true,
"data": {
"access_token": "<login access, about 1 hour>",
"refresh_token": "<login refresh, 7 days>"
}
}
2. Exchange for an ai_manager token
POST {php_base}ai-manager/token
POST https://dev.admedia.com/php81/johnty/api.search.com/public/?/ai-manager/token
Authorization: Bearer <login access token>
X-Refresh-Token: <login refresh token>
Content-Type: application/json
{ "app": "agent" }
app must be agent. Save data.token. It lasts 15 minutes (expires_in is 900). token_type is Bearer.
If the login access token is already expired and the refresh token is still valid, PHP answers with a new login access token and does not issue the ai_manager token:
{
"success": true,
"message": "Access token refreshed.",
"access_token": "<new login access token>"
}
Save that access_token and call this same route again. Keep the 7-day refresh token. When the AI manager endpoint later returns EXPIRED, exchange again. Do not call the AI manager endpoint with the login JWT.
3. Check the token
GET {node_base}/api/auth/session
GET http://127.0.0.1:3001/api/auth/session GET https://dev.admedia.com/nodejs_search/api/auth/session
{
"ok": true,
"sub": "4133",
"app": "agent",
"iss": "api.search.com",
"aud": "ai_manager",
"issued_at": 1710000000,
"expires_at": 1710000900,
"subscribed": false
}
sub is the user id. List, get, send, stop, and delete only see that user's agents. GET {node_base}/api/agent/health is public. It checks MySQL, Redis, and the Qdrant chat collection and returns { "ok": true, "checks": { "mysql": "ok", "redis": "ok", "qdrant": "ok" } }. qdrant is ok only when the chat collection answers. If any check is down the status is 503 and that check is down. Public routes allow 120 requests a minute per IP. A signed-in user allows 300 requests a minute, and 25 of those may be new messages. An IP allows 900 signed-in requests a minute, and 40 of those may be new messages. IPs listed in RATE_LIMIT_ALLOW_IPS skip the per-IP cap. The per-user cap still applies. User ids in config/prompt-quota-skip-users.txt (one id per line) skip the daily prompt cap of 100, or 250 when subscribed. Everyone else still stops at that cap for 24 hours. Saving the file applies on the next prompt. Over the cap, a new chat message is a normal event stream and that reply is saved. A free user is told their free credits are used and asked to subscribe. A subscribed user is told today's limit is reached and to try after 24 hours. Other routes return 429 with { "error": "Too many requests. Try again in a minute." }. GET {node_base}/api/agent/metrics is public and returns request counts and reply timing. A finished reply also prints Reply trace in the server log with the run id, user id, agent id, status, and duration. GET {node_base}/api/agent/info needs the token and returns { "model" }.
App update
Public. No Bearer token and no secret code. The table has two columns: an auto-increment id and app_update, the JSON document.
Get the latest
GET {node_base}/api/agent/app-update
GET http://127.0.0.1:3001/api/agent/app-update GET https://dev.admedia.com/nodejs_search/api/agent/app-update
Always returns the newest row, the highest id. A query id is ignored. 404 when no row exists.
{
"id": 2,
"app_update": {
"version": "1.2.0",
"force": false
}
}
Save
POST {node_base}/api/agent/app-update
POST http://127.0.0.1:3001/api/agent/app-update POST https://dev.admedia.com/nodejs_search/api/agent/app-update
JSON body. Each call inserts a new row. MySQL assigns id. The next get returns this row.
Content-Type: application/json
{
"version": "1.2.0",
"force": false
}
Returns { id, app_update }. A body that is not a JSON object is 400.
4. Agents
An agent is one chat. The sidebar lists agents. Messages live on the agent.
Create
POST {node_base}/api/agent/agents/create
POST http://127.0.0.1:3001/api/agent/agents/create POST https://dev.admedia.com/nodejs_search/api/agent/agents/create
Content-Type: application/json
Authorization: Bearer <ai_manager token>
{
"agent_name": "abcd",
"agent_shape": "circle",
"agent_color": "red"
}
All three fields are required strings. agent_name is at most 255 characters. agent_shape and agent_color are at most 64. title starts as New agent and is replaced by the first user message. Returns 201 with the new agent and the first page of the list:
{
"agent": {
"id": "8f3c1c2e-6b4a-4d1e-9c0a-1b2c3d4e5f60",
"title": "New agent",
"updatedAt": "2026-10-21T08:00:00.000Z",
"agent_name": "abcd",
"agent_shape": "circle",
"agent_color": "red"
},
"agents": [ /* newest first, same fields */ ],
"hasMore": false
}
Edit
POST {node_base}/api/agent/agents/{id}/edit
POST http://127.0.0.1:3001/api/agent/agents/{id}/edit
POST https://dev.admedia.com/nodejs_search/api/agent/agents/{id}/edit
{
"agent_name": "abcd",
"agent_shape": "circle",
"agent_color": "red"
}
Send only the fields to change. At least one of agent_name, agent_shape, or agent_color is required. title is not edited here. Returns { agent, agents, hasMore } with the first page of the list. Unknown id is 404.
List
GET {node_base}/api/agent/agents?limit=50&before={agentId}
GET http://127.0.0.1:3001/api/agent/agents?limit=50&before={agentId}
GET https://dev.admedia.com/nodejs_search/api/agent/agents?limit=50&before={agentId}
Returns { agents, hasMore }. Newest first. limit defaults to 50 and cannot be more than 100. Messages are not included. title here is the latest user or assistant message, shortened to 42 characters. The saved title stays the first user message and is not rewritten. An agent with no messages keeps that saved title, starting as New agent. To load older agents, set before to the id of the oldest agent you already have.
{
"agents": [
{
"id": "asdasd",
"title": "explain me this",
"updatedAt": "2026-10-21T08:00:00.000Z",
"agent_name": "abcd",
"agent_shape": "circle",
"agent_color": "red"
}
],
"hasMore": false
}
Open one
GET {node_base}/api/agent/agents/{id}?limit=50&before={messageId}
GET http://127.0.0.1:3001/api/agent/agents/{id}?limit=50&before={messageId}
GET https://dev.admedia.com/nodejs_search/api/agent/agents/{id}?limit=50&before={messageId}
Returns { id, title, updatedAt, agent_name, agent_shape, agent_color, messages, hasMore }. limit defaults to 50 and cannot be more than 100. Messages inside the page are oldest first. To load older messages, set before to the id of the oldest message you already have.
A user message is { id, role, content, createdAt }. An assistant message also has error, stopped, tools, and when present inputTokens, outputTokens, and runId. tools on the message is a short summary. The full tool result is not in this response.
It also returns activeRun: { runId } while a reply in this chat is still running, otherwise null. When it is set, show that reply with Coming back to a running reply.
An unknown id, or another user's id, is 404 with { "error": "That agent no longer exists." }. This call does not create an agent.
Download the chat
GET {node_base}/api/agent/agents/{id}/export
GET http://127.0.0.1:3001/api/agent/agents/{id}/export
GET https://dev.admedia.com/nodejs_search/api/agent/agents/{id}/export
Needs the Bearer token. Returns the whole chat as one Markdown file, text/markdown, named from the chat title. The words are in the file. Images are Markdown images. Other files (PDF, Excel, Word, slides) are links in the file; those links last 7 days, and image links do not expire. An unknown id, or another user's id, is 404.
Delete
DELETE {node_base}/api/agent/agents/{id}
DELETE http://127.0.0.1:3001/api/agent/agents/{id}
DELETE https://dev.admedia.com/nodejs_search/api/agent/agents/{id}
Returns the first page of the remaining list as { agents, hasMore }. Deleting an unknown id still returns that list. Deleting the agent that is currently replying returns 409.
5. Send a message
POST {node_base}/api/agent/agents/{id}/messages
POST http://127.0.0.1:3001/api/agent/agents/{id}/messages
POST https://dev.admedia.com/nodejs_search/api/agent/agents/{id}/messages
Prefer POST {node_base}/api/agent/agents/create when the app already has a name, shape, and color. Use new as the id to create an agent from the first message. Any unused id of letters, numbers, _, or - (1 to 64 characters) creates that agent. GET of a missing id does not create one. If the title is still New agent, the first message becomes the title.
Accept: text/event-stream
Content-Type: application/json
Authorization: Bearer <ai_manager token>
{
"text": "What is 2 + 2?",
"clientMessageId": "8f3c1c2e-6b4a-4d1e-9c0a-1b2c3d4e5f60",
"timezone": "Asia/Kolkata",
"latitude": 18.5204,
"longitude": 73.8567,
"model": "default",
"mode": "chat",
"client": "desktop"
}
text is required, trimmed, and at most 8000 characters. clientMessageId is optional and at most 64 characters. timezone is optional: the device IANA timezone. 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, used for "near me" questions such as schools or restaurants nearby. Without them the agent asks the user for their area. model is optional: a model id from GET {node_base}/api/agent/models (default, gpt_6_astra, gpt_56, openai_41, openai, the same ids as the search.com Computer picker). Gemini ids return 400 for now. mode is optional: research for deep research (many searches, a long cited report and a PDF), otherwise chat. client is optional: web for the website (no desktop app, so local file and system tools are left out and browser steps run in the cloud browser), otherwise desktop. Asking for "deep research" or a "detailed report" in the text also turns it on. Each reply has a token budget (250,000 input tokens, 800,000 in research); when it is reached the agent stops using tools and answers with what it has. Generate a new UUID for each send. If the network drops, retry the same id on the same agent. Sending that id to a different agent returns 409 and does not load the other chat. A saved reply comes back as done and does not start another run. If the user row was saved and the reply was not, the same id continues that turn instead of inserting a second user message.
The response is server-sent events, not a single JSON body. The browser EventSource API cannot set Authorization, so read the stream with fetch. The response sets X-Accel-Buffering: no so a proxy does not hold the stream. Every 15 seconds it writes a comment line : ping. Ignore lines that start with :. Those comments keep the proxy from closing a quiet tool wait.
const url = `${nodeBase}/api/agent/agents/${id}/messages`;
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
Accept: "text/event-stream",
"Content-Type": "application/json",
},
body: JSON.stringify({ text, clientMessageId }),
});
const reader = response.body.getReader();
const decoder = new TextDecoder();
let buffer = "";
while (true) {
const { value, done } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const blocks = buffer.split("\n\n");
buffer = blocks.pop();
for (const block of blocks) {
let event = "message";
let data = "";
for (const line of block.split("\n")) {
if (line.startsWith("event:")) event = line.slice(6).trim();
if (line.startsWith("data:")) data += line.slice(5).trim();
}
if (data) handle(event, JSON.parse(data));
}
}
Events
| Event | Data |
|---|---|
started |
{ runId, agentId, conversationId }. agentId and conversationId are the same agent id. Store runId for tool results and stop. |
status |
{ type, message }. Progress text such as "Thinking", and the agent's own short notes on what it is about to do ("I'll check Jira and Slack for open bugs first."). Show the latest one as the activity line. |
message |
{ type, text }. The next piece of the answer as it is written. Append text and render the HTML of the whole reply collected so far on every event. Prose streams as it is written. An HTML, CSS or script block is held and arrives in one piece when that block is finished. Do not show the stream in a plain-text widget: the answer is HTML, so a plain-text widget shows the tags until the reply finishes. |
reset |
{ type }. Clear the streamed text; the next message starts the answer again. A short step note is cleared when the agent goes on to use a tool. A finished answer stays until a later round replaces it, so opening another app does not blank the reply. |
generating |
{ type, phase, kind, label, path, text }. The model is writing a file instead of the answer. phase is start or done. kind is html, css, python, javascript, typescript or php. label is the activity line, such as "Generating HTML" or "HTML ready". Show label while phase is start and do not append source to the answer bubble. On done, text is the finished file (empty for a code block that is about to arrive in message). Show that file then. path is the file name when there is one. The same words also arrive as a status event, so an older app still updates its activity line. |
tool |
{ type, phase, name, detail, label } for a tool that already ran, including server tools. Show label: readable step text such as "Writing server.js", "Creating folder public" or "Running npm install". Fall back to name and detail when it is empty. Saved messages keep label on each item in tools. |
tool_request |
{ callId, name, args }. The app must run this tool. The stream stays open until the tool result is posted, or 120 seconds pass. |
tool_request_done |
{ callId }. That desktop call is finished. Used when replaying. |
connect_required |
{ type, apps }. An app the answer needs is not connected. Show a Connect button for each app. |
sources |
{ type, index, total, content: { id, title, url, domain, snippet, favicon }, provider }. One source card per event (from Zenserp), sent while the agent searches the web. Same as search.com Computer. |
shopping_result |
{ type, query, offers: [{ merchant, price, price_label, currency, availability, title, brand, image, rating, reviews, product_url, domain }], sources, provider }. Real offers from online stores for product cards. |
browser_screenshot |
{ type, image }. A JPEG data URL of the cloud browser page after each step, to show a live view while the agent browses. Not sent when the desktop browser is used (the user sees it on screen). |
browser_closed |
{ type, message }. The cloud browser was closed. |
html_code_preview |
{ type, html }. Sent after the answer when the agent built a web page: one responsive HTML document. Show a Preview button that loads it in a sandboxed webview. The code itself is already in the message text as fenced code blocks. |
artifacts |
{ type, artifacts: [{ name, url }] }. Files to download (PDF, Excel, Word, PowerPoint, CSV), possibly several. url is a signed link valid for 1 hour, no token needed. |
failed |
{ type, message }. The reply failed. Show message as the error. |
stopped |
{ type }. The reply was stopped by the user. |
follow_ups |
{ type, questions }. Up to 3 suggested next questions. Show them as chips that send the question. |
topKeywords, brands |
{ type, items }. Products or services and brands in the answer, for ads. Not sent for code or file tasks. |
promptKeywords, bestMatchedCategory |
{ type, value }. Ad keyword and category for the prompt (RAGMS), the same as the search chat. Empty string when none. |
usage |
{ type, worked_seconds, credits_used, text, image, video, audio, tool, tokens: { prompt, completion, total, exact, per_credit } }. Credits for this reply: 1 per 100 tokens, 10 per image, 0.25 per web search. Same shape as search.com Computer. |
done |
{ type } only. Always the last event; the stream closes after it. It has no other data. Refresh the chat list with List agents if the title is needed. Reopening a chat later uses GET {node_base}/api/agent/agents/{id}, which returns the saved messages. |
Answers are HTML, the same format as search.com Computer, so the same renderer works for both. Tags used: h2, h3, p, ul, ol, li, strong, em, a, span, br, sup, sub, table, pre, code, blockquote, hr. Inside the HTML, fenced blocks (three backticks and a language) carry code (python, html, svg or mermaid when the user asked for that code) and maps (map, JSON with query and places, from find_places). Charts, graphs and diagrams are drawn on the server by draw_visual and arrive as an <img> tag where they belong in the answer, like created images, so no chart or diagram code streams on screen. While it draws, a tool event says "Drawing the chart" or "Drawing the diagram". Formulas use real symbols with sup/sub, such as E = mc2, Σ, λ, π; no LaTeX.
One reply at a time per agent. A second send on that agent returns 409 Wait for the current reply to finish. A different agent can run at the same time. Closing the stream stops the reply.
Stop
POST {node_base}/api/agent/runs/{runId}/stop
POST http://127.0.0.1:3001/api/agent/runs/{runId}/stop
POST https://dev.admedia.com/nodejs_search/api/agent/runs/{runId}/stop
Returns { "stopped": true }. The reply stops in the middle. The stream sends { "type": "status", "message": "Stopping" } first and flushes it. The server then drops the run lock and cancels the current tool without sending more status. When that cleanup is finished it sends stopped and done, and the stream closes. { "stopped": true } is returned after done. It does not wait for the tool to finish its work. Use the runId from that reply's started event. Each new message has its own run id. Stopping an earlier run from the same chat stops the reply that is running now. An unknown run, or another user's run, is 404 That reply is not running.
Coming back to a running reply
A reply keeps running on the server when its stream closes: the user switches chat, closes the app, or the network drops. Only POST {node_base}/api/agent/runs/{runId}/stop stops it.
When the user opens a chat:
- Call
GET {node_base}/api/agent/agents/{id}. - If
activeRunisnull, the reply is finished. Its answer is already inmessages. - If
activeRunis set, the reply is still running. Open its events and show them like a normal send.
GET {node_base}/api/agent/runs/{runId}/events?from=0
GET http://127.0.0.1:3001/api/agent/runs/{runId}/events?from=0
GET https://dev.admedia.com/nodejs_search/api/agent/runs/{runId}/events?from=0
Server-sent events, the same as Send a message: started, status, message, reset, generating, 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 and done. It first replays the events already stored for this run, starting at index from, then streams new ones live and closes after done. With from=0 the user sees the whole reply so far, then it continues.
After a network drop, reconnect with from set to the number of events already received, so nothing is shown twice.
The stored events are kept for 1 hour after the last event. A run that finished longer ago, or that belongs to another user, is 404 with { "error": "That reply is no longer available." }. Read the answer from messages instead.
Closing this stream does not stop the reply. File and browser tools need the chat open; if one is needed while the user is in another chat, it fails and the agent continues with its other sources.
A reattached app runs tool_request the same way as on a normal send: run it, then post POST {node_base}/api/agent/runs/{runId}/tool-result. Each 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 or a file read.
Files
The agent reads any PDF (all pages, scanned pages and the images inside), Word (.docx), PowerPoint (.pptx), Excel (.xlsx), CSV, text or code file, and PNG, JPEG, GIF or WebP images. It can also make PDF, Word, PowerPoint, Excel and CSV files.
| Step | Call | Notes |
|---|---|---|
| Upload what the user attaches | POST {node_base}/api/agent/files | Body is the raw file. Header X-File-Name (required) and Content-Type. Up to 25 MB. Returns { fileId, name, mimeType, size }. Kept 24 hours, same user only. |
| Send the message | POST {node_base}/api/agent/agents/{id}/messages | Add "fileIds": ["file_..."] (up to 10). text may be empty when files are attached. An unknown or expired id returns 400. |
| Files in the user's folder | Desktop tool read_file_bytes { path } | When the user names a file, the agent asks the app for it. Read it inside the allowed folder and post { name, mimeType, base64 } as the tool result. Refuse paths outside the folder. Tool results up to 40 MB are accepted. |
| Download a file the agent made | GET {node_base}/api/agent/files/{fileId} | Answers link created files as /api/agent/files/{fileId}. Download with the Bearer token, then save or open it. |
Answer format
Each assistant message has three keys for display:
{
"content": "## Coffee shop landing page\n...\n\n### Oak & Ember\n\n**index.html**\n\n```html\n...\n```",
"html_code_preview": "<!DOCTYPE html><html>...one complete page with its CSS and JS inline...</html>",
"artifacts": [
{ "name": "menu.pdf", "url": "https://prod-aisearchimages.s3.us-west-1.amazonaws.com/..." },
{ "name": "prices.xlsx", "url": "https://..." }
]
}
content: HTML with everything to show, including the code of any page, script or project in fenced code blocks.html_code_preview: when the agent built a web page, the whole page as one HTML document (CSS and JS inlined, responsive). When it is not empty, show a Preview button that loads it in a sandboxed webview (scripts allowed, no access to the app). Empty string otherwise.feedback:up,downornull. Set it withPOST {node_base}/api/agent/agents/{id}/messages/{messageId}/feedbackand body{ "value": "up" | "down" | null, "comment": "optional" }. Returns{ messageId, feedback }; another user's or an unknown reply is404.sources,follow_ups,shopping: the source cards, follow-up questions and shopping offers sent with that reply, so a reopened chat can show them again.artifacts: files to download, one entry per file, each withnameandurl. A message can have several.urlis a signed S3 link valid for 1 hour (no Bearer token needed); reopening the chat returns fresh links. Images made withcreate_imageoredit_imageare the exception: theirurlis a public link that never expires, the same as search.com Computer images. It isnullif a link could not be made.
Scheduled tasks run on this server, separate from search.com Computer. Each result is posted in the chat the task was made in, as an assistant message that starts with "⏰ task name" (download links inside are valid for 7 days), and is listed by GET /api/agent/notifications?after={ISO time} as { notifications: [{ id, task_id, task_name, agent_id, message_id, status (notify, done or failed), title, summary, created_at }] }. Poll it to show notifications. Tasks: GET /api/agent/tasks (optional ?status=active|paused|done|cancelled|failed), POST /api/agent/tasks/{taskId}/pause, /resume and /cancel. The server runs due tasks when cron calls GET /api/agent/scheduler/tick?key={secret code} every minute.
6. Tools the app must run
calculate, current_time, show_code, open_connectors, research_notes, schedule_task, view_image, create_file, read_document, create_image, edit_image, transform_image, find_places, compare_prices, analyze_data, edit_document, and the connected app tools loaded by open_connectors (names like jira__get_issue, slack__search_messages, slack__post_message or gmail__send_message) run on the server. App tools can write: the agent sends, posts, creates or books directly when the user asks for it, and only drafts when the user asks to review first. Web search runs inside the model and sends tool events named web_search with the label "Searching the web". They do not send tool_request. Show their tool events in the thread. When an app is not connected, the stream sends connect_required with apps. Every other tool is the app's job. Run name with args, then post the result on the same user's token while the stream is still open.
POST {node_base}/api/agent/runs/{runId}/tool-result
POST http://127.0.0.1:3001/api/agent/runs/{runId}/tool-result
POST https://dev.admedia.com/nodejs_search/api/agent/runs/{runId}/tool-result
{
"callId": "<from tool_request>",
"ok": true,
"result": { }
}
On failure send { "callId", "ok": false, "error": "what went wrong" }. The body limit is 8MB. Success is { "accepted": true }. A result posted after the user stops is also { "accepted": true } and is ignored. A mismatched callId, run, or user is 404 That tool request is not waiting.
| Tool | Arguments |
|---|---|
search_files | query, path. Empty path uses the allowed folder. * or *.ext returns at most 100 names. |
read_file | path. Text, and text extracted from PDF and Excel. Refuse text over 1 MB and PDF or Excel over 20 MB. |
search_file_content | path, query. At most 10 matching lines. |
search_documents | query, path. Empty path uses the allowed folder. .txt, .md, .markdown, .csv, .json, and .log. At most 20 lines. |
list_directory | path |
file_info | path. Kind and size. No body, mime type, or timestamps. |
write_file | path, content. .txt, .md, .markdown, or a code file the user asked for: write content as text. For .pdf, .docx, .pptx and .xlsx, content is base64 of the file create_file just made: decode it and write those bytes. Do not write the base64 text, and do not leave a 0-byte file. Create missing folders. A new file is saved immediately. Replacing an existing file asks the user first. If they decline, post ok: false with The user declined to replace that file. |
replace_file_content | path, targetContent, replacementContent, startLine, endLine. Use 0 for both line fields to search the whole file. The passage must match once. |
append_to_file | path, content. Creates the file when it does not exist. |
apply_patch | patch, a unified diff. If a hunk does not match, change nothing. |
move_file | sourcePath, destinationPath. The destination must not already exist. rename_file is the same tool. |
copy_file | sourcePath, destinationPath, overwrite. Refuse an existing destination unless overwrite asks the user first. copy_directory is the same tool. |
trash_file | path. Ask first. Move it to the system trash. This is not a permanent delete. |
create_directory | path. Creates parent folders too. make_directory is the same tool. |
read_file_lines | path, startLine, lineCount (1–200). read_file_range is the same tool. |
directory_tree | path, maxDepth (1–4). Use . for the allowed folder. |
regex_search_files | pattern, path, fileExtension, caseSensitive. At most 20 matches. |
diff_files | pathA, pathB. |
extract_archive | archivePath, destinationPath. Empty destination extracts next to the archive. |
create_archive | sourcePaths, outputZipPath. The output must not already exist and ends in .zip. |
run_command | command, args, cwd. args is empty when the command line is already complete. cwd is relative; empty or . is the allowed folder. Confirm every call. If denied, post ok: false with The user declined to run this command. If allowed, post { exitCode, stdout, stderr }, keeping the last 8000 characters of each. The server waits up to 15 minutes. |
get_system_info | No arguments. Post { operatingSystem, platform, release, arch, cpuModel, cpuCount, totalMemoryBytes, freeMemoryBytes, uptimeSeconds }. |
get_disk_usage | drive. Empty reports every main disk. |
list_running_processes | name, sort (empty, memory, or cpu), limit (0 means 60). Do not include command lines or environment variables. |
get_process_info | pid, name. Pid 0 with a name, or a pid with an empty name. If it is not running, post ok: false with No process with that id is running. |
launch_application | application, the installed app name with no path. Post { application, opened: true }. |
get_installed_applications | query, limit. Empty query lists apps. Limit 0 means 200. |
get_clipboard_text | No arguments. Needs clipboard permission when the system requires it. Post { text, truncated }, at most 8000 characters. |
set_clipboard_text | text, 1–8000 characters. |
show_desktop_notification | title, body. Post { shown: true, title }. |
open_system_settings | pane. Empty opens the main window. Otherwise general, wifi, network, bluetooth, notifications, privacy, sound, display, battery, keyboard, mouse, trackpad, accessibility, users, printers, datetime, or storage. |
get_environment_info | No arguments. Post the runtime and only home, user, shell, language, and temp directory. Do not include secrets or the rest of the environment. |
get_network_status | No arguments. Post { online, interfaces: [{ name, connected }] }. Do not include addresses. |
get_battery_status | No arguments. Post { available, percent, charging, state, powerSource }. available: false when there is no battery. |
get_active_window | No arguments. Post { available, application, title, pid }. When accessibility is missing, post { available: false, permission: "denied" }. |
capture_screen | output_path. Empty lets the desktop choose. A path is relative. Confirm every call. Post { mediaType, imageBase64, path }. |
request_permission | permission: clipboard, screen, notifications, or accessibility. Confirm every call. Post { permission, status }. |
get_permission_status | Same permission values and status result as request_permission, without prompting. |
get_app_version | No arguments. Post { name, version, build }. |
get_operation_status | operation_id. Empty lists tracked operations. |
cancel_operation | operation_id. Required. Confirm every call. If it cannot be cancelled, post ok: false with That operation is not running. |
calculate | Server. operation (add, subtract, multiply, divide), a, b. |
current_time | Server. No arguments. Returns { iso, timeZone, local }. get_current_time is the same tool. |
browser_upload_file | file_path, selector. One relative path. Empty selector uses the first file input. Confirm first. |
read_image | path. A png, jpg, jpeg, gif, or webp. Post the image bytes. |
convert_file | sourcePath, destinationPath, targetFormat. The destination must not already exist. |
merge_files | sourcePaths, destinationPath. 1 to 20 sources, in order. |
split_file | path, destinationDirectory, rule. |
delete_file | path. Confirm every call. This is a permanent delete. Prefer trash_file. |
restore_file | path, destinationPath. Empty destination uses the original path. |
open_file | path. Opens the default app. No file body. |
reveal_file_in_explorer | path. |
get_recent_files | path, limit (1–50), kind (modified, accessed, or empty). Empty path uses the allowed folder. |
filter_files | path, extension, name, minBytes, maxBytes, days. Empty text and 0 mean unused. |
bulk_rename_files | path, extension, pattern. Confirm first. |
bulk_move_files | sourcePaths, destinationDirectory. Confirm first. |
bulk_copy_files | sourcePaths, destinationDirectory. Confirm first. |
compare_file_content | pathA, pathB. |
validate_file | path, format. Empty format detects from the extension. |
extract_file_metadata | path. Document properties or EXIF. No file body. |
preview_file | path. |
show_code | Server. kind (page, script, or project), title, files (path, language, content), sample_input, sample_output, output_verified. Adds the code to the answer and, for a page, the html_code_preview. No tool_request. |
delegate_to_agent | Server. agent_type, instruction. Used by the orchestrator only. The chat assistant does not receive this tool. |
open_connectors | Server. connectors, for example ["jira","bitbucket"]. |
{app}__{action} | Server. Connected app tools loaded by open_connectors, for example jira__get_issue. Arguments follow each tool's own schema. |
research_notes | Server. known, missing, leads, next. |
view_image | Server. Reads an image from a URL so the agent can see a screenshot in a bug report. Images returned by app tools (Slack, Jira) are shown to the agent too. |
create_file | Server. Makes a PDF, Word, PowerPoint, Excel or CSV file (with the user's images if asked), links it as /api/agent/files/{fileId}, and can attach it to mail, Slack or a ticket. When the user also named a folder, write_file saves that same file. A pptx takes a theme (plain, forest, midnight, ocean, ember, slate, sunshine; the same palettes as search.com Computer decks) and slides can have a chart (bar, line, pie, doughnut). An uploaded deck can be restyled into another theme. |
create_image | Server. prompt, size, filename. Creates a new image with Gemini (gemini-3.1-flash-image). It comes in the answer as <img> and in artifacts as a download. |
edit_image | Server. source_file_ids (1 to 4 uploaded or earlier images), prompt, size, filename. Edits or combines images ("add a butterfly") with Gemini (gemini-3.1-flash-image). The new image comes the same way. |
compare_prices | Server. query, country, max_price. Real offers across online stores from Zenserp Google Shopping, sent as shopping_result. Price alerts use schedule_task with watch: price, which runs compare_prices and sends a push when the price drops under the target. |
transform_image | Server. source_file_id, operation (remove_background, upscale, variations, to_sketch, sketch_to_photo), count, upscale_factor, extra, filename. Every operation except upscale uses Gemini (gemini-3.1-flash-image). Upscale resizes the file. The images come in the answer and in artifacts. |
analyze_data | Server. file_ids, code. Runs Python (pandas, numpy, scipy, matplotlib, seaborn) in a sandbox on uploaded CSV or Excel files. Charts come in the answer as images; result files (csv, xlsx) come in artifacts. |
edit_document | Server. file_id, code. Edits an uploaded Word, Excel or PowerPoint file in place with python-docx, openpyxl or python-pptx, keeping its formatting. The edited file comes in artifacts. |
draw_visual | Server. kind (chart, mermaid or svg), source, title. Draws a chart, maths graph, flowchart, timeline or labelled drawing to a PNG in a cloud browser, saves it with a permanent link and places it in the answer as <img>. It is also in artifacts and in chat history. Not used when the user asks for the code itself. |
find_places | Server. query, near_user, limit. Real places from Google Maps around the sent latitude/longitude or in a named area. The answer gets a fenced map block with JSON { query, places: [{ place_id, title, address, stars, userRatingCount, phone, url, type, openNow, coordinates: { latitude, longitude }, mapUrl }] }, the same as search.com Computer. |
read_document | Server. Reads an uploaded file, a file in the user's folder (through read_file_bytes) or a link: PDF, Word, PowerPoint, Excel, CSV, text and images, including images inside documents. |
page_check | Server. Measures a page in a cloud browser: status, load time, viewports, overflow, console errors, metadata, ad slots. When the app is closed, the browser tools also run in that cloud browser. |
schedule_task | Server. Saves a reminder (notify), a one-time or repeating job the agent does (agent, for example send a mail every hour), or a watch (inbox, price or news, quiet until there is something new or the stop condition is met). It runs on this server; results go to the chat and to /notifications. The tool event label is "Scheduling <name>". |
browser_open | url |
browser_get_text | none |
browser_click | text |
browser_fill | label, value |
browser_screenshot | none |
browser_click_at | x, y |
browser_press_key | key |
browser_scroll | direction: up, down, top, or bottom. |
browser_back | none |
browser_links | none |
browser_wait_for | text, selector, state, timeout_ms. Empty text or selector means unused. timeout_ms 0 means 10 seconds. |
browser_tab_manager | action (list_tabs, get_active_tab, switch_tab, new_tab, duplicate_tab, close_tab), tab_index (-1 when unused, or to close or duplicate the active tab), url (empty except for new_tab). At most 8 tabs. |
browser_select_option | label, selector, value. Leave the unused locator empty. |
rename_file | Same arguments as move_file. |
copy_directory | Same arguments as copy_file. |
read_file_range | Same arguments as read_file_lines. |
get_file_metadata | path. Type, size, created, and modified. No file body. |
get_file_hash | path, algorithm (sha256, sha1, or md5). |
find_duplicate_files | path. . scans the allowed folder. |
read_file_preview | path, maxCharacters (1–4000). |
read_file_encoding | path. Encoding only, no file body. |
browser_reload | tab_index (-1 for the active tab), ignore_cache. |
browser_forward | none |
browser_get_url | none. Post { url }. |
browser_get_title | none. Post { title }. |
browser_get_page_info | none. Post { url, title, readyState }. |
browser_find_text | text. |
browser_get_element_text | selector. |
browser_get_element_attribute | selector, attribute. |
browser_get_dom | selector. Empty is the whole page. At most 12000 characters. |
browser_wait_for_navigation | timeout_ms. 0 means 10 seconds. |
browser_wait_for_load_state | state (load, domcontentloaded, networkidle), timeout_ms. |
browser_hover | selector, text. Leave the unused one empty. |
browser_double_click | selector, text. Leave the unused one empty. |
browser_right_click | selector, text. Leave the unused one empty. |
browser_type | selector, text, delay_ms, clear. Empty selector types into the focused field. |
browser_clear | selector, label. Leave the unused one empty. |
browser_check | selector, label, text. Leave the unused ones empty. |
browser_uncheck | selector, label, text. Leave the unused ones empty. |
browser_select_text | selector, text, start, end. -1 means that offset is unused. |
browser_copy_text | selector. Empty copies the selection. Ask first. |
browser_download_file | url, selector. Empty url clicks the selector. Ask first, then post the saved location. |
browser_get_downloads | limit. 0 means 20. |
browser_upload_multiple_files | file_paths, selector. 1 to 10 relative paths. Empty selector uses the first file input. Ask first. Use this for one file too. |
browser_wait_for_download | filename, directory, timeout_ms. Empty filename or directory means unused. |
browser_get_active_tab | none. Post { index, url, title, total }. |
browser_close_tab | tab_index. -1 closes the active tab. |
browser_duplicate_tab | tab_index. -1 duplicates the active tab. |
browser_navigate_history | steps (the history delta), from -20 to 20, excluding 0. |
browser_save_page | path, format (html, pdf, text, or png). Empty path chooses a name. Ask first. |
browser_wait_for_element | selector, state (visible, hidden, attached, detached), timeout_ms. |
browser_get_cookies | domain, name. Empty domain is the current page. Empty name is every cookie for that site. Other sites are not returned. Ask first. |
browser_clear_cookies | domain, name. Empty domain is the current page. Empty name clears every cookie for that site. Ask first. |
browser_get_storage | storage (local or session), key. Empty key returns up to 50 entries for the current page. Ask first. |
browser_set_storage | storage, key, value. Current page only. Ask first. |
browser_get_console_logs | level (empty, log, info, warn, error, or debug), limit. 0 means 50. |
browser_get_network_errors | url, limit. Empty url is every failed request. 0 means 50. Reports HTTP errors and requests that did not complete. |
create_task | name, instruction, inputs. Post { taskId }. Do not run it. |
run_task | task_id (id or name). Ask first. |
pause_task | task_id. |
resume_task | task_id. |
cancel_task | task_id. Ask first. Completed steps stay done. |
get_task_status | task_id. |
get_task_history | limit (1–50), status, name, days. Empty text and days 0 mean that filter is unused. |
retry_failed_task | task_id. Ask first. |
get_task_logs | task_id, severity, step_id. Empty severity or step id means unused. |
request_user_confirmation | operation_id, message. Empty operation id is allowed. Post { approved }. |
create_workflow | name, steps. Post { workflowId }. Do not run it. |
run_workflow | workflow_id, inputs. Empty inputs are allowed. Ask first. |
validate_workflow | workflow_id. Do not run it. |
get_workflow_status | workflow_id, run_id. Empty run id means the latest run. |
rollback_operation | operation_id. Ask first. If no rollback exists, post ok: false with That operation cannot be rolled back. |
get_approval_status | operation_id. Status is granted, denied, pending, or expired. |
File paths are relative to the folder the user allowed on the device. Return the real tool payload in result. browser_screenshot must include screenshotBase64 (a PNG). The model sees that image. The stored event keeps only the size, not the image bytes.
The request and result for every tool are on the tool reference.
Redis by user
GET {node_base}/api/agent/redis?code={secret code}&user={userId}
Operator page. Same secret code as POST /scheduled-run (code query or x-code header). With no user it lists every user that has Redis data: daily prompts, messages this minute, requests this minute, and running agents. A count marked over is past the cap. A user listed in config/prompt-quota-skip-users.txt is shown as unlimited and is not refused. Open a user id for that user's keys and the time left on each one. Add format=json for the same data as JSON. The Reset button on a user's page is the only way to delete those keys. It does not delete another user's keys.
Chat debug
GET {node_base}/api/agent/debug?code={secret code}
Operator page. Same secret code as the Redis page. It lists users. Open a user to see that user's agents, then open an agent to see the chat. Each turn shows the user message, the tool calls stored for that run (name, status, arguments, and result), the server response, and the input and output tokens. user selects a user. agent selects one of that user's agents. before is a message id for the next older page. Add format=json for the same data as JSON.
7. Errors
Auth failures use { "ok": false, "error": { "code", "message" } }. Chat failures use { "error": "message" }.
| Status | When |
|---|---|
401 MISSING_TOKEN | No Authorization: Bearer header. |
401 EXPIRED | Exchange again. Do not refresh this token on the AI manager endpoint. |
401 INVALID | Bad token, or a site login JWT. |
403 WRONG_APP | Token was minted for an app other than agent. |
400 | Empty message, message over 8000 characters, body is not JSON, agent id is not valid, limit is not 1 to 100, or before is not in this list or chat. |
404 | Unknown agent, tool request, or run for this user. |
409 | That agent is already replying, including a delete during the reply. |
429 | Three replies are already running. This user already has 3 agents replying. A different user is not affected. Retry when one of them finishes. |
503 | The reply lock is unavailable. Redis did not accept the lock, so the reply did not start. Retry the same clientMessageId once Redis is back. This is not a 409. |
413 | Message body over 20KB, or tool result over 8MB. |
Order to implement
- Sign in on PHP and store both login tokens.
- Exchange
app: "agent"and store the 15-minute token. Renew it onEXPIRED. - List agents, page with
beforewhenhasMoreis true, open one, and page older messages the same way. - Send with
fetchand read events untildone. - On
tool_request, run the tool and post{node_base}/api/agent/runs/{runId}/tool-resultbefore the stream ends. - Stop with
POST {node_base}/api/agent/runs/{runId}/stop. Delete withDELETE {node_base}/api/agent/agents/{id}.
Import the downloaded collection into Postman. Set node_base to http://127.0.0.1:3001 for local development, or https://dev.admedia.com/nodejs_search for the development server. Fill php_base, email, and password, then run the requests from the top. Send Message is an SSE call. A request that asks for local files stays open until Tool result is posted from a second tab.