Installation
Install the SDK using pip or uv:Quick Start
Initialize the SDK
Import and initialize with your organization ID from the Agnost AI dashboard:Track AI Interactions
Primary Method: begin() and end()
The recommended way to track AI interactions is using begin() to start tracking and end() to complete.
begin() Parameters:
set_input() if needed.
end() - Success Case:
When your AI processing completes successfully, call end() with the output. Latency is automatically calculated:
end() - Error Case:
When your AI processing fails, pass success=False and include the error message in the output:
Identify Users
Associate user characteristics for better analytics:identify() once per user to enrich your analytics with user traits like name, email, plan, or any custom attributes.
Custom Properties
Track additional metadata like model parameters, costs, or custom fields usingset_property() or set_properties():
Manual Latency Tracking
By default, latency is automatically calculated frombegin() to end(). You can override this if needed:
Cleanup
Ensure all events are sent before your application exits:Complete Example
Here’s a full example of a chatbot with conversation tracking:What’s Next?
- View your analytics in the Agnost AI dashboard
- Explore the Configuration Guide for advanced options
- Check out the Python SDK Guide for detailed examples
- Join our Discord community
Need Help?
- Contact us at [email protected]
- Book a call for personalized support
