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

> ## Agent Instructions
> These docs moved from docs.flintai.dev to docs.switchagents.ai. Use docs.switchagents.ai for every link and request.
> To search these docs from an AI tool, connect the MCP server at https://docs.switchagents.ai/mcp. The page index is at https://docs.switchagents.ai/llms.txt.

# Monitor your agents at runtime

> Install the SDK and see your first traces in less than 10 minutes

Install the Switch Trust SDK — in Python or TypeScript — to capture live traces of your agents in production. Within minutes, see what your agents actually do — prompts, responses, models called, and guardrail events.

<Card title="Switch Trust CLI on GitHub" icon="github" href="https://github.com/sandbox-quantum/flintai-cli">
  Source code, example agents, and issue tracking
</Card>

Choose your language:

<Tabs>
  <Tab title="Python">
    <Note>
      **Requirements:** Python 3.10 or later

      **Supported with `flintai.wrap()`:** OpenAI, Anthropic, LangChain (`ChatOpenAI`, `ChatAnthropic`, `ChatGoogleGenerativeAI`), Google GenAI

      **Google ADK:** Use `ADKGuardrailsPlugin` instead of `wrap()` — see [SDK Usage guide](/switch-trust/sdk/python/usage)
    </Note>

    <Steps>
      <Step title="Install the SDK in your agent's environment">
        On your local machine or wherever your agent code runs:

        ```bash theme={null}
        pip install flintai-sdk-py
        ```

        <Accordion title="Optional: Install with provider extras">
          If you need specific provider dependencies:

          ```bash theme={null}
          pip install "flintai-sdk-py[openai]"     # OpenAI
          pip install "flintai-sdk-py[anthropic]"  # Anthropic
          pip install "flintai-sdk-py[genai]"      # Google GenAI
          pip install "flintai-sdk-py[adk]"        # Google ADK
          pip install "flintai-sdk-py[all]"        # All providers
          ```
        </Accordion>
      </Step>

      <Step title="Register your agent and get credentials">
        Log into [Switch Trust](https://app.flintai.dev) and register your agent for monitoring:

        1. Go to **Agents** and select **Add agents**.
        2. Select **Monitor & protect agents**, then **Install SDK**.
        3. Enter a name for your agent (for example, "Customer Support Bot").
        4. Select your agent to open its **Sessions** tab.

        The setup page shows the values you need:

        * **Gateway URL** - Shown in the code snippet on the Sessions tab.

        * **API key** - Use an existing Switch Trust API token, or create a new one by navigating to **Settings** and selecting **API Keys**.

        <Note>
          Copy your token immediately when created — it will only be shown once.
        </Note>
      </Step>

      <Step title="Wrap your LLM client in your agent code">
        Import `flintai` and wrap your existing LLM client.

        <Tip>
          **Using environment variables:** Instead of hardcoding credentials, set `FLINTAI_GATEWAY_URL` and `FLINTAI_API_KEY` as environment variables, then call `flintai.wrap(client)` without parameters.
        </Tip>

        <Tabs>
          <Tab title="OpenAI">
            ```python theme={null}
            import openai
            import flintai

            client = openai.OpenAI(api_key="your-openai-api-key")
            client = flintai.wrap(
                client,
                gateway_url="https://your-gateway-url",
                api_key="your-flintai-api-key",
            )

            response = client.chat.completions.create(
                model="gpt-4",
                messages=[{"role": "user", "content": "Hello"}],
            )
            ```
          </Tab>

          <Tab title="Anthropic">
            ```python theme={null}
            import anthropic
            import flintai

            client = anthropic.Anthropic(api_key="your-anthropic-api-key")
            client = flintai.wrap(
                client,
                gateway_url="https://your-gateway-url",
                api_key="your-flintai-api-key",
            )

            message = client.messages.create(
                model="claude-sonnet-4-20250514",
                max_tokens=1024,
                messages=[{"role": "user", "content": "Hello"}],
            )
            ```
          </Tab>

          <Tab title="LangChain">
            ```python theme={null}
            from langchain_openai import ChatOpenAI
            import flintai

            llm = ChatOpenAI(model="gpt-4", api_key="your-openai-api-key")
            llm = flintai.wrap(
                llm,
                gateway_url="https://your-gateway-url",
                api_key="your-flintai-api-key",
            )

            response = llm.invoke("Hello")
            ```
          </Tab>

          <Tab title="Google GenAI">
            ```python theme={null}
            import google.genai
            import flintai

            client = google.genai.Client(api_key="your-gemini-api-key")
            client = flintai.wrap(
                client,
                gateway_url="https://your-gateway-url",
                api_key="your-flintai-api-key",
                llm_api_key="your-gemini-api-key",  # Required for Google GenAI
            )

            response = client.models.generate_content(
                model="gemini-2.5-flash",
                contents="Hello",
            )
            ```
          </Tab>
        </Tabs>

        <Note>
          **Google ADK:** Use `ADKGuardrailsPlugin` instead of `wrap()` — see the [SDK Usage guide](/switch-trust/sdk/python/usage) for details.
        </Note>
      </Step>

      <Step title="Run your agent">
        Run your agent as you normally would. The SDK captures each LLM interaction automatically.
      </Step>

      <Step title="View your traces">
        Back in [Switch Trust](https://app.flintai.dev), navigate to **Agents** and select your agent, then open the **Sessions** tab.

        Within moments, you'll see:

        * **Sessions** - Individual agent runs
        * **Traces** - Every LLM call with prompts, responses, model info, and latency
        * **Guardrail events** - Any policy actions (if configured)
      </Step>
    </Steps>

    <Tip>
      **Add runtime protection:** Pass `policy_id="your-policy-id"` to `flintai.wrap()` to enforce guardrails. Policies apply input/output detectors that can block, redact, or alert on unsafe content before it reaches users. [Learn more →](/switch-trust/guardrails/policies)
    </Tip>

    ## Next steps

    <CardGroup cols={2}>
      <Card title="SDK Configuration" icon="sliders" href="/switch-trust/sdk/python/configuration">
        Environment variables, credentials, and configuration options
      </Card>

      <Card title="SDK Usage" icon="code" href="/switch-trust/sdk/python/usage">
        Examples for all supported providers and frameworks
      </Card>
    </CardGroup>
  </Tab>

  <Tab title="TypeScript">
    <Note>
      **Requirements:** Node.js 18 or later

      **Supported with `wrap()`:** OpenAI, Anthropic, LangChain (`ChatOpenAI`, `ChatAnthropic`, `ChatGoogleGenerativeAI`), Google GenAI

      **Google ADK:** Use `ADKGuardrailsPlugin` instead of `wrap()` — see [SDK Usage guide](/switch-trust/sdk/typescript/usage)
    </Note>

    <Steps>
      <Step title="Install the SDK in your agent's environment">
        On your local machine or wherever your agent code runs:

        ```bash theme={null}
        npm install @sandboxaq/flintai-sdk-ts
        ```

        <Accordion title="Optional: Install provider peer dependencies">
          Each provider library is an optional peer dependency — install the ones you use:

          ```bash theme={null}
          npm install @sandboxaq/flintai-sdk-ts openai              # OpenAI
          npm install @sandboxaq/flintai-sdk-ts @anthropic-ai/sdk   # Anthropic
          npm install @sandboxaq/flintai-sdk-ts @google/genai       # Google GenAI
          npm install @sandboxaq/flintai-sdk-ts @google/adk         # Google ADK
          ```

          For LangChain, install the matching `@langchain/*` package.
        </Accordion>
      </Step>

      <Step title="Register your agent and get credentials">
        Log into [Switch Trust](https://app.flintai.dev) and register your agent for monitoring:

        1. Go to **Agents** and select **Add agents**.
        2. Select **Monitor & protect agents**, then **Install SDK**.
        3. Enter a name for your agent (for example, "Customer Support Bot").
        4. Select your agent to open its **Sessions** tab.

        The setup page shows the values you need:

        * **Gateway URL** - Shown in the code snippet on the Sessions tab.

        * **API key** - Use an existing Switch Trust API token, or create a new one by navigating to **Settings** and selecting **API Keys**.

        <Note>
          Copy your token immediately when created — it will only be shown once.
        </Note>
      </Step>

      <Step title="Wrap your LLM client in your agent code">
        Import `wrap` and wrap your existing LLM client. The SDK mutates the client in place, so use the same instance afterward.

        <Tip>
          **Using environment variables:** Instead of hardcoding credentials, set `FLINTAI_GATEWAY_URL` and `FLINTAI_API_KEY` as environment variables, then call `wrap(client)` without options.
        </Tip>

        <Tabs>
          <Tab title="OpenAI">
            ```typescript theme={null}
            import OpenAI from "openai";
            import { wrap } from "@sandboxaq/flintai-sdk-ts";

            const client = new OpenAI({ apiKey: "your-openai-api-key" });
            wrap(client, {
              gatewayUrl: "https://your-gateway-url",
              apiKey: "your-flintai-api-key",
            });

            const response = await client.chat.completions.create({
              model: "gpt-4",
              messages: [{ role: "user", content: "Hello" }],
            });
            ```
          </Tab>

          <Tab title="Anthropic">
            ```typescript theme={null}
            import Anthropic from "@anthropic-ai/sdk";
            import { wrap } from "@sandboxaq/flintai-sdk-ts";

            const client = new Anthropic({ apiKey: "your-anthropic-api-key" });
            wrap(client, {
              gatewayUrl: "https://your-gateway-url",
              apiKey: "your-flintai-api-key",
            });

            const message = await client.messages.create({
              model: "claude-sonnet-4-20250514",
              max_tokens: 1024,
              messages: [{ role: "user", content: "Hello" }],
            });
            ```
          </Tab>

          <Tab title="LangChain">
            ```typescript theme={null}
            import { ChatOpenAI } from "@langchain/openai";
            import { wrap } from "@sandboxaq/flintai-sdk-ts";

            const llm = new ChatOpenAI({ model: "gpt-4" });
            wrap(llm, {
              gatewayUrl: "https://your-gateway-url",
              apiKey: "your-flintai-api-key",
            });

            const response = await llm.invoke("Hello");
            ```
          </Tab>

          <Tab title="Google GenAI">
            ```typescript theme={null}
            import { GoogleGenAI } from "@google/genai";
            import { wrap } from "@sandboxaq/flintai-sdk-ts";

            const client = new GoogleGenAI({ apiKey: "your-gemini-api-key" });
            wrap(client, {
              gatewayUrl: "https://your-gateway-url",
              apiKey: "your-flintai-api-key",
            });

            const response = await client.models.generateContent({
              model: "gemini-2.5-flash",
              contents: "Hello",
            });
            ```
          </Tab>
        </Tabs>

        <Note>
          **Google ADK:** Use `ADKGuardrailsPlugin` instead of `wrap()` — see the [SDK Usage guide](/switch-trust/sdk/typescript/usage) for details.
        </Note>
      </Step>

      <Step title="Run your agent">
        Run your agent as you normally would. The SDK captures each LLM interaction automatically.
      </Step>

      <Step title="View your traces">
        Back in [Switch Trust](https://app.flintai.dev), navigate to **Agents** and select your agent, then open the **Sessions** tab.

        Within moments, you'll see:

        * **Sessions** - Individual agent runs
        * **Traces** - Every LLM call with prompts, responses, model info, and latency
        * **Guardrail events** - Any policy actions (if configured)
      </Step>
    </Steps>

    <Tip>
      **Add runtime protection:** Pass `policyId: "your-policy-id"` to `wrap()` to enforce guardrails. Policies apply input/output detectors that can block, redact, or alert on unsafe content before it reaches users. [Learn more →](/switch-trust/guardrails/policies)
    </Tip>

    ## Next steps

    <CardGroup cols={2}>
      <Card title="SDK Configuration" icon="sliders" href="/switch-trust/sdk/typescript/configuration">
        Environment variables, credentials, and configuration options
      </Card>

      <Card title="SDK Usage" icon="code" href="/switch-trust/sdk/typescript/usage">
        Examples for all supported providers and frameworks
      </Card>
    </CardGroup>
  </Tab>
</Tabs>
