Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.agnost.ai/llms.txt

Use this file to discover all available pages before exploring further.

Install

pip install agnost

Integrate

import agnost

agnost.init("your-org-id")
Get your org ID from app.agnost.ai.

Track interactions

interaction = agnost.begin(user_id="u-123", agent_name="my-agent", input="...")
# ... your AI call ...
interaction.end(output="...")
Latency is auto-calculated. For errors:
interaction.end(output="Error: timeout", success=False)
For simple fire-and-forget cases:
agnost.track(user_id="u-123", input="...", output="...", agent_name="my-agent")

Group into conversations

import uuid

conversation_id = str(uuid.uuid4())

agnost.track(user_id="u-123", input="Hello", output="Hi!", conversation_id=conversation_id)
agnost.track(user_id="u-123", input="Follow-up", output="Sure!", conversation_id=conversation_id)

Identify users

agnost.identify("u-123", {"name": "Alice", "email": "[email protected]", "plan": "pro"})

Custom properties

interaction = agnost.begin(user_id="u-123", agent_name="my-agent", input="...")

# Set one at a time
interaction.set_property("model", "gpt-4")

# Or set many at once
interaction.set_properties({"tokens": 150, "cost": 0.045})

interaction.end(output="...")

Configuration

agnost.init("your-org-id", endpoint="https://api.agnost.ai", debug=True)
ParameterTypeDefaultDescription
org_idstrYour org ID
endpointstrhttps://api.agnost.aiAPI endpoint
debugboolFalseEnable debug logging

Cleanup

agnost.shutdown()  # flushes and cleans up