Traigent SDK Documentation¶
The first optimization platform that enhances your LLM applications without changing your code.

๐ Quick Start¶
Install the current Traigent SDK release with
pip install "traigent[recommended]", then run traigent onboard,
traigent auth device-login, traigent quickstart,
traigent first-prompt --agent claude|cursor|codex|copilot, or traigent mcp serve.
License: Traigent SDK is dual-licensed under
AGPL-3.0-only OR LicenseRef-Traigent-Commercial.
import litellm
import traigent
@traigent.optimize(
eval_dataset="examples/datasets/rag-optimization/evaluation_set.jsonl",
objectives=["accuracy", "cost"],
configuration_space={"model": ["gpt-4o-mini", "gpt-4o"], "temperature": [0.0, 0.7]},
)
def answer_question(question: str) -> str:
cfg = traigent.get_config() # Active trial/applied config
response = litellm.completion(
model=cfg.get("model"),
temperature=cfg.get("temperature"),
messages=[{"role": "user", "content": question}],
)
return response.choices[0].message.content
# Async-safe in Traigent
# results = await answer_question.optimize(max_trials=5)
๐ Documentation¶
๐ฏ Getting Started¶
- Installation - Install Traigent SDK
- Getting Started - Your first optimization in 5 minutes
- Minimum Integration - Smallest API/SDK surface to first successful trial
๐ User Guide¶
- Agent Optimization - Optimize AI agents and workflows
- Choosing Models - Select the right optimization model
- Injection Modes - Different ways to integrate Traigent
- Interactive Optimization - Real-time optimization workflows
- Evaluation Guide - Measure and improve performance
- Smart Optimization - Backend-routed smart optimizer strategies
๐งญ Guides¶
- Optimization Routing - Default smart optimization, local search, portal sync, and no-egress runs
- Evaluation - Evaluation best practices and troubleshooting
- Parallel Configuration - Concurrency settings and tuning
- Secrets Management - Securely manage API keys
๐ง API Reference¶
- Complete Function Specification - Full API documentation
- Interactive Optimizer - Hybrid optimization API surface
- Thread Pool Examples - Context propagation in threads
๐๏ธ Architecture¶
- System Architecture - How Traigent works internally
- Project Structure - Codebase organization
๐ค Contributing¶
- Contributing Guide - How to contribute to Traigent
- Code of Conduct - Community guidelines
- Security Policy - Security reporting and practices
๐ฏ What is Traigent?¶
Traigent is a zero-code optimization platform that automatically finds the best configurations for your LLM applications. Simply add a decorator to your existing functions, and Traigent will:
- ๐ฏ Optimize multiple objectives (accuracy, cost, speed, etc.)
- ๐ Test different configurations automatically
- ๐ Provide detailed analytics on performance
- ๐ Improve your applications without code changes
๐ก Key Features¶
- Zero Code Changes - Works with existing functions
- Multi-Objective Optimization - Balance accuracy, cost, and speed
- Framework Agnostic - Works with OpenAI, Anthropic, LangChain, and more
- Production Hardening Friendly - Structured for release validation and production deployment work
- Real-time Analytics - Monitor optimization progress live
๐ Examples Navigator¶
Use Examples Guide, Start Here, and Quick Reference for runnable examples.
๐งช Example Guides¶
- Examples Guide - How the example tree is organized
- Start Here - Fast path to the right example
- Quick Reference - Common commands and knobs
- Troubleshooting - Common example run issues
- API Patterns - Reusable example implementation patterns
๐ Next Steps¶
- Install Traigent - Get set up in minutes
- Follow the Getting Started Guide - Your first optimization
- Use the Example Guides - Start with Examples Guide
- Explore User Guides - Learn advanced features
- Check API Reference - Detailed technical documentation
๐งช Mock Mode (No API Keys)¶
- Enable:
TRAIGENT_MOCK_LLM=true(no API keys needed) - Benefits: realistic scores, zero cost, quick iteration
- Example:
TRAIGENT_MOCK_LLM=true python examples/core/rag-optimization/run.py- Or copy a command from the Examples Navigator "Run" icon
Need help? Check our guides above or reach out to the community!