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

# Insights Overview

> Automatically monitor AI quality and behavior in production. Discover user intents, detect drift across cost, latency, tool usage, and more - without writing rules.

Insights is Netra's automated quality and behavior monitoring layer for AI applications. It learns what normal looks like for your agent from real production traffic, then continuously surfaces changes - new user intents, shifts in tool usage, latency creep, rising error rates.

## How Insights Works

Insights operates on the trace data flowing through Netra. Once your application is instrumented, Insights runs in the background to:

1. **Discover and classify user intents** from real traffic
2. **Build rolling baselines** of normal behavior per intent
3. **Detect drift** across cost, latency, step count, error rate, tool usage, and output length
4. **Generate a brief** summarizing significant changes after each observation run

No rule configuration required. Insights ships with calibrated defaults for all metrics.

## Rolling Baselines

Insights builds a baseline automatically from the last 30 days of traffic, refreshed daily. The baseline holds per-intent statistics - average cost, latency, step count, error rate, output length, and tool distribution - against which every drift observation is measured.

No manual baseline tagging is required.

## Brief

After each observation run, Insights generates a short summary of the most significant drifts and new intents detected during that cycle. The brief gives you a digest you can scan in seconds rather than a wall of metrics.

## Setting Up Insights

Insights runs on your trace data. Instrument your application with the Netra SDK and Insights activates automatically once traces start flowing.

<Steps>
  <Step title="Install the SDK">
    <CodeGroup>
      ```bash pip theme={null}
      pip install netra-sdk
      ```

      ```bash npm theme={null}
      npm install netra-sdk
      ```
    </CodeGroup>
  </Step>

  <Step title="Initialize Netra">
    <CodeGroup>
      ```python Python theme={null}
      from netra import Netra
      from netra.instrumentation.instruments import InstrumentSet

      Netra.init(
          app_name="my-ai-agent",
          environment="production",
          headers=f"x-api-key={os.getenv('NETRA_API_KEY')}",
          instruments={InstrumentSet.OPENAI, InstrumentSet.ANTHROPIC},
      )
      ```

      ```typescript TypeScript theme={null}
      import { Netra, NetraInstruments } from "netra-sdk";

      await Netra.init({
        appName: "my-ai-agent",
        environment: "production",
        headers: `x-api-key=${process.env.NETRA_API_KEY}`,
        instruments: new Set([NetraInstruments.OPENAI, NetraInstruments.ANTHROPIC]),
      });
      ```
    </CodeGroup>
  </Step>

  <Step title="Instrument your workflows">
    Use Netra's decorators so Insights can compute per-intent metrics at the workflow, agent, and task level.

    <CodeGroup>
      ```python Python theme={null}
      from netra.decorators import workflow, agent, task

      @agent
      class SupportAgent:
          @workflow
          def handle_query(self, query: str) -> str:
              ...

          @task
          def fetch_account(self, user_id: str):
              ...
      ```

      ```typescript TypeScript theme={null}
      import { workflow, agent, task } from "netra-sdk";

      class SupportAgent {
        @workflow()
        async handleQuery(query: string): Promise<string> {
          // ...
        }

        @task()
        async fetchAccount(userId: string) {
          // ...
        }
      }
      ```
    </CodeGroup>
  </Step>

  <Step title="Let Insights learn">
    Once traces start flowing, Insights handles the rest automatically:

    * After \~500 traces, intent clusters are bootstrapped and classification begins for every new trace
    * A rolling 30-day baseline is built and refreshed daily
    * Drift observations run on daily, weekly, and monthly windows
    * A brief is generated after each observation cycle
  </Step>
</Steps>

<Info>
  Insights requires no additional configuration beyond standard SDK instrumentation. All analysis runs against trace data already captured by Netra.
</Info>

## Learn More

<CardGroup cols={2}>
  <Card title="Intents" icon="list-check" href="/Insights/Intents">
    Discover and track what your users are actually asking
  </Card>

  <Card title="Drifts" icon="chart-line" href="/Insights/Drifts">
    Detect behavior changes before users notice them
  </Card>

  <Card title="Traces Overview" icon="route" href="/Observability/Traces/overview">
    Understand how Netra captures the trace data that powers Insights
  </Card>

  <Card title="Decorators" icon="wand-magic-sparkles" href="/Observability/Traces/decorators">
    Instrument workflows, agents, and tasks for per-intent metrics
  </Card>
</CardGroup>
