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
Task: Implement Log Endpoints for v4 API
Description
Create endpoints for querying log data from Clickhouse. These endpoints will replace the existing v2 endpoints that query log data from Supabase.
Requirements
- Implement endpoints for querying log data
- Ensure compatibility with the existing v2 endpoints
- Optimize queries for performance
- Implement filtering, sorting, and pagination
- Handle error cases
Endpoints to Implement
GET /v4/logs: Get a list of logsGET /v4/logs/{trace_id}: Get logs for a specific traceGET /v4/logs/search: Search for logs based on criteria
Implementation Details
- Create a new file at
agentops/api/routes/v4/logs.py - Use the Clickhouse client to query log data
- Implement filtering, sorting, and pagination
- Handle error cases
- Ensure compatibility with the existing v2 endpoints
Query Parameters
project_id: Filter by project IDtrace_id: Filter by trace IDstart_time: Filter by start timeend_time: Filter by end timeservice_name: Filter by service nameseverity_text: Filter by severity textseverity_number: Filter by severity numberbody_contains: Filter by log body contentlimit: Limit the number of resultsoffset: Offset for pagination
Response Format
- Return JSON responses with log data
- Include metadata for pagination
- Include links to related resources
Testing
- Create unit tests for the endpoints
- Test with real data in Clickhouse
- Test performance with large datasets
- Test error handling
Dependencies
- Clickhouse client implementation
- Authentication middleware
Estimated Time
6-8 hours