Harden LangChain agents with Vijil
Install the SDK, wrap one function, evaluate in CI. Your LangChain agent gets runtime guards and a trust score without changing how you build.
01 · INSTALL
$ pip install vijil-sdk # CLI + SDK $ pip install vijil-dome[langchain] # chain-native guards
02 · GUARD — TWO LINES OF CODE
from vijil_dome import Dome, control
from vijil_dome.integrations.langchain.runnable import GuardrailRunnable
# Chain-native: guardrails as LCEL runnables
guard_in, guard_out = Dome("policy.yaml").get_guardrails()
chain = GuardrailRunnable(guard_in) | prompt | model | parser \
| GuardrailRunnable(guard_out)
# Or wrap any entry point in two lines
@control(policy="policy.yaml") # guards in + out
def ask(prompt: str) -> str:
return chain.invoke({"input": prompt})Guards compose as LCEL runnables — use RunnableBranch to route flagged inputs to a refusal path — or wrap the chain’s entry point with the decorator. Works with chains, agents, and tools. Enforce or shadow mode; sync or async.
03 · EVALUATE
$ vijil evaluate my-agent --baseline $ vijil evaluate my-agent # gate your pipeline $ vijil protect my-agent --guards prompt_injection,pii
Diamond generates probes specific to your agent’s tools and data sources and returns a trust score with findings that drill down to evidence. Run it as a build step so every change is scored before it ships.
04 · ADAPT
$ vijil adapt my-agent # learn from production
Darwin watches Dome’s runtime telemetry, attributes failures to root causes, and proposes hardening changes as a pull request — re-verified by Diamond before merge. Nothing ships without your approval.
Full reference, policies, and examples in the Vijil docs.