Copy‑paste integrations for Python, Node, curl, LangChain, and LlamaIndex.
These snippets are deliberately minimal so you can drop them into a
real project and adjust. None of them require an Antidote SDK; the
LLM SDKs already accept base_url and default_headers, which is
all the firewall needs.
LangChain’s ChatOpenAI is a thin wrapper over the OpenAI Python SDK
and forwards base_url and default_headers. Point those at the
Antidote reverse proxy and every LangChain call, chains, retrievers,
agent LLM steps, flows through Runtime Security.
init_chat_model("openai:gpt-4o", base_url=..., default_headers=...)
works the same way for projects that use the model‑string indirection.For Anthropic, swap to ChatAnthropic from langchain-anthropic,
point base_url at /api/runtime-security/proxy/anthropic, and pass
the Antidote key on X-Antidote-Key (Anthropic reserves x-api-key
for the upstream provider).
Want event metadata tagged with LangChain run_id? Add a small
BaseCallbackHandler that posts to /scan/input from
on_llm_start with metadata={"langchain_run_id": str(run_id)}.
The handler can’t rewrite the prompt (observability‑only) but the
events show up in the dashboard joined to your LangChain traces.
To apply this globally across query engines, retrievers, and agents:
from llama_index.core import SettingsSettings.llm = llm
For Anthropic, from llama_index.llms.anthropic import Anthropic
with api_base="/api/runtime-security/proxy/anthropic" and the
Antidote key on X-Antidote-Key.
Agent tool calls. The proxy sees LLM traffic but not the agent
runtime’s execution of a tool. If you need scan/tool-call
coverage on FunctionCallingAgent or ReActAgent tool dispatches,
wrap your FunctionTool so its fn posts to
/api/runtime-security/scan/tool-call before invoking the real
function. Same pattern works for LangChain AgentExecutor’s
BaseTool.