> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trainlyai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Trainly Documentation

> The observability platform for agentic workflows. Trace every AI interaction, detect anomalies, and understand what changed.

# Trainly

The observability platform for agentic workflows.

Trainly gives you full visibility into how your AI systems behave in production. Add a single decorator to your code and get tracing, scoring, anomaly detection, and version control — automatically.

## Why Trainly

<CardGroup cols={3}>
  <Card title="Trace" icon="route">
    Capture inputs, outputs, latency, tokens, and cost with a single `@observe` decorator. No config needed.
  </Card>

  <Card title="Detect" icon="magnifying-glass-chart">
    Surface unusual patterns and behavioral changes across your AI interactions automatically.
  </Card>

  <Card title="Understand" icon="lightbulb">
    Get plain-language explanations of what changed and why — no log-diving required.
  </Card>
</CardGroup>

## Get started in 5 lines

<CodeGroup>
  ```python Python theme={null}
  from trainly import TrainlyClient
  from openai import OpenAI

  client = TrainlyClient(api_key="tk_...", project_id="proj_...")
  openai_client = OpenAI()

  @client.observe(model="gpt-4o", tags=["production"])
  def ask(question: str) -> str:
      response = openai_client.chat.completions.create(
          model="gpt-4o",
          messages=[{"role": "user", "content": question}]
      )
      return response.choices[0].message.content

  # Every call is now traced automatically
  result = ask("What is AI observability?")
  ```

  ```typescript React theme={null}
  import { TrainlyProvider, useTrainlyObserve } from '@trainly/react';

  function App() {
    return (
      <TrainlyProvider projectId="proj_..." apiKey="tk_...">
        <MyComponent />
      </TrainlyProvider>
    );
  }

  function MyComponent() {
    const { trace } = useTrainlyObserve({ model: 'gpt-4o' });

    async function handleQuery() {
      const output = await callMyAI("Hello");
      await trace("Hello", output, { tags: ['demo'] });
    }

    return <button onClick={handleQuery}>Ask AI</button>;
  }
  ```
</CodeGroup>

## Explore the docs

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Trace your first AI call in under 5 minutes.
  </Card>

  <Card title="Python SDK" icon="python" href="/python-sdk">
    Full guide to the @observe decorator, sessions, spans, and scoring.
  </Card>

  <Card title="React SDK" icon="react" href="/react-sdk">
    useTrainlyObserve hook, session providers, and pre-built components.
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/introduction">
    REST API for trace ingestion, analytics, testing, and version management.
  </Card>
</CardGroup>
