Quick Start

Get up and running with Sentrial in under 5 minutes.

Prerequisites

  • Python 3.8+ or Node.js 16+
  • A Sentrial account (sign up at sentrial.ai)
  • An API key from your project settings

1. Install the SDK

Python

pip install sentrial

# With LangChain integration
pip install sentrial[langchain]

TypeScript / Node.js

npm install @sentrial/sdk
# or
pnpm add @sentrial/sdk
# or
yarn add @sentrial/sdk

2. Initialize the Client

Python

from sentrial import SentrialClient

# Initialize client with your API key
client = SentrialClient(
    api_key="your-api-key-here",
    project_id="your-project-id"
)

# Create a session to track your agent
session_id = client.create_session(
    name="Customer Support Agent",
    metadata={"user_id": "user_123"}
)

TypeScript

import { SentrialClient } from '@sentrial/sdk';

// Initialize client with your API key
const client = new SentrialClient({
  apiKey: 'your-api-key-here',
  projectId: 'your-project-id'
});

// Create a session to track your agent
const sessionId = await client.createSession({
  name: 'Customer Support Agent',
  metadata: { userId: 'user_123' }
});

3. Track Your Agent

Choose your integration method based on your framework:

LangChain (Recommended)

The easiest way to get started. Just add our callback handler:

from sentrial import SentrialClient, SentrialCallbackHandler
from langchain.agents import AgentExecutor, create_react_agent

# Initialize Sentrial
client = SentrialClient(api_key="...", project_id="...")
session_id = client.create_session(name="My Agent")

# Create callback handler
handler = SentrialCallbackHandler(client, session_id)

# Use with your agent - that's it!
agent_executor = AgentExecutor(
    agent=agent,
    tools=tools,
    callbacks=[handler],  # 👈 Automatic tracking
    verbose=True
)

# Run your agent normally
result = agent_executor.invoke({
    "input": "Help user with password reset"
})

Manual Tracking

For custom agents, manually track events:

# Track agent reasoning
client.track_decision(
    session_id=session_id,
    reasoning="User needs password reset assistance",
    alternatives=["Direct reset", "Security questions"],
    confidence=0.85
)

# Track tool calls
client.track_tool_call(
    session_id=session_id,
    tool_name="search_kb",
    tool_input={"query": "password reset"},
    tool_output={"articles": ["KB-001"]},
    reasoning="Searching knowledge base"
)

# Track LLM calls
client.track_llm_call(
    session_id=session_id,
    prompt="Generate password reset email...",
    response="Dear user, here's how to reset...",
    model="gpt-4",
    tokens_used=150
)

4. View in Dashboard

Once your agent runs, view the execution in the Sentrial dashboard:

  1. Go to your dashboard
  2. Select your project
  3. Click on the session you just created
  4. Explore the timeline, tool calls, and reasoning steps