To send a message to the API, you'll need to make a POST request to the /message endpoint with a JSON body containing a message field.
POST /message HTTP/1.1
Host: localhost:8000
Content-Type: application/json
{
"message": "Your message goes here"
}curl -X POST http://localhost:8000/message \
-H "Content-Type: application/json" \
-d '{"message": "What is the weather in Paris?"}'import requests
response = requests.post(
"http://localhost:8000/message",
json={"message": "Tell me about machine learning"}
)
print(response.json())The API will respond with a JSON object containing either:
{
"response": {
"messages": [
{
"content": "The detailed answer to your question...",
"type": "ai",
"tool_calls": [],
"tool_call_id": null
}
],
"return_values": {
"output": "Final answer from the agent..."
}
},
"status": "success"
}The response format follows LangGraph's structure:
messages: Contains the conversation history and agent's reasoningreturn_values.output: Contains the final answer
If an error occurs, the API will return:
{
"detail": {
"error": "Error message describing what went wrong",
"traceback": "Detailed error information (only in DEBUG_MODE)"
}
}Common error status codes:
503: Ollama model is not available500: Error processing the request or running the agent
To retrieve a list of all available tools without invoking the agent:
GET /tools HTTP/1.1
Host: localhost:8000Response:
{
"status": "success",
"count": 14,
"tools": [
{
"name": "math_add",
"description": "Add two numbers",
"parameters": "{'a': 'first number', 'b': 'second number'}"
}
],
"server_config": {
"math": { /* server configuration */ },
"joke": { /* server configuration */ },
"gatherings": { /* server configuration */ }
}
}To check if the API is running:
GET /health HTTP/1.1
Host: localhost:8000Response:
{
"status": "ok"
}{
"message": "What's the capital of France?"
}{
"response": {
"messages": [
{
"content": "The capital of France is Paris.",
"type": "ai",
"tool_calls": [],
"tool_call_id": null
}
],
"return_values": {
"output": "The capital of France is Paris."
}
},
"status": "success"
}