Skip to content
QwryAI
Documentation
Pages

Guides

Agents

List your agents, read their settings, and change them through reviewed tool calls

The Tools API lets your code see every agent in the workspace and change how each one behaves: its instructions, model, Chat bubble text and look, guardrails and deploy channels. You find agents with list_agents, read settings with the read tools, and change them with tools that prepare a review you then apply. Every call is scoped to the workspace that owns the key: an agent from another workspace returns CHATBOT_NOT_FOUND.

Agents are created, renamed and deleted in the dashboard. The API has no tool for that.

Agent status

list_agents returns each agent with its id, name, status, isDefault, language and training:

Bash
curl -X POST 'https://api.qwryai.com/public/v1/tools/list_agents' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"page": 1}'
JSON
{
  "success": true,
  "data": {
    "agents": [
      {
        "id": "YOUR_AGENT_ID",
        "name": "QwryAI",
        "status": "active",
        "isDefault": true,
        "language": "en",
        "training": { "status": "pending", "percent": 75 }
      }
    ],
    "page": 1,
    "total": 1,
    "hasMore": false
  }
}
FieldMeaning
idThe agent's id. Pass it as chatbotId to every agent tool, and as agentId in Chat API paths.
statusWhether the agent is active.
isDefaultThe workspace's default agent.
trainingThe latest training run's status and percent, or null if it never trained.

To follow training source by source, use check_training_status or find_sources_by_status. See Sources.

Reading settings

ToolReturns
agent_configurationModel, citations, language, status and routing settings. null means not configured.
agent_instructionsOne instruction field, such as systemPrompt or guardrails, in 4,000-character pages.
get_chat_interfaceThe Chat bubble's text and behaviour: name, placeholder, welcome and suggested messages.
list_available_modelsThe model catalog Model Settings uses, with each model's capabilities and credit cost, 20 per page.
get_deploy_statusEach channel's setup and on/off state, as Channels shows it.

These tools need Read agent settings.

Reviewed updates

Tools that change an agent never apply the change on the first call. They return a review: each change with its value before and after, and a reviewId. Nothing changes until you apply that review.

JSON
{
  "success": true,
  "data": {
    "status": "review_required",
    "reviewId": "4e1d7b0a-6c2f-4f93-8a15-2b9e0d3c7a64",
    "tool": "update_model",
    "changes": [
      { "title": "Temperature", "before": 0.2, "after": 0.5 }
    ],
    "unchanged": [],
    "expiresAt": "2026-12-01T10:15:00.000Z",
    "next": "Show these changes to the user. Call apply_change with this reviewId only after they approve; the review expires in 15 minutes."
  }
}

Apply it with POST /public/v1/reviews/{reviewId}/apply, or the apply_change tool:

Bash
curl -X POST 'https://api.qwryai.com/public/v1/reviews/REVIEW_ID/apply' \
  -H 'Authorization: Bearer YOUR_API_KEY'
What you sendResult
Only the fields you want to changeThose fields change; everything else keeps its value.
Values that are already set409 NOTHING_TO_CHANGE; no review is created.
More than 20 changes at once400 TOO_MANY_CHANGES; split the request.

A review lasts 15 minutes and works once, for the key that prepared it. If the agent changed in the meantime, applying returns 409 STALE_REVIEW and you call the tool again for a fresh review. Several update tools also ask for the updatedAt you read, as expectedUpdatedAt, so they never overwrite a newer change.

Where changes go live

Instructions, the model and the Chat bubble's look save to the agent's draft, just as they do in the dashboard. The Playground uses the draft; your channels keep the published version until you publish:

ToolDoes
show_pending_changesLists what's in the draft.
publish_draftPublishes all of the draft, or only the changes you name, through a review.
discard_draftThrows away all of the draft, or the changes you name, through a review.

The Guardrails rate limit goes live as soon as its review is applied. See Drafts and publishing.

Training is separate

Adding or editing a source doesn't retrain the agent on its own. Call train_pending_sources, the API's Retrain agent, to train every new or changed source in one review. See Sources.

Tools

Error codes

Agent-specific error codes beyond the standard authentication and rate-limiting errors:

CodeHTTPDescription
CHATBOT_ID_REQUIRED400The body has no valid chatbotId. Get one from list_agents.
CHATBOT_NOT_FOUND404No agent with that id in your workspace.
AGENT_NOT_FOUND404Chat API: no agent with that id in your workspace.
NOTHING_TO_CHANGE409The values you asked for are already set.
STALE_REVIEW409The agent changed after the review. Call the tool again.
REVIEW_EXPIRED409The review is older than 15 minutes. Call the tool again.

Explore the documentation