Description API
SGR Agent Core provides a comprehensive REST API that is fully compatible with OpenAI's API format, making it easy to integrate with existing applications.
🔍 Base URL
🔍 Authentication
No authentication required for local development. For production deployments, configure authentication as needed.
🏥 Health Check - Check API status and availability
## 🔍 GET `/health` Check if the API is running and healthy. **Response:** **Example:**🤖 Available Models - Get list of supported agent models
## 🔍 GET `/v1/models` Retrieve a list of available agent models. **Response:** **Available Models:** - `sgr-agent` - Pure SGR (Schema-Guided Reasoning) - `sgr-tools-agent` - SGR + Function Calling hybrid - `sgr-auto-tools-agent` - SGR + Auto Function Calling - `sgr-so-tools-agent` - SGR + Structured Output - `tools-agent` - Pure Function Calling **Example:**💬 Chat Completions - Main research endpoint with streaming support
## 🔍 POST `/v1/chat/completions` Create a chat completion for research tasks. This is the main endpoint for interacting with SGR agents. **Request Body:**{
"model": "sgr-agent",
"messages": [
{
"role": "user",
"content": "Research BMW X6 2025 prices in Russia"
}
],
"stream": true,
"max_tokens": 1500,
"temperature": 0.4
}
curl -X POST "http://localhost:8010/v1/chat/completions" \
-H "Content-Type: application/json" \
-d '{
"model": "sgr-agent",
"messages": [{"role": "user", "content": "Research AI market trends"}],
"stream": true,
"temperature": 0
}'
curl -X POST "http://localhost:8010/v1/chat/completions" \
-H "Content-Type: application/json" \
-d '{
"model": "sgr-agent",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "Analyze this chart and research the trends"},
{"type": "image_url", "image_url": {"url": "https://example.com/chart.png"}}
]
}],
"stream": true
}'
curl -X POST "http://localhost:8010/v1/chat/completions" \
-H "Content-Type: application/json" \
-d '{
"model": "sgr-agent",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "What is shown in this image?"},
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,/9j/4AAQSkZJRg..."}}
]
}],
"stream": true
}'
📋 Agent Management - List and monitor active agents
## 🔍 GET `/agents` Get a list of all active agents. **Response:** **Agent States:** - `INITED` - Agent initialized - `RESEARCHING` - Agent is actively researching - `WAITING_FOR_CLARIFICATION` - Agent needs clarification - `COMPLETED` - Research completed **Example:**🔍 Agent State - Get detailed information about a specific agent
## 🔍 GET `/agents/{agent_id}/state` Get detailed state information for a specific agent. **Response:**{
"agent_id": "sgr_agent_12345-67890-abcdef",
"task_messages": [
{
"role": "user",
"content": "Research BMW X6 2025 prices"
}
],
"state": "RESEARCHING",
"iteration": 3,
"searches_used": 2,
"clarifications_used": 0,
"sources_count": 5,
"current_step_reasoning": {
"action": "web_search",
"query": "BMW X6 2025 price Russia",
"reason": "Need current market data"
}
}