Sentrial - Performance monitoring and observability for AI agents
Project description
Sentrial Python SDK
Complete observability platform for AI agents. Track performance, monitor KPIs, and debug agent workflows with time-travel capabilities.
Features
- Performance Monitoring: Track success rates, costs, duration, and custom KPIs
- Automatic Tracking: Capture agent reasoning, tool calls, and state changes
- AI-Powered Recommendations: Get optimization suggestions based on KPI gaps
- Custom Metrics: Define and track business-specific metrics
- Time Travel Debugging: Replay and debug past agent executions
- Framework Agnostic: Works with LangChain, custom agents, and more
- Visual Dashboard: Beautiful web interface to explore agent behavior
Installation
From PyPI
# Standard installation
pip install sentrial
# With LangChain integration
pip install sentrial[langchain]
# All integrations
pip install sentrial[all]
From GitHub
pip install git+https://github.com/neelshar/Sentrial.git#subdirectory=packages/python-sdk
Local Development
cd packages/python-sdk
pip install -e .
Quick Start
Basic Usage
from sentrial import SentrialClient
# Initialize client
client = SentrialClient(
api_url="https://api.sentrial.app", # Or your self-hosted URL
project_id="your-project-id"
)
# Create a session
session_id = client.create_session(name="Customer Support Agent")
# Track tool calls
client.track_tool_call(
session_id=session_id,
tool_name="search_knowledge_base",
tool_input={"query": "password reset"},
tool_output={"articles": ["KB-001", "KB-002"]},
reasoning="Searching for relevant articles"
)
# Track LLM decisions
client.track_decision(
session_id=session_id,
reasoning="User already tried KB solutions. Escalating to human support.",
alternatives=["Try another KB article", "Ask for more info"],
confidence=0.85
)
# Close session (basic)
client.close_session(session_id)
Performance Monitoring
Track KPIs and custom metrics:
from sentrial import SentrialClient
client = SentrialClient(
api_url="https://api.sentrial.app",
api_key="sentrial_live_xxx", # Get from dashboard
project_id="your-project-id"
)
# Create session
session_id = client.create_session(
name="Customer Support #1234",
agent_name="support_agent"
)
# ... agent does work ...
# Track LLM call with cost
input_tokens = 1500
output_tokens = 300
llm_cost = client.calculate_openai_cost("gpt-4", input_tokens, output_tokens)
# Complete session with performance metrics
client.complete_session(
session_id=session_id,
success=True, # Did agent achieve its goal?
estimated_cost=llm_cost, # Total cost in USD
custom_metrics={
"customer_satisfaction": 4.5, # Your custom KPIs
"order_value": 129.99,
"items_processed": 7,
"resolution_time_minutes": 8.5
}
)
Benefits:
- ✅ Automatic success rate tracking
- ✅ Cost per session monitoring
- ✅ Custom KPI dashboards
- ✅ AI-powered optimization recommendations
- ✅ Alerts when KPIs are violated
LangChain Integration
from sentrial import SentrialClient, SentrialCallbackHandler
from langchain.agents import AgentExecutor, create_react_agent
# Initialize Sentrial
client = SentrialClient(api_url="...", project_id="...")
session_id = client.create_session(name="LangChain Agent")
# Create callback handler
handler = SentrialCallbackHandler(client, session_id, verbose=True)
# Use with LangChain - automatic tracking!
agent_executor = AgentExecutor(
agent=agent,
tools=tools,
callbacks=[handler], # ← That's it!
verbose=True
)
result = agent_executor.invoke({"input": "Help user with login issue"})
The callback handler automatically tracks:
- Agent reasoning (Chain of Thought)
- Tool calls (inputs & outputs)
- Tool errors
- Agent completion
Examples
- simple_agent.py - Basic agent tracking
- langchain_agent.py - Full LangChain integration
Documentation
Support
- Email: support@sentrial.ai
- Discord: Join our community
- Issues: GitHub Issues
License
MIT License - see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sentrial-0.2.0.tar.gz.
File metadata
- Download URL: sentrial-0.2.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4af91591cf03eae99679e9b27f9b81d990ecdc49b366a059c2657cece9ae0eda
|
|
| MD5 |
1cd791fe43d87fccc97707d47f6a88a1
|
|
| BLAKE2b-256 |
d6b20c6754163e66723ad76d926d8dcc476d6e272939c62735172ec2ba1cb618
|
File details
Details for the file sentrial-0.2.0-py3-none-any.whl.
File metadata
- Download URL: sentrial-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5fbf435e4d41171a29a0d7d2843637ce92030d5280aaba56187225e7730f159
|
|
| MD5 |
fc57d10185c02677c903755219aebfdd
|
|
| BLAKE2b-256 |
da25daad743a6b7ae9b338673bf454a136a10d62cc6a0729710140e80c67f71e
|