> ## 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

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**protocols**](../modules/protocols) 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

<ParamField query="boot_fp" type="Optional[str]" required={true}>
  Fingerprint captured when the gateway started.
</ParamField>

<ParamField query="disk_fp" type="Optional[str]" required={true}>
  Fingerprint of the code currently on disk.
</ParamField>

### Returns

<ResponseField name="Returns" type="Optional[Tuple[str, str]]">
  ..."\`\` fingerprint); other
  fingerprints are returned unchanged.
</ResponseField>

## Uses

* `fp.partition`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L4274">
  `praisonaiagents/gateway/protocols.py` at line 4274
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Code Agent" icon="code" href="/docs/docs/features/codeagent" />

  <Card title="Code Feature" icon="terminal" href="/docs/docs/features/code" />
</CardGroup>
