import requests
url = "https://api.datagrid.com/v1/converse"
payload = {
"prompt": "<string>",
"config": {
"knowledge_ids": ["<string>"],
"corpus": [
{
"type": "knowledge",
"knowledge_id": "<string>"
}
],
"system_prompt": "<string>",
"custom_prompt": "<string>",
"planning_prompt": "<string>",
"tools": ["<string>"],
"disabled_tools": ["<string>"],
"llm_model": "gemini-3.1-flash-lite",
"temperature": 0.5,
"agent_model": "magpie-2.5",
"mcp_servers": [
{
"server_id": "<string>",
"type": "inline_mcp",
"server_label": "<string>",
"server_url": "<string>",
"credential_id": "<string>",
"server_description": "<string>",
"authorization": "<string>"
}
],
"agent_tools": ["<string>"],
"disabled_agent_tools": ["<string>"]
},
"agent_id": "<string>",
"agent_routing": { "mode": "auto" },
"conversation_id": "<string>",
"stream": False,
"generate_citations": False,
"generate_title": False,
"include_steps": True,
"secret_ids": ["<string>"],
"text": { "format": {} },
"user": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>"
},
"current_view_content": "<string>",
"reference_date": "2023-12-25",
"skill_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"slash_keys": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
config: {
knowledge_ids: ['<string>'],
corpus: [{type: 'knowledge', knowledge_id: '<string>'}],
system_prompt: '<string>',
custom_prompt: '<string>',
planning_prompt: '<string>',
tools: ['<string>'],
disabled_tools: ['<string>'],
llm_model: 'gemini-3.1-flash-lite',
temperature: 0.5,
agent_model: 'magpie-2.5',
mcp_servers: [
{
server_id: '<string>',
type: 'inline_mcp',
server_label: '<string>',
server_url: '<string>',
credential_id: '<string>',
server_description: '<string>',
authorization: '<string>'
}
],
agent_tools: ['<string>'],
disabled_agent_tools: ['<string>']
},
agent_id: '<string>',
agent_routing: {mode: 'auto'},
conversation_id: '<string>',
stream: false,
generate_citations: false,
generate_title: false,
include_steps: true,
secret_ids: ['<string>'],
text: {format: {}},
user: {first_name: '<string>', last_name: '<string>', email: '<string>'},
current_view_content: '<string>',
reference_date: '2023-12-25',
skill_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
slash_keys: ['<string>']
})
};
fetch('https://api.datagrid.com/v1/converse', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.datagrid.com/v1/converse \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"config": {
"knowledge_ids": [
"<string>"
],
"corpus": [
{
"type": "knowledge",
"knowledge_id": "<string>"
}
],
"system_prompt": "<string>",
"custom_prompt": "<string>",
"planning_prompt": "<string>",
"tools": [
"<string>"
],
"disabled_tools": [
"<string>"
],
"llm_model": "gemini-3.1-flash-lite",
"temperature": 0.5,
"agent_model": "magpie-2.5",
"mcp_servers": [
{
"server_id": "<string>",
"type": "inline_mcp",
"server_label": "<string>",
"server_url": "<string>",
"credential_id": "<string>",
"server_description": "<string>",
"authorization": "<string>"
}
],
"agent_tools": [
"<string>"
],
"disabled_agent_tools": [
"<string>"
]
},
"agent_id": "<string>",
"agent_routing": {
"mode": "auto"
},
"conversation_id": "<string>",
"stream": false,
"generate_citations": false,
"generate_title": false,
"include_steps": true,
"secret_ids": [
"<string>"
],
"text": {
"format": {}
},
"user": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>"
},
"current_view_content": "<string>",
"reference_date": "2023-12-25",
"skill_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"slash_keys": [
"<string>"
]
}
'{
"object": "conversation.message",
"id": "<string>",
"agent_id": "<string>",
"role": "user",
"content": [
{
"type": "text",
"text": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"conversation_id": "<string>",
"credits": {
"consumed": 123
},
"citations": [
{
"citation": "<string>",
"sources": [
{
"type": "image",
"source_name": "<string>",
"confirmations": [
"<string>"
],
"source_id": "<string>",
"source_uri": "<string>",
"external_url": "<string>",
"status": "<string>",
"status_color": "<string>",
"status_category": "open",
"fields": [
{
"label": "<string>",
"value": "<string>"
}
],
"item_type": "<string>",
"thumbnail_url": "<string>",
"page_number": 2
}
]
}
],
"chat_mode": "full_agent",
"generated_title": "<string>",
"tool_calls": [
{
"type": "tool_call",
"id": "<string>",
"status": "in_progress",
"tool": {
"object": "tool",
"name": "<string>",
"label": "<string>",
"description": "<string>"
},
"output": "<string>",
"executed_in_parallel": true
}
],
"reasoning": [
{
"id": "<string>",
"status": "in_progress",
"type": "reasoning",
"task": "<string>",
"output": "<string>",
"execution_time_ms": 123,
"executed_in_parallel": true
}
],
"skills": [
{
"id": "<string>",
"slash_key": "<string>",
"name": "<string>",
"scope": "account"
}
]
}{
"status_code": 123,
"error": "<string>",
"message": "<string>",
"details": {
"reason": "<string>",
"unresolved": [
{
"token": "<string>",
"reason": "not-found"
}
]
}
}{
"status_code": 123,
"error": "rate_limit_exceeded",
"message": "<string>",
"retryable": true,
"statusCode": 123,
"mitigation": "<string>",
"details": {
"reason": "<string>"
}
}Converse
Converse with an AI Agent
import requests
url = "https://api.datagrid.com/v1/converse"
payload = {
"prompt": "<string>",
"config": {
"knowledge_ids": ["<string>"],
"corpus": [
{
"type": "knowledge",
"knowledge_id": "<string>"
}
],
"system_prompt": "<string>",
"custom_prompt": "<string>",
"planning_prompt": "<string>",
"tools": ["<string>"],
"disabled_tools": ["<string>"],
"llm_model": "gemini-3.1-flash-lite",
"temperature": 0.5,
"agent_model": "magpie-2.5",
"mcp_servers": [
{
"server_id": "<string>",
"type": "inline_mcp",
"server_label": "<string>",
"server_url": "<string>",
"credential_id": "<string>",
"server_description": "<string>",
"authorization": "<string>"
}
],
"agent_tools": ["<string>"],
"disabled_agent_tools": ["<string>"]
},
"agent_id": "<string>",
"agent_routing": { "mode": "auto" },
"conversation_id": "<string>",
"stream": False,
"generate_citations": False,
"generate_title": False,
"include_steps": True,
"secret_ids": ["<string>"],
"text": { "format": {} },
"user": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>"
},
"current_view_content": "<string>",
"reference_date": "2023-12-25",
"skill_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"slash_keys": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
config: {
knowledge_ids: ['<string>'],
corpus: [{type: 'knowledge', knowledge_id: '<string>'}],
system_prompt: '<string>',
custom_prompt: '<string>',
planning_prompt: '<string>',
tools: ['<string>'],
disabled_tools: ['<string>'],
llm_model: 'gemini-3.1-flash-lite',
temperature: 0.5,
agent_model: 'magpie-2.5',
mcp_servers: [
{
server_id: '<string>',
type: 'inline_mcp',
server_label: '<string>',
server_url: '<string>',
credential_id: '<string>',
server_description: '<string>',
authorization: '<string>'
}
],
agent_tools: ['<string>'],
disabled_agent_tools: ['<string>']
},
agent_id: '<string>',
agent_routing: {mode: 'auto'},
conversation_id: '<string>',
stream: false,
generate_citations: false,
generate_title: false,
include_steps: true,
secret_ids: ['<string>'],
text: {format: {}},
user: {first_name: '<string>', last_name: '<string>', email: '<string>'},
current_view_content: '<string>',
reference_date: '2023-12-25',
skill_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
slash_keys: ['<string>']
})
};
fetch('https://api.datagrid.com/v1/converse', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.datagrid.com/v1/converse \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"config": {
"knowledge_ids": [
"<string>"
],
"corpus": [
{
"type": "knowledge",
"knowledge_id": "<string>"
}
],
"system_prompt": "<string>",
"custom_prompt": "<string>",
"planning_prompt": "<string>",
"tools": [
"<string>"
],
"disabled_tools": [
"<string>"
],
"llm_model": "gemini-3.1-flash-lite",
"temperature": 0.5,
"agent_model": "magpie-2.5",
"mcp_servers": [
{
"server_id": "<string>",
"type": "inline_mcp",
"server_label": "<string>",
"server_url": "<string>",
"credential_id": "<string>",
"server_description": "<string>",
"authorization": "<string>"
}
],
"agent_tools": [
"<string>"
],
"disabled_agent_tools": [
"<string>"
]
},
"agent_id": "<string>",
"agent_routing": {
"mode": "auto"
},
"conversation_id": "<string>",
"stream": false,
"generate_citations": false,
"generate_title": false,
"include_steps": true,
"secret_ids": [
"<string>"
],
"text": {
"format": {}
},
"user": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>"
},
"current_view_content": "<string>",
"reference_date": "2023-12-25",
"skill_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"slash_keys": [
"<string>"
]
}
'{
"object": "conversation.message",
"id": "<string>",
"agent_id": "<string>",
"role": "user",
"content": [
{
"type": "text",
"text": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"conversation_id": "<string>",
"credits": {
"consumed": 123
},
"citations": [
{
"citation": "<string>",
"sources": [
{
"type": "image",
"source_name": "<string>",
"confirmations": [
"<string>"
],
"source_id": "<string>",
"source_uri": "<string>",
"external_url": "<string>",
"status": "<string>",
"status_color": "<string>",
"status_category": "open",
"fields": [
{
"label": "<string>",
"value": "<string>"
}
],
"item_type": "<string>",
"thumbnail_url": "<string>",
"page_number": 2
}
]
}
],
"chat_mode": "full_agent",
"generated_title": "<string>",
"tool_calls": [
{
"type": "tool_call",
"id": "<string>",
"status": "in_progress",
"tool": {
"object": "tool",
"name": "<string>",
"label": "<string>",
"description": "<string>"
},
"output": "<string>",
"executed_in_parallel": true
}
],
"reasoning": [
{
"id": "<string>",
"status": "in_progress",
"type": "reasoning",
"task": "<string>",
"output": "<string>",
"execution_time_ms": 123,
"executed_in_parallel": true
}
],
"skills": [
{
"id": "<string>",
"slash_key": "<string>",
"name": "<string>",
"scope": "account"
}
]
}{
"status_code": 123,
"error": "<string>",
"message": "<string>",
"details": {
"reason": "<string>",
"unresolved": [
{
"token": "<string>",
"reason": "not-found"
}
]
}
}{
"status_code": 123,
"error": "rate_limit_exceeded",
"message": "<string>",
"retryable": true,
"statusCode": 123,
"mitigation": "<string>",
"details": {
"reason": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
A text prompt to send to the agent.
Override the agent config for this converse call. This is applied as a partial override.
Show child attributes
Show child attributes
The ID of the agent that should be used for the converse. When omitted and a conversation_id is provided, the conversation's existing agent assignments are preserved. When omitted without a conversation_id, a new conversation is created with the default agent.
Controls how the API selects which agent to use when routing is needed. This field is mutually exclusive with agent_id. When both agent_id and agent_routing are omitted and a conversation_id is provided, the conversation's existing agent assignments are preserved.
- Auto routing
- Manual routing
Show child attributes
Show child attributes
The ID of the present conversation to use. If it's not provided - a new conversation will be created.
Determines the response type of the converse. Response is the Server-Sent Events if stream is set to true.
Determines whether the response should include citations. When enabled, the agent will generate citations for factual statements.
Determines whether generated_title metadata should be included. Defaults to false. generated_title is emitted only when this flag is explicitly true.
When set to false, tool call and reasoning step events are omitted from SSE streams. Non-streaming responses always include the tool_calls and reasoning fields (as null when empty).
Controls how the agent processes the request for this turn. Matches the chat mode selector in the Datagrid web app: Execute (full_agent), Extended (light_agent), Ask (llm_router). Ask uses the agent path with Magpie 2.5 and Ask-specific prompt guidance. When omitted, the request inherits the conversation's persisted chat_mode; new conversations default to Execute (full_agent). When set to auto, the request also runs as Execute (full_agent); Auto is currently accepted for compatibility but does not predict Ask, Extended, or Execute per message. When set to a concrete mode, that concrete mode is used directly. The default agent_model for Execute is magpie-2.5 unless config.agent_model explicitly sets another supported model.
auto, full_agent, light_agent, llm_router Array of secret ID's to be included in the context. The secret value will be appended to the prompt but not stored in conversation history.
Contains the format property used to specify the structured output schema (text.format).
Structured output is supported for all agent_model values and chat_mode settings when text.format is provided (same JSON Schema mechanism everywhere). Ask in the web app maps to chat_mode: llm_router; auto currently maps to Execute (full_agent).
Show child attributes
Show child attributes
Override user information for this converse call. This allows you to override the first_name, last_name, and email that will be used in the conversation context.
Show child attributes
Show child attributes
A datagrid file URI pointing to content the user is currently viewing on screen (e.g., a web page, document, or dashboard rendered as markdown). The agent uses this context to resolve ambiguous queries like 'what is this about?' or 'review this'. The content is automatically summarized and made available to the agent.
Optional deterministic reference date override in YYYY-MM-DD format. Must be a real calendar date (for example, rejects impossible dates like 2026-02-31). When set, the agent treats this date as today for relative date resolution and date context rendering.
^[0-9]{4}-[0-9]{2}-[0-9]{2}$Array of skill IDs to force-activate for this turn. Each ID must refer to an
account-shared or builtin skill reachable by the API key's teamspace. User-scoped
(private) skills are not accessible from API keys. Deduped and merged with
slash_keys before the turn begins. Maximum 32 entries. Returns 400 if any ID
is unresolved, disabled, or out of scope.
32Array of slash-key tokens (e.g. "budget-check" or "/rfi-triage") to
force-activate for this turn. Leading slashes are stripped. Resolved
account-shared → builtin in precedence order. Deduped and merged with
skill_ids before the turn begins. Maximum 32 entries. Returns 400 if any
token cannot be resolved to an enabled, reachable skill.
3264Response
Converse response
The conversation.message object represents a message in a conversation.
The object type, which is always conversation.message.
conversation.message The message identifier.
The ID of the agent that sent or responded to the message.
The role of the message sender - either 'user' or 'agent'.
user, agent Contents of the message.
Text content for a message.
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
The ISO string for when the message was created.
The ID of the conversation the message belongs to.
Credit consumption for this converse turn. null for user-role messages and when retrieving messages from conversation history.
Show child attributes
Show child attributes
Array of citations that provide sources for factual statements in the response. Each citation includes the referenced text and its sources.
Show child attributes
Show child attributes
The chat mode used for this response (web app: Execute = full_agent, Extended = light_agent, Ask = llm_router). Auto mode currently runs and reports as Execute (full_agent).
full_agent, light_agent, llm_router Auto-generated conversation title for this turn. Null when title generation does not run or fails.
Array of tool calls that were executed during this response.
Show child attributes
Show child attributes
Array of reasoning steps that occurred during this response. Only includes steps with status completed or failed.
Show child attributes
Show child attributes
Array of skills that were force-activated for this turn via skill_ids or slash_keys. Null when no skills were explicitly requested, or when none of the requested skills survived resolution for this turn.
Show child attributes
Show child attributes