Python SDK for AI agent monitoring, LLM cost tracking, benchmarking, and more. Integrates with most LLMs and agent frameworks including CrewAI, Agno, OpenAI Agents SDK, Langchain, Autogen, AG2, and CamelAI
Python agentagentopsagents-sdkaianthropicautogencost-estimationcrewaievalsevaluation-metricsgroqlangchainllmmistralollamaopenaiopenai-agents
docs: add session data export endpoint documentation (#594)
devin-ai-integration[bot]f844e0a8e60c
diff --git a/docs/v1/concepts/sessions.mdx b/docs/v1/concepts/sessions.mdxindex 68beaf02..ec98cb7f 100644--- a/docs/v1/concepts/sessions.mdx+++ b/docs/v1/concepts/sessions.mdx@@ -94,8 +94,66 @@ agentops.init(inherited_session_id=<id>)Both processes will now contribute data to the same session.+## Session Data Export+AgentOps provides REST endpoints to export your session data and statistics. These endpoints allow you to retrieve detailed information about your sessions programmatically.++### Authentication+All data export requests require a single header:+- `X-Agentops-Api-Key`: Your AgentOps API key++### Available Endpoints++#### Get Session Statistics+```http+GET /v2/sessions/<session_id>/stats+```++Returns statistics for the specified session including:+- Event counts+- Duration+- Costs+- Token usage+- Other session metrics++#### Export Complete Session Data+```http+GET /v2/sessions/<session_id>/export+```++Returns comprehensive session data including:+- Session metadata+- Statistics+- All recorded events:+ - Actions+ - LLM calls+ - Tool usage+ - Errors++### Example Usage+```python+import requests++# Your AgentOps API key+api_key = "your-api-key"+session_id = "your-session-id"++headers = {+ "X-Agentops-Api-Key": api_key+}++# Get session stats+stats_url = f"https://api.agentops.ai/v2/sessions/{session_id}/stats"+stats_response = requests.get(stats_url, headers=headers)+stats = stats_response.json()++# Export complete session data+export_url = f"https://api.agentops.ai/v2/sessions/{session_id}/export"+export_response = requests.get(export_url, headers=headers)+session_data = export_response.json()+```+## Session Analytics-You can retrieve the analytics for a session by calling `session.get_analytics()`.+You can retrieve the analytics for a session by calling `session.get_analytics()`.The example below shows how to record events and retrieve analytics.@@ -127,4 +185,4 @@ be applied. You can also apply different configuration options when you start a[Configuration](/v1/usage/sdk-reference/#configuration) object.<script type="module" src="/scripts/github_stars.js"></script>-<script type="module" src="/scripts/adjust_api_dynamically.js"></script>\ No newline at end of file+<script type="module" src="/scripts/adjust_api_dynamically.js"></script>