> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Detect Code Skew • AI Agent SDK

> detect_code_skew: Return shortened ``(boot, disk)`` fingerprints if the code changed.

# detect\_code\_skew

Function

> This function is defined in the [**protocols**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/protocols.md) module.

Return shortened `(boot, disk)` fingerprints if the code changed.

This is the pure, side-effect-free heart of the code-skew guard. It does
not read the filesystem or git; callers pass the fingerprint captured at
boot and a freshly-read on-disk fingerprint (see
:func:`read_code_fingerprint`).

The check is intentionally fail-open: if either fingerprint is unknown
(`None` / empty) it returns `None` so the caller proceeds normally and
never blocks an operation just because the revision could not be read.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def detect_code_skew(boot_fp: Optional[str], disk_fp: Optional[str]) -> Optional[Tuple[str, str]]
```

## Parameters

**boot\_fp** `Optional[str]` *required*

Fingerprint captured when the gateway started.

**disk\_fp** `Optional[str]` *required*

Fingerprint of the code currently on disk.

### Returns

**Returns** `Optional[Tuple[str, str]]`

..."\`\` fingerprint); other
fingerprints are returned unchanged.

## Uses

* `fp.partition`

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L5887)
>
> `praisonaiagents/gateway/protocols.py` at line 5887

***

## Related Documentation

> [card] [Code Agent](https://praison.ai/docs/docs/features/codeagent)

> [card] [Code Feature](https://praison.ai/docs/docs/features/code)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.