Skip to main content
Credal | Documentation

Search documentation

Type to search this documentation.

On this pageOverview

Send a message to an agent

POST https://app.credal.ai/api/v1/agents/sendMessage Content-Type: application/json

Sends a message to a deployed agent and returns a job ID that can be used to poll for the response. Requires the api:agent:message:* scope.

Reference: https://docs.credal.ai/api-reference/v-1/api-reference/agents/send-message

  • Authorization header (bearer token, required) — Bearer authentication of the form Bearer <token>, where token is your auth token.

This endpoint expects an object.

  • agentId (string, required)
  • conversation (AgentsSendMessagePostRequestBodyContentApplicationJsonSchemaConversation, required)
  • message (string, required)

Message sent successfully

  • jobId (string, required)

Invalid request

  • any

Unauthorized

  • any

Forbidden

  • any

Internal server error

  • any

AgentsSendMessagePostRequestBodyContentApplicationJsonSchemaConversation

Section titled “AgentsSendMessagePostRequestBodyContentApplicationJsonSchemaConversation”

AgentsSendMessagePostRequestBodyContentApplicationJsonSchemaConversation0

Section titled “AgentsSendMessagePostRequestBodyContentApplicationJsonSchemaConversation0”
  • type (enum, required)
    • Allowed values: new
  • dataInputVariableSelections (map from string to list of string, optional, nullable)

AgentsSendMessagePostRequestBodyContentApplicationJsonSchemaConversation1

Section titled “AgentsSendMessagePostRequestBodyContentApplicationJsonSchemaConversation1”
  • type (enum, required)
    • Allowed values: existing
  • conversationId (string, required)

Request

JSON
{
  "agentId": "cc3fd192-ea62-11f0-99fd-03d6b2458fff",
  "conversation": {
    "type": "new",
    "dataInputVariableSelections": {}
  },
  "message": "What documents do we have about Q4 planning?"
}

Response

JSON
{
  "jobId": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"
}

SDK Code

TypeScript
import { CredalClient } from "@credal/sdk";

async function main() {
    const client = new CredalClient({
        token: "YOUR_TOKEN_HERE",
    });
    await client.agents.sendMessage({
        agentId: "cc3fd192-ea62-11f0-99fd-03d6b2458fff",
        conversation: {
            type: "new",
            dataInputVariableSelections: {},
        },
        message: "What documents do we have about Q4 planning?",
    });
}
main();
Python
from credal import CredalV1
from credal.agents import SendMessageAgentsRequestConversation_New

client = CredalV1(
    token="YOUR_TOKEN_HERE",
)

client.agents.send_message(
    agent_id="cc3fd192-ea62-11f0-99fd-03d6b2458fff",
    conversation=SendMessageAgentsRequestConversation_New(
        data_input_variable_selections={},
    ),
    message="What documents do we have about Q4 planning?",
)
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu