Skip to main content

When to Use Manual Tracking

Custom Frameworks

Building with a custom agent framework, not LangChain.

Raw OpenAI/Anthropic

Using the OpenAI or Anthropic SDKs directly.

Specific Events

Only want to track certain events, not everything.

Non-Python

Using JavaScript/TypeScript or another language.

Basic Pattern

The simple begin/finish pattern works for most use cases:

Full Control Pattern

For more granular tracking, use the SentrialClient directly:

Tracking Tool Calls

Wrap your tool functions to automatically track them:

TypeScript Example

Best Practices

Call complete_session() or finish() even on errors to ensure data is recorded.
Focus on tool calls and decisions, not every line of code.
When success=False, always include failure_reason for better diagnosis.
Same agent_name groups sessions together in the dashboard.
Use the cost calculation helpers or track real token usage.

Next Steps

Python SDK Reference

Complete API documentation.

Sessions & Tracking

Learn about session structure.