Skip to main content

Base URL

https://api.sentrial.com

Create Event

sessionId
string
required
ID of the parent session.
eventType
string
required
"tool_call", "llm_decision", "state_change", or "error".
toolName
string
Name of the tool called (for tool_call events).
toolInput
object
Input passed to the tool.
toolOutput
object
Output returned by the tool.
reasoning
string
Agent’s reasoning for this action.
alternativesConsidered
array
Other options the agent considered.
confidence
number
Confidence score (0.0 to 1.0).
estimatedCost
number
Cost for this event in USD.

Request

POST /api/sdk/events
{
  "sessionId": "sess_abc123def456",
  "eventType": "tool_call",
  "toolName": "search_kb",
  "toolInput": {
    "query": "password reset"
  },
  "toolOutput": {
    "results": ["KB-001", "KB-002"]
  },
  "reasoning": "User needs password help",
  "estimatedCost": 0.001
}

Response

{
  "id": "evt_xyz789",
  "sessionId": "sess_abc123def456",
  "eventType": "tool_call",
  "toolName": "search_kb",
  "createdAt": "2025-01-12T10:30:01Z"
}

Event Types

tool_call

Track when your agent calls a tool.
{
  "sessionId": "sess_abc123def456",
  "eventType": "tool_call",
  "toolName": "search_knowledge_base",
  "toolInput": {
    "query": "how to reset password"
  },
  "toolOutput": {
    "results": ["KB-001", "KB-002"],
    "count": 2
  },
  "reasoning": "User asked about password reset",
  "estimatedCost": 0.001
}

llm_decision

Track agent decision points.
{
  "sessionId": "sess_abc123def456",
  "eventType": "llm_decision",
  "reasoning": "User needs password help. Will search KB first before escalating.",
  "alternativesConsidered": [
    "escalate_to_human",
    "ask_clarifying_question"
  ],
  "confidence": 0.92,
  "estimatedCost": 0.0015
}

cURL Examples

Tool Call Event

curl -X POST https://api.sentrial.com/api/sdk/events \
  -H "Authorization: Bearer sentrial_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "sess_abc123def456",
    "eventType": "tool_call",
    "toolName": "search_kb",
    "toolInput": {"query": "password reset"},
    "toolOutput": {"results": ["KB-001"]}
  }'

Decision Event

curl -X POST https://api.sentrial.com/api/sdk/events \
  -H "Authorization: Bearer sentrial_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "sess_abc123def456",
    "eventType": "llm_decision",
    "reasoning": "Will search KB before escalating",
    "alternativesConsidered": ["escalate", "clarify"],
    "confidence": 0.92
  }'

Error Codes

CodeTitleDescription
400Bad RequestMissing required fields or invalid event type
401UnauthorizedInvalid or missing API key
404Not FoundSession ID not found
500Internal Server ErrorServer error, please retry

Next Steps