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 Clickhouse Client
Description
Create a Clickhouse client implementation for connecting to the Clickhouse database. This client will be used by the v4 endpoints to query trace, log, and metric data.
Requirements
- Implement an async Clickhouse client using the
clickhouse-driverpackage - Create connection pooling to efficiently manage database connections
- Implement error handling and retry mechanisms
- Create utility functions for common query patterns
- Ensure proper configuration from environment variables
Implementation Details
- Create a new file at
agentops/api/db/clickhouse_client.py - Use environment variables for connection details (host, port, username, password, database)
- Implement connection pooling to efficiently manage connections
- Create utility functions for common query patterns (e.g., querying traces, logs, metrics)
- Implement error handling and retry mechanisms
Environment Variables
CLICKHOUSE_HOST: Clickhouse server hostnameCLICKHOUSE_PORT: Clickhouse server portCLICKHOUSE_USER: Clickhouse usernameCLICKHOUSE_PASSWORD: Clickhouse passwordCLICKHOUSE_DATABASE: Clickhouse database name (default: otel)
Dependencies
- Add
clickhouse-driverto the project dependencies inpyproject.toml
Testing
- Create unit tests for the client implementation
- Test connection to the Clickhouse database
- Test query execution and result parsing
Estimated Time
4-6 hours