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

# Test Agent

POST https://api.signalcore.ai/api/v1/agents/{agent_id}/test
Content-Type: application/json

Test an agent's responses without sending real messages. Useful for validating prompt configuration and tool behavior before deployment. Use the same `session_id` across requests to maintain conversation context.

Reference: https://docs.signalcore.ai/api-reference/testing/test-agent

## Authentication

- `X-API-Key` header (required) — Your API key from [Dashboard → Settings → API Keys](https://dashboard.signalcore.ai/settings)

## Servers

- `https://api.signalcore.ai/api/v1` (Producción, default)
- `https://staging.api.signalcore.ai/api/v1` (Staging)

## Request

### Path parameters

- `agent_id` (string, required) — Agent ID to test

### Body (application/json)

This endpoint expects a TestAgentRequest.

- `message` (string, required) — The test message to send to the agent
- `channel` (enum, optional, default: sms) — Channel to simulate. Determines which channel profile's configuration and tools are used.
  - Allowed values: `sms`, `whatsapp`, `instagram`, `gmail`, `outlook`, `linkedin`, `voice`, `imessage`
- `session_id` (string, optional) — Session ID for conversation continuity. Omit to start a new conversation, provide to continue an existing one.

## Response

### 200

Agent response

- `response` (string, optional) — The agent's generated response
- `session_id` (string, optional) — Session ID for this conversation. Use in subsequent requests to maintain context.
- `conversation_history` (list of TestAgentResponseConversationHistoryItems, optional) — Full conversation history for this session
- `tool_calls` (list of TestAgentResponseToolCallsItems, optional) — Tools called by the agent during response generation
- `usage` (TestAgentResponseUsage, optional) — Token usage statistics

## Errors

### 404 Not Found Error

Agent not found

- `any`

## Types

### TestAgentResponseConversationHistoryItems

- `role` (enum, optional)
  - Allowed values: `user`, `assistant`
- `content` (string, optional)
- `timestamp` (double, optional)
- `tool_calls` (list of TestAgentResponseConversationHistoryItemsToolCallsItems, optional)

### TestAgentResponseToolCallsItems

- `function` (TestAgentResponseToolCallsItemsFunction, optional)

### TestAgentResponseUsage

Token usage statistics

- `prompt_tokens` (integer, optional)
- `completion_tokens` (integer, optional)
- `total_tokens` (integer, optional)

### TestAgentResponseConversationHistoryItemsToolCallsItems

### TestAgentResponseToolCallsItemsFunction

- `name` (string, optional)
- `arguments` (string, optional)

## Examples

### Continue existing conversation

**Request**

```json
{
  "message": "What are your pricing options?",
  "channel": "sms",
  "session_id": "550e8400-e29b-41d4-a716-446655440000"
}
```

**Response**

```json
{
  "response": "Our pricing plans start at $29/month for basic features, with premium options available for larger teams. Would you like me to send you a detailed brochure?",
  "session_id": "550e8400-e29b-41d4-a716-446655440000",
  "conversation_history": [
    {
      "role": "user",
      "content": "What are your pricing options?",
      "timestamp": 1687000000.5,
      "tool_calls": []
    },
    {
      "role": "assistant",
      "content": "Our pricing plans start at $29/month for basic features, with premium options available for larger teams. Would you like me to send you a detailed brochure?",
      "timestamp": 1687000001,
      "tool_calls": []
    }
  ],
  "tool_calls": [
    {
      "function": {
        "name": "fetchPricingDetails",
        "arguments": "{\"plan\":\"all\"}"
      }
    }
  ],
  "usage": {
    "prompt_tokens": 15,
    "completion_tokens": 40,
    "total_tokens": 55
  }
}
```

**SDK Code**

```python Continue existing conversation
import requests

url = "https://api.signalcore.ai/api/v1/agents/agent_id/test"

payload = {
    "message": "What are your pricing options?",
    "channel": "sms",
    "session_id": "550e8400-e29b-41d4-a716-446655440000"
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Continue existing conversation
const url = 'https://api.signalcore.ai/api/v1/agents/agent_id/test';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"message":"What are your pricing options?","channel":"sms","session_id":"550e8400-e29b-41d4-a716-446655440000"}'
};

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

```go Continue existing conversation
package main

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

func main() {

	url := "https://api.signalcore.ai/api/v1/agents/agent_id/test"

	payload := strings.NewReader("{\n  \"message\": \"What are your pricing options?\",\n  \"channel\": \"sms\",\n  \"session_id\": \"550e8400-e29b-41d4-a716-446655440000\"\n}")

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

	req.Header.Add("X-API-Key", "<apiKey>")
	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 Continue existing conversation
require 'uri'
require 'net/http'

url = URI("https://api.signalcore.ai/api/v1/agents/agent_id/test")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"message\": \"What are your pricing options?\",\n  \"channel\": \"sms\",\n  \"session_id\": \"550e8400-e29b-41d4-a716-446655440000\"\n}"

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

```java Continue existing conversation
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.signalcore.ai/api/v1/agents/agent_id/test")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"message\": \"What are your pricing options?\",\n  \"channel\": \"sms\",\n  \"session_id\": \"550e8400-e29b-41d4-a716-446655440000\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.signalcore.ai/api/v1/agents/agent_id/test', [
  'body' => '{
  "message": "What are your pricing options?",
  "channel": "sms",
  "session_id": "550e8400-e29b-41d4-a716-446655440000"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp Continue existing conversation
using RestSharp;

var client = new RestClient("https://api.signalcore.ai/api/v1/agents/agent_id/test");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"message\": \"What are your pricing options?\",\n  \"channel\": \"sms\",\n  \"session_id\": \"550e8400-e29b-41d4-a716-446655440000\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Continue existing conversation
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "message": "What are your pricing options?",
  "channel": "sms",
  "session_id": "550e8400-e29b-41d4-a716-446655440000"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.signalcore.ai/api/v1/agents/agent_id/test")! 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()
```

### Example 2

**Request**

```json
{
  "message": "What are your pricing options?",
  "channel": "sms",
  "session_id": "550e8400-e29b-41d4-a716-446655440000"
}
```

**Response**

```json
{
  "response": "Our pricing plans start at $29/month for basic features, with premium options available for larger teams. Would you like me to send you a detailed brochure?",
  "session_id": "550e8400-e29b-41d4-a716-446655440000",
  "conversation_history": [
    {
      "role": "user",
      "content": "What are your pricing options?",
      "timestamp": 1687000000.5,
      "tool_calls": []
    },
    {
      "role": "assistant",
      "content": "Our pricing plans start at $29/month for basic features, with premium options available for larger teams. Would you like me to send you a detailed brochure?",
      "timestamp": 1687000001,
      "tool_calls": []
    }
  ],
  "tool_calls": [
    {
      "function": {
        "name": "fetchPricingDetails",
        "arguments": "{\"plan\":\"all\"}"
      }
    }
  ],
  "usage": {
    "prompt_tokens": 15,
    "completion_tokens": 40,
    "total_tokens": 55
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.signalcore.ai/api/v1/agents/agent_id/test"

payload = {
    "message": "What are your pricing options?",
    "channel": "sms",
    "session_id": "550e8400-e29b-41d4-a716-446655440000"
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.signalcore.ai/api/v1/agents/agent_id/test';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"message":"What are your pricing options?","channel":"sms","session_id":"550e8400-e29b-41d4-a716-446655440000"}'
};

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://api.signalcore.ai/api/v1/agents/agent_id/test"

	payload := strings.NewReader("{\n  \"message\": \"What are your pricing options?\",\n  \"channel\": \"sms\",\n  \"session_id\": \"550e8400-e29b-41d4-a716-446655440000\"\n}")

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

	req.Header.Add("X-API-Key", "<apiKey>")
	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://api.signalcore.ai/api/v1/agents/agent_id/test")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"message\": \"What are your pricing options?\",\n  \"channel\": \"sms\",\n  \"session_id\": \"550e8400-e29b-41d4-a716-446655440000\"\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://api.signalcore.ai/api/v1/agents/agent_id/test")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"message\": \"What are your pricing options?\",\n  \"channel\": \"sms\",\n  \"session_id\": \"550e8400-e29b-41d4-a716-446655440000\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.signalcore.ai/api/v1/agents/agent_id/test', [
  'body' => '{
  "message": "What are your pricing options?",
  "channel": "sms",
  "session_id": "550e8400-e29b-41d4-a716-446655440000"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.signalcore.ai/api/v1/agents/agent_id/test");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"message\": \"What are your pricing options?\",\n  \"channel\": \"sms\",\n  \"session_id\": \"550e8400-e29b-41d4-a716-446655440000\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "message": "What are your pricing options?",
  "channel": "sms",
  "session_id": "550e8400-e29b-41d4-a716-446655440000"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.signalcore.ai/api/v1/agents/agent_id/test")! 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()
```