> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/guardrails/llms.txt.
> For full documentation content, see https://docs.nvidia.com/nemo/guardrails/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/guardrails/_mcp/server.

# Integrate Guardrails into Your Application

> Add guardrails to existing applications using the Python SDK, the HTTP API, or the optional LangChain integration.

The NeMo Guardrails library provides the following tools to integrate guardrails into your applications.

* Use the NeMo Guardrails Python SDK to add guardrails directly into your Python application.

  ```python
  from nemoguardrails import LLMRails, RailsConfig

  config = RailsConfig.from_path("path/to/config")
  rails = LLMRails(config)

  # Use in your application
  response = rails.generate(messages=[...])
  ```

* Use the NeMo Guardrails LangChain integration to wrap guardrails around LangChain chains or use chains within guardrails.

  Starting in 0.22, the LangChain integration is opt-in. To enable it, set the `NEMOGUARDRAILS_LLM_FRAMEWORK=langchain` environment variable or call `set_default_framework("langchain")`. Install `langchain` and `langchain-community` (or the matching `langchain-<provider>` package) before importing. For background, see [Migrating to 0.22](/reference/0-22).

  ```python
  from nemoguardrails.integrations.langchain.runnable_rails import RunnableRails

  guardrails = RunnableRails(config)
  chain_with_guardrails = prompt | guardrails | model | output_parser
  ```

  For more information, refer to the [LangChain Integration Guide](/integration-with-third-party-libraries/langchain/langchain-integration).

* Integrate the NeMo Guardrails API server into your application to add protection to applications in any programming language.

  ```bash
  nemoguardrails server --config path/to/configs
  ```

  You can then use the API server in your application by sending requests to the server's endpoint.

  ```bash
  curl -X POST http://localhost:8000/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{
      "config_id": "content_safety",
      "messages": [{"role": "user", "content": "Hello!"}]
    }'
  ```

  For more information, refer to [Guardrails API Server](/run-guardrailed-inference/using-fastapi-server).

* Use the NeMo Guardrails Docker deployment capabilities to deploy guardrails as a containerized service.
  For more information, refer to [Docker](/more-deployment-options/using-docker).

For more examples and detailed integration patterns, refer to the [examples directory](https://github.com/NVIDIA-NeMo/Guardrails/tree/develop/examples) in the NeMo Guardrails GitHub repository.