Connect LangChain to Anoman AI
Route LangChain agents through Anoman using the OpenAI-compatible base URL. Works with LangChain Expression Language (LCEL), LangGraph, and any LCEL chain. No code changes to your chain definition required.
Prerequisites
- An Anoman AI account with an active API key
- Python 3.9+
- pip (Python package manager)
Step 1: Install dependencies
Step 2: Configure Anoman as the LLM backend
Set the environment variables before initializing your LLM. The base URL points to Anoman's OpenAI-compatible endpoint.
Step 3: Use in a chain
Your existing chains work without modification. Every call goes through Anoman's guardrail pipeline automatically.
Using with LangGraph
When a guardrail triggers
If a request is blocked by the guardrail pipeline, the API returns a 403 with a structured error. LangChain surfaces this as an exception.
This example is illustrative. Check docs/openapi/ for the current error schema.
Guardrail transparency headers
Every response includes guardrail result headers. Check these in your API logs to verify the pipeline is running correctly.
Need help with your integration?
Join the Founding 50 for early access and direct support from the Anoman team.