> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://dev.neurologyca.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://dev.neurologyca.com/_mcp/server.

# Send message through the ADK orchestrator

POST https://your-agent-backend.example.com/api/v1/adk/message
Content-Type: application/json

Processes a user message through the multi-agent pipeline and returns the final
assistant reply together with per-agent traces. This is the primary message endpoint
used by the current web integrations.


Reference: https://dev.neurologyca.com/agents/api-reference/send-adk-message

## Authentication

- `Authorization` header (bearer token, required) — Send the agent framework auth token as `Authorization: Bearer <token>`.

## Request

### Body (application/json)

This endpoint expects an AdkMessageRequest.

- `session_id` (string, required)
- `content` (string, required)
- `conversation_history` (list of ConversationHistoryItem, optional)
- `user_preferences` (map from string to any, optional)

## Response

### 200

Message processed successfully.

- `content` (string, required)
- `agent_traces` (list of AgentTrace, required)
- `total_latency_ms` (integer, required)
- `success` (boolean, required)
- `context` (map from string to any, optional, nullable)
- `sentiment` (map from string to any, optional, nullable)
- `query_analysis` (map from string to any, optional, nullable)
- `error` (string, optional, nullable)

## Errors

### 500 Internal Server Error

The orchestration pipeline failed.

- `detail` (string, optional)

## Types

### ConversationHistoryItem

- `role` (string, required)
- `content` (string, required)

### AgentTrace

- `agentName` (string, required)
- `agentType` (string, required)
- `startTime` (double, required)
- `endTime` (double, required)
- `latencyMs` (integer, required)
- `status` (enum, required)
  - Allowed values: `success`, `error`, `unknown`
- `outputSummary` (string, optional, nullable)
- `error` (string, optional, nullable)

## Examples

**Request**

```json
{
  "session_id": "4d9e5ca0-628f-4f98-b6d7-92f6309d979f",
  "content": "Help me prepare for a difficult conversation with my manager.",
  "conversation_history": [
    {
      "role": "user",
      "content": "I need advice for a tough work conversation."
    },
    {
      "role": "assistant",
      "content": "What part of the conversation feels hardest right now?"
    }
  ]
}
```

**Response**

```json
{
  "content": "string",
  "agent_traces": [
    {
      "agentName": "string",
      "agentType": "string",
      "startTime": 1.1,
      "endTime": 1.1,
      "latencyMs": 1,
      "status": "success",
      "outputSummary": "string",
      "error": "string"
    }
  ],
  "total_latency_ms": 1,
  "success": true,
  "context": {},
  "sentiment": {},
  "query_analysis": {},
  "error": "string"
}
```

**SDK Code**

```python
import requests

url = "https://your-agent-backend.example.com/api/v1/adk/message"

payload = {
    "session_id": "4d9e5ca0-628f-4f98-b6d7-92f6309d979f",
    "content": "Help me prepare for a difficult conversation with my manager.",
    "conversation_history": [
        {
            "role": "user",
            "content": "I need advice for a tough work conversation."
        },
        {
            "role": "assistant",
            "content": "What part of the conversation feels hardest right now?"
        }
    ]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://your-agent-backend.example.com/api/v1/adk/message';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"session_id":"4d9e5ca0-628f-4f98-b6d7-92f6309d979f","content":"Help me prepare for a difficult conversation with my manager.","conversation_history":[{"role":"user","content":"I need advice for a tough work conversation."},{"role":"assistant","content":"What part of the conversation feels hardest right now?"}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://your-agent-backend.example.com/api/v1/adk/message"

	payload := strings.NewReader("{\n  \"session_id\": \"4d9e5ca0-628f-4f98-b6d7-92f6309d979f\",\n  \"content\": \"Help me prepare for a difficult conversation with my manager.\",\n  \"conversation_history\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"I need advice for a tough work conversation.\"\n    },\n    {\n      \"role\": \"assistant\",\n      \"content\": \"What part of the conversation feels hardest right now?\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://your-agent-backend.example.com/api/v1/adk/message")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"session_id\": \"4d9e5ca0-628f-4f98-b6d7-92f6309d979f\",\n  \"content\": \"Help me prepare for a difficult conversation with my manager.\",\n  \"conversation_history\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"I need advice for a tough work conversation.\"\n    },\n    {\n      \"role\": \"assistant\",\n      \"content\": \"What part of the conversation feels hardest right now?\"\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://your-agent-backend.example.com/api/v1/adk/message")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"session_id\": \"4d9e5ca0-628f-4f98-b6d7-92f6309d979f\",\n  \"content\": \"Help me prepare for a difficult conversation with my manager.\",\n  \"conversation_history\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"I need advice for a tough work conversation.\"\n    },\n    {\n      \"role\": \"assistant\",\n      \"content\": \"What part of the conversation feels hardest right now?\"\n    }\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://your-agent-backend.example.com/api/v1/adk/message', [
  'body' => '{
  "session_id": "4d9e5ca0-628f-4f98-b6d7-92f6309d979f",
  "content": "Help me prepare for a difficult conversation with my manager.",
  "conversation_history": [
    {
      "role": "user",
      "content": "I need advice for a tough work conversation."
    },
    {
      "role": "assistant",
      "content": "What part of the conversation feels hardest right now?"
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://your-agent-backend.example.com/api/v1/adk/message");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"session_id\": \"4d9e5ca0-628f-4f98-b6d7-92f6309d979f\",\n  \"content\": \"Help me prepare for a difficult conversation with my manager.\",\n  \"conversation_history\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"I need advice for a tough work conversation.\"\n    },\n    {\n      \"role\": \"assistant\",\n      \"content\": \"What part of the conversation feels hardest right now?\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "session_id": "4d9e5ca0-628f-4f98-b6d7-92f6309d979f",
  "content": "Help me prepare for a difficult conversation with my manager.",
  "conversation_history": [
    [
      "role": "user",
      "content": "I need advice for a tough work conversation."
    ],
    [
      "role": "assistant",
      "content": "What part of the conversation feels hardest right now?"
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://your-agent-backend.example.com/api/v1/adk/message")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```