Skip to main content
This guide walks you through installing the Trident SDK, initializing it with your project keys, and making your first traced LLM call. By the end you’ll see live traces appearing in your Trident dashboard and be ready to run your first security scan.

Prerequisites

  • A Trident account at app.usetrident.dev
  • Node.js 18+ (TypeScript) or Python 3.9+ (Python)
  • An OpenAI API key (used in the example below — any supported provider works)

Steps

1
Create a project and copy your API keys
2
After signing in to app.usetrident.dev, create a new project from the dashboard home page. Then open Settings for your project and copy two values:
3
  • Project Public Key — starts with pk-lf-
  • Project Secret Key — starts with sk-lf-
  • 4
    You’ll use both keys to authenticate the SDK. Keep your secret key out of source control.
    5
    Install the SDK
    6
    TypeScript
    npm install @vouch-ai/sdk
    
    Python
    pip
    pip install vouch-sdk
    
    7
    Initialize the SDK
    8
    Call init() once at application startup — before any LLM call is made. The SDK reads your project keys and wires up automatic OpenTelemetry instrumentation for every LLM client in the process.
    9
    TypeScript
    import { trident } from "@vouch-ai/sdk";
    
    trident.init({
      projectPk: process.env.TRIDENT_PROJECT_PUBLIC_KEY,
      projectSk: process.env.TRIDENT_PROJECT_SECRET_KEY,
      agentId: "my-first-agent", // optional — scopes traces to this agent in the dashboard
    });
    
    Store your keys in a .env file:
    .env
    TRIDENT_PROJECT_PUBLIC_KEY=pk-lf-...
    TRIDENT_PROJECT_SECRET_KEY=sk-lf-...
    
    Python
    import vouch_sdk
    
    vouch_sdk.init(
        project_pk=os.environ["TRIDENT_PROJECT_PUBLIC_KEY"],
        project_sk=os.environ["TRIDENT_PROJECT_SECRET_KEY"],
        agent_id="my-first-agent",       # optional — scopes traces to this agent
    )
    
    Store your keys in a .env file (loaded with a library such as python-dotenv):
    .env
    TRIDENT_PROJECT_PUBLIC_KEY=pk-lf-...
    TRIDENT_PROJECT_SECRET_KEY=sk-lf-...
    
    Alternatively, pass the keys as project_pk / project_sk keyword arguments directly. You can also omit both arguments entirely and set the environment variables — the SDK reads them automatically.
    10
    Both TRIDENT_PROJECT_PUBLIC_KEY / TRIDENT_PROJECT_SECRET_KEY and the legacy VOUCH_PROJECT_PUBLIC_KEY / VOUCH_PROJECT_SECRET_KEY environment variable names are supported. The TRIDENT_* names take priority if both are set.
    11
    Make a traced LLM call
    12
    After init() runs, every LLM call in the same process is automatically captured as an OpenTelemetry trace — no code changes to your model calls required.
    13
    TypeScript
    import { trident } from "@vouch-ai/sdk";
    import OpenAI from "openai";
    
    trident.init({
      projectPk: process.env.TRIDENT_PROJECT_PUBLIC_KEY,
      projectSk: process.env.TRIDENT_PROJECT_SECRET_KEY,
      agentId: "my-first-agent",
    });
    
    const openai = new OpenAI(); // uses OPENAI_API_KEY from env
    
    const response = await openai.chat.completions.create({
      model: "gpt-4o-mini",
      messages: [
        { role: "system", content: "You are a helpful assistant." },
        { role: "user", content: "What is the capital of France?" },
      ],
    });
    
    console.log(response.choices[0].message.content);
    // This call is now traced in your Trident dashboard.
    
    Python
    import os
    import vouch_sdk
    from openai import OpenAI
    
    vouch_sdk.init(
        project_pk=os.environ["TRIDENT_PROJECT_PUBLIC_KEY"],
        project_sk=os.environ["TRIDENT_PROJECT_SECRET_KEY"],
        agent_id="my-first-agent",
    )
    
    client = OpenAI()  # uses OPENAI_API_KEY from env
    
    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[
            {"role": "system", "content": "You are a helpful assistant."},
            {"role": "user", "content": "What is the capital of France?"},
        ],
    )
    
    print(response.choices[0].message.content)
    # This call is now traced in your Trident dashboard.
    
    14
    For TypeScript apps, you can enable zero-code auto-instrumentation without modifying your source at all. Pass @vouch-ai/sdk/register as a Node.js require flag and set your keys in the environment:
    TRIDENT_PROJECT_PUBLIC_KEY=pk-lf-... \
    TRIDENT_PROJECT_SECRET_KEY=sk-lf-... \
    node --require @vouch-ai/sdk/register your-app.js
    
    You can also set this permanently via NODE_OPTIONS:
    .env
    NODE_OPTIONS=--require @vouch-ai/sdk/register
    
    15
    View your traces in the dashboard
    16
    Navigate to your project in app.usetrident.dev and open the Traces page from the sidebar. You’ll see:
    17
  • A new trace row for each LLM call, with the model name, latency, and token counts
  • The full prompt and completion text for each span
  • An agent-level view if you passed agentId to init()
  • 18
    The dashboard also automatically runs Trident’s Monitor — a background scanner that sweeps your traces every ~45 seconds for tool-failure patterns, silent errors, and anomalous behavior. Any issues surface as findings in the Findings inbox.

    Next steps

    Run a Red-Team Campaign

    Launch your first automated attack campaign against your agent using 200+ adversarial attack vectors.

    Enable the Firewall

    Route your agent through the Trident firewall gateway to scan prompts and outputs in real time.

    Explore Core Concepts

    Understand projects, traces, findings, red-team runs, and the cloud security graph.

    SDK Reference

    Explore the full TypeScript and Python SDK API, including selfReport() and scan().