Python SDK
The TurnWise Python SDK allows you to run evaluations programmatically using your own LLM API keys, while automatically syncing results to the TurnWise platform.Why Use the SDK?
Use Your Own API Keys
Run evaluations locally with your OpenRouter or other LLM provider keys
Programmatic Control
Integrate evaluations into your CI/CD pipelines and automation workflows
Cost Control
Pay only for LLM API calls, not for TurnWise compute resources
Automatic Sync
Results automatically sync to TurnWise web UI for visualization
Key Features
- Local Evaluation: Run evaluations on your machine using your API keys
- Template Variables: Use
@VARIABLEsyntax for context-aware prompts - Multiple Levels: Evaluate at conversation, message, or step level
- Structured Outputs: Support for text, number, checkbox, progress, and custom JSON schemas
- Batch Processing: Evaluate multiple conversations concurrently
- Goal Extraction: Automatically extracts user goals from conversations
- Progress Tracking: Real-time progress callbacks during evaluation
Installation
Quick Start
Architecture
The SDK consists of several components:- TurnWiseClient: Main client for API communication and high-level evaluation
- EvaluationOrchestrator: Lower-level orchestrator for manual control
- OpenRouterProvider: LLM provider for making API calls
- GoalAgent: Extracts user goals from conversations
- EvaluationAgent: Executes individual evaluations