# compute_unified_diff

> **Function** in `deepagents_cli`

📖 [View in docs](https://reference.langchain.com/python/deepagents-cli/file_ops/compute_unified_diff)

Compute a unified diff between before and after content.

## Signature

```python
compute_unified_diff(
    before: str,
    after: str,
    display_path: str,
    *,
    max_lines: int | None = 800,
    context_lines: int = 3,
) -> str | None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `before` | `str` | Yes | Original content |
| `after` | `str` | Yes | New content |
| `display_path` | `str` | Yes | Path for display in diff headers |
| `max_lines` | `int \| None` | No | Maximum number of diff lines (None for unlimited) (default: `800`) |
| `context_lines` | `int` | No | Number of context lines around changes (default 3) (default: `3`) |

## Returns

`str | None`

Unified diff string or None if no changes

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/ead1d09c7b5c2fe58044917bd7bfbb11634d55e2/libs/cli/deepagents_cli/file_ops.py#L54)