---
title: Automatic Integrations
description: >-
  Protect agents built on supported AI frameworks and client libraries with AI
  Guard, without adding evaluation calls to your code.
breadcrumbs: Docs > Datadog Security > AI Guard > Set Up AI Guard > Automatic Integrations
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Automatic Integrations

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com



{% alert level="danger" %}
AI Guard isn't available in the {% placeholder "user-datadog-site-name" /%} site.
{% /alert %}


{% /callout %}

With AI Guard automatic integrations, you can protect agents built on supported AI frameworks and client libraries without adding AI Guard evaluation calls to your code. If your agent calls a supported package, you enable AI Guard through environment variables and Datadog SDK configuration, instead of adding evaluation calls by hand.

When the application starts with the Datadog SDK loaded, the SDK detects supported packages and instruments them. The SDK sends each instrumented model call and tool call to AI Guard for evaluation.

## Supported frameworks and libraries{% #supported-frameworks-and-libraries %}

Automatic integrations work only with specific packages and versions. Check the agent's packages to confirm that an automatic integration applies.

| Language | Package   | Package version  | Datadog SDK version                                |
| -------- | --------- | ---------------- | -------------------------------------------------- |
| Python   | LangChain | 0.1.20 or later  | `dd-trace-py` 4.13.0 or later                      |
| Python   | OpenAI    | 1.102.0 or later | `dd-trace-py` 4.13.0 or later                      |
| Python   | Anthropic | 0.28.0 or later  | `dd-trace-py` 4.13.0 or later                      |
| Node.js  | AI SDK    | v6 or later      | `dd-trace-js` 5.122.0 or later, or 6.11.0 or later |
| Node.js  | OpenAI    | 4.87.0 or later  | `dd-trace-js` 5.122.0 or later, or 6.11.0 or later |
| Node.js  | Anthropic | 0.14.0 or later  | `dd-trace-js` 5.122.0 or later, or 6.11.0 or later |
| Ruby     | RubyLLM   | 2.0.0 or later   | `dd-trace-rb` 2.44.0 or later                      |

Automatic integrations don't support Java. For Java agents, use the [SDK](https://docs.datadoghq.com/security/ai_guard/setup/sdk.md). For Amazon Strands and LiteLLM Proxy, use [manual integrations](https://docs.datadoghq.com/security/ai_guard/setup/manual_integrations.md).

In Python, if LangChain calls a supported provider SDK such as OpenAI, AI Guard evaluates the call once, through the LangChain integration.

### Evaluated operations{% #evaluated-operations %}

