Basic Configuration
Initialize the SDK with your organization ID (passed positionally aswrite_key):
Configuration Options
SDK Initialization (agnost.init)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
org_id | str | Required | - | Your organization ID from the Agnost AI dashboard |
debug | bool | No | False | Enable debug logging for troubleshooting |
Begin/End Tracking (agnost.begin)
Start interaction with agnost.begin():| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
user_id | str | No | "" | Identifier for the user |
agent_name | str | No | "default" | Name of the AI agent or model |
input | str | No | None | Input text or prompt (can also set later with set_input()) |
conversation_id | str | No | None | ID to group related messages in a conversation |
properties | dict | No | None | Additional metadata as key-value pairs |
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
output | str | No | None | Output or response from the AI agent |
success | bool | No | True | Whether the interaction was successful |
latency | int | No | Auto-calculated | Execution time in milliseconds (auto-calculated from begin time if not provided) |
User Identification (agnost.identify)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
user_id | str | Required | : | Identifier for the user |
traits | dict | Required | : | User characteristics (e.g., name, email, plan, role) |
Interaction methods
agnost.begin() returns an Interaction object with these methods:
| Method | Signature | Description |
|---|---|---|
set_input | (text: str) | Set the input text after the interaction has begun. |
set_property | (key: str, value: Any) | Set a single property. Returns the interaction for chaining. |
set_properties | (properties: dict) | Merge multiple properties at once. Returns the interaction for chaining. |
end | (output=None, success=True, latency=None, **extra) | Complete the interaction and send the event. Latency auto-calculated if not supplied. |
Lifecycle
| Function | Description |
|---|---|
agnost.flush() | Manually flush all queued events (non-blocking). |
agnost.shutdown() | Flush remaining events and release resources. Called automatically on process exit. |
agnost.set_debug_logs(enabled) | Toggle debug logs after initialization. |
Debug Mode
Enable debug mode to see detailed logging of SDK operations:Next Steps
- Learn about tracking AI interactions
- See the Quickstart for end-to-end setup
