Skip to content
QwryAI
Documentation
Pages

Commands

CLI Chat

Start a conversation with a QwryAI agent, send messages as a customer and read its replies from the terminal

Use the chat tools to talk to an agent the way a customer on the API channel does: start a conversation, send a message, and get the agent's reply back in the same call. They need the Chat with agents permission. Sign in first (see CLI Auth) and keep the agent's id in $AGENT (see CLI Agents).

Send a message

Start a conversation on the API channel:

Bash
qwryai-cli tools:call create_conversation --args "{\"chatbotId\":\"$AGENT\"}"
JSON
{"success":true,"data":{"conversationId":"<conversationId>","chatbotId":"<agentId>","channel":"api"}}

Add a metadata object, such as {"orderNumber":"1043"}, to store your own details with the conversation.

Send a message as the customer:

Bash
CONV=$(qwryai-cli tools:call create_conversation --args "{\"chatbotId\":\"$AGENT\"}" | jq -r '.data.conversationId')
qwryai-cli tools:call send_message --args "{\"chatbotId\":\"$AGENT\",\"conversationId\":\"$CONV\",\"content\":\"How do I reset my password?\"}"

The CLI waits up to 60 seconds for the agent and prints its whole reply:

JSON
{
  "success": true,
  "data": {
    "conversationId": "<conversationId>",
    "turnId": "<turnId>",
    "status": "completed",
    "replies": [
      {
        "id": "<messageId>",
        "sender": "ai",
        "timestamp": "2026-12-01T09:14:05.112Z",
        "content": "Select **Forgot password?** on the sign-in page and enter your email. We'll send you a reset link within a few minutes."
      }
    ]
  }
}

status tells you what happened to the turn:

statusMeaning
completedThe agent answered; its messages are in replies
pendingThe reply isn't ready after 60 seconds. Don't send anything else; read it later with get_conversation_detail
no_ai_replyThe AI isn't replying here because a human agent is handling the conversation or AI replies are paused. reason says which
failedThe reply couldn't be generated; send the message again

A message can be up to 10,000 characters.

Continue a conversation

Send the next message with the same conversationId. The agent sees the whole conversation so far, so you never resend earlier messages:

Bash
qwryai-cli tools:call send_message --args "{\"chatbotId\":\"$AGENT\",\"conversationId\":\"$CONV\",\"content\":\"I don't get the email.\"}"

Scripting output

Every reply is JSON, so pull out just the agent's text with jq:

Bash
qwryai-cli tools:call send_message --args "{\"chatbotId\":\"$AGENT\",\"conversationId\":\"$CONV\",\"content\":\"hi\"}" | jq -r '.data.replies[].content'

The CLI exits with a non-zero code when a call fails, so CI steps stop on errors.

Search the agent's knowledge

Check what the agent would draw on for a question, without starting a conversation:

Bash
qwryai-cli tools:call search_knowledge --args "{\"chatbotId\":\"$AGENT\",\"query\":\"refund policy\",\"limit\":2}"
JSON
{
  "success": true,
  "data": {
    "query": "refund policy",
    "results": [
      {
        "title": "Shipping, late orders and missing parcels policy",
        "sourceId": "<sourceId>",
        "score": 0.405,
        "content": "Shipping, late orders and missing parcels policy\n\nProcessing time\n- Orders are packed and handed to the courier within 1-2 business days…"
      }
    ]
  }
}

Results come best first, five by default and up to 20. Scores are relative; good matches usually land between about 0.3 and 0.6.

Fill in a lead form

When the agent asks the customer for details, list the lead forms they can submit in this conversation and send one:

Bash
qwryai-cli tools:call get_conversation_lead_forms --args "{\"chatbotId\":\"$AGENT\",\"conversationId\":\"$CONV\"}"
qwryai-cli tools:call submit_conversation_lead_form --args "{\"chatbotId\":\"$AGENT\",\"conversationId\":\"$CONV\",\"formId\":\"<formId>\",\"data\":{\"email\":\"sam@example.com\"}}"

data maps each field name from the form to its value.

Commands

ToolPurpose
create_conversationStart a customer conversation on the API channel
send_messageSend a message as the customer and wait for the agent's reply
search_knowledgeFind the passages the agent knows that best match a question
get_conversation_lead_formsList the lead forms the customer can submit
submit_conversation_lead_formSubmit a lead form as the customer

Explore the documentation