Skip to content

Traigent SDK Documentation

The first optimization platform that enhances your LLM applications without changing your code.

Traigent Logo

๐Ÿš€ 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

๐Ÿ“– User Guide

๐Ÿงญ Guides

๐Ÿ”ง API Reference

๐Ÿ—๏ธ Architecture

๐Ÿค Contributing

๐ŸŽฏ 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

๐Ÿš€ Next Steps

  1. Install Traigent - Get set up in minutes
  2. Follow the Getting Started Guide - Your first optimization
  3. Use the Example Guides - Start with Examples Guide
  4. Explore User Guides - Learn advanced features
  5. 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!