Synchronously invoke an agent
POST https://api.run-agent.ai/v1/agents/{agent_id}/invoke Content-Type: application/json Authorization: Bearer YOUR_API_KEY
Show properties
curl -X POST https://api.run-agent.ai/v1/agents/agent-123/invoke \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "What is the weather like in San Francisco?" }'
{ "query": "Write a story about AI", "parameters": { "temperature": 0.8, "max_tokens": 500, "style": "science fiction" }, "session_id": "user-123-session" }
{ "result": { "answer": "The weather in San Francisco is currently 65°F with partly cloudy skies.", "confidence": 0.95, "sources": ["current_weather_api"] }, "usage": { "prompt_tokens": 24, "completion_tokens": 18, "total_tokens": 42 }, "metadata": { "execution_time": 1.23, "agent_version": "1.0.0", "request_id": "req_abc123" } }
{ "error": { "code": "MISSING_REQUIRED_FIELD", "message": "Field 'query' is required", "status": 400 } }
{ "error": { "code": "AGENT_NOT_FOUND", "message": "Agent 'agent-123' not found", "status": 404 } }
{ "error": { "code": "RATE_LIMIT_EXCEEDED", "message": "Too many requests", "status": 429, "retry_after": 60 } }