# How do I add Provely to a LangGraph agent?

> Add two lines to your LangGraph agent in TypeScript and Python. Provely finds the framework, checks each call, and fixes the failure itself.

Canonical: https://provely.sh/frameworks/langgraph  
Last updated: 2026-10-18  

**Add two lines and nothing else. Provely finds LangGraph by itself and loads its plugin when the agent starts. You write no guard call and import no adapter.**

agent.ts

```typescript
import { Provely } from '@provely/sdk';

new Provely();
```

agent.py

```python
from provely import Provely

Provely()
```

Provely attaches to the model node and the tool node of every LangGraph graph. The API key is required, and the SDK reads it from `PROVELY_API_KEY`. Get your API key: sign in at [app.provely.sh/account/api-keys](https://app.provely.sh/account/api-keys), open API keys, and create a key. The dashboard shows the key once. Keep it in an environment variable, never in code.

## Which LangGraph packages does Provely find?

Provely finds `@langchain/langgraph` (TypeScript) and `langgraph` (Python). The plugin loads only when the package is present, so the core holds no framework code.

## What did the grid measure for LangGraph?

The grid runs each failure case against a real app with the two lines, and again with no Provely line. The table states the column that holds the LangGraph paths.

*A case passes in a column only when it passes on every path of that column.*

| Column | Paths | Pass | Fail | Not counted | Not applicable | Head |
| --- | --- | --- | --- | --- | --- | --- |
| TypeScript frameworks | LangGraph (and 6 paths in all) | 27 of 27 (1 passes under guard_mode: enforce; observe records only; rules cases not yet measured) | 0 | 0 | 0 | `82acaae6` |
| Python frameworks | LangGraph (and 4 paths in all) | 26 of 27 (1 passes under guard_mode: enforce; observe records only; rules cases counted apart) | 1 | 0 | 0 | `9f9131ba` |

A fail is a case that did not pass on at least one path. "Not counted" is a case where the framework coped alone and Provely made no fix, so it is not a pass. An inapplicable case is left out of the total.

The invented-value case passes under guard_mode: enforce; observe records only. Under observe, the default, Provely records the value and the write runs.

Measured on 2026-10-17 at commit 82acaae6. Measured on 2026-10-17 at commit 9f9131ba.

Source: https://provely.sh/frameworks/langgraph (retrieved 2026-10-17)

## What does Provely do when a call fails?

One deterministic check answers each failure, and it makes one of five actions.

| Action | Code | What happens |
| --- | --- | --- |
| Repair in place | `repair_in_place` | A lossless syntax fix, for example single quotes or a code fence around the JSON. The tool gets the arguments that the model meant. |
| Return the exact error | `return_error_to_model` | The model gets one exact sentence about what is wrong, and it tries again. The tool does not run. |
| Retry | `retry` | Only where the frozen retry table permits it, and always with the key of the first attempt. |
| Refuse | `refuse` | The call never reaches the tool. Examples: a duplicate call, or a write that repeats a completed write in the same agent call. |
| Record | `record` | The call runs, and the line states what the check found. |

> Every fix writes one decision-log line. The line holds ids and codes only, never a value. No language model takes part in any decision.

Your own defences stay. Read [how Provely works beside them](/coexistence).

## Read next

- [See every framework and its measured result](https://provely.sh/frameworks)
- [Change a check with a rule](https://provely.sh/rules)
- [Keep your own defences](https://provely.sh/coexistence)
- [Read how Provely works](https://provely.sh/how-it-works)