Each automatic integration evaluates a specific set of operations, so check the operations your agent calls to confirm that AI Guard covers them. To evaluate other calls, add [SDK](https://docs.datadoghq.com/security/ai_guard/setup/sdk.md) calls in your code.

| Language | Package   | Evaluated operations                                                                                                                                                                                                                                                       |
| -------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Python   | LangChain | LLM `invoke()` and `ainvoke()`, chat model `invoke()` and `ainvoke()`, and the tool calls that LangChain agents decide to run. Tool call evaluation covers AgentExecutor agents and, with `dd-trace-py` 4.12.0 or later, `create_agent` agents in LangChain 1.0 and later. |
| Python   | OpenAI    | `client.chat.completions.create()`, `client.chat.completions.parse()`, `client.responses.create()`, and `client.responses.parse()`.                                                                                                                                        |
| Python   | Anthropic | `client.messages.create()` and `client.messages.stream()`. With the `anthropic` package 0.37.0 or later, also `client.beta.messages.create()` and `client.beta.messages.stream()`.                                                                                         |
| Node.js  | AI SDK    | Model calls from `generateText`, `streamText`, `generateObject`, and `streamObject`, including the tool calls and tool results they carry.                                                                                                                                 |
| Node.js  | OpenAI    | `client.chat.completions.create()`, `client.chat.completions.parse()`, and `client.responses.create()`.                                                                                                                                                                    |
| Node.js  | Anthropic | `client.messages.create()`. With the `@anthropic-ai/sdk` package 0.33.0 or later, also `client.beta.messages.create()`.                                                                                                                                                    |
| Ruby     | RubyLLM   | `RubyLLM::Chat#ask` and `RubyLLM::Chat#complete`, including the tool calls the model requests.                                                                                                                                                                             |

### Streamed responses{% #streamed-responses %}

A streamed response arrives in pieces while the model generates it, instead of all at once. By default, AI Guard doesn't evaluate streamed model responses, so if your agent streams responses, the model's output reaches the user without an evaluation.

To enable evaluation of streamed responses, set `DD_AI_GUARD_ANALYZE_STREAM_RESPONSES_ENABLED=true`. The Datadog SDK then buffers each streamed response until AI Guard returns a result, and buffering delays the first token.

Streamed response evaluation is supported for these packages at the specified Datadog SDK versions:

| Language | Package              | Datadog SDK version                                |
| -------- | -------------------- | -------------------------------------------------- |
| Python   | OpenAI and Anthropic | `dd-trace-py` 4.12.0 or later                      |
| Node.js  | AI SDK               | `dd-trace-js` 5.127.0 or later, or 6.16.0 or later |
| Node.js  | OpenAI               | `dd-trace-js` 5.128.0 or later, or 6.17.0 or later |
| Node.js  | Anthropic            | `dd-trace-js` 5.130.0 or later, or 6.19.0 or later |

AI Guard doesn't evaluate streamed responses from LangChain or RubyLLM.

## Enable automatic integrations{% #enable-automatic-integrations %}

Enable automatic integrations so the Datadog SDK sends every supported model call and tool call from the agent to AI Guard for evaluation.

**Before you begin**: [Check prerequisites](https://docs.datadoghq.com/security/ai_guard/setup.md#prerequisites), [create API and application keys](https://docs.datadoghq.com/security/ai_guard/setup.md#create-keys), and install a supported Datadog SDK version in the application.

1. Set these environment variables in the application's environment:

| Variable              | Value                                                   |
| --------------------- | ------------------------------------------------------- |
| `DD_AI_GUARD_ENABLED` | `true`. Without this value, AI Guard evaluates nothing. |
| `DD_API_KEY`          | Your Datadog API key.                                   |
| `DD_APP_KEY`          | An application key with the `ai_guard_evaluate` scope.  |
| `DD_SERVICE`          | The service name the agent reports to APM.              |
| `DD_ENV`              | The environment name.                                   |
In Python, to turn off AI Guard for one integration without turning it off for the others, set the appropriate variables to `false`: `DD_AI_GUARD_OPENAI_ENABLED`, `DD_AI_GUARD_ANTHROPIC_ENABLED`, or `DD_AI_GUARD_LANGCHAIN_ENABLED`.
1. Start the application with the Datadog SDK loaded:

   - **Python**: Run the application with `ddtrace-run`, or add `import ddtrace.auto` as the first import in the application.

   - **Node.js**: Start the application with `node --require dd-trace/init`, or call `require('dd-trace').init()` before any other module loads.

   - **Ruby**: Enable the RubyLLM integration in your Datadog configuration. RubyLLM isn't instrumented automatically, so `require 'datadog/auto_instrument'` alone doesn't enable the RubyLLM integration. Add this block to your Datadog configuration:

     ```ruby
     Datadog.configure do |config|
       config.ai_guard.instrument :ruby_llm
     end
     ```

For other loading options, see [tracing setup for your language](https://docs.datadoghq.com/tracing/trace_collection.md).

**What's next?** [Create a retention filter for AI Guard spans](https://docs.datadoghq.com/security/ai_guard/setup.md#retention-filter), optionally [limit access to AI Guard spans](https://docs.datadoghq.com/security/ai_guard/setup.md#limit-access), then [verify the setup](https://docs.datadoghq.com/security/ai_guard/setup.md#verify).
