Drift Detection¶
Drift is any behavioral change from your agent's established identity. Identity OS classifies drift into 4 levels and responds automatically — including rollback at critical thresholds.
The 4 Drift Levels¶
| Level | Name | What It Means | System Response |
|---|---|---|---|
| D0 | Noise | Random micro-variation, not meaningful | Ignore |
| D1 | Context Drift | Expected change due to context shift | Monitor and allow |
| D2 | Adaptive Drift | Agent learned a new, effective behavior | Allow if aligned with goals |
| D3 | Corrupt Drift | Identity violation, deviation from core values | Auto-rollback to last stable state |
How It Works for You¶
Every call to POST /process returns a drift field:
You can also query drift history:
# Get drift event log
events = client.engine.get_drift(instance_id=instance.id)
for event in events:
print(f"{event.level}: magnitude={event.magnitude}")
What Triggers Each Level¶
- D0 — A single observation deviates slightly, then returns to normal
- D1 — Behavior changes consistently because the situation changed (e.g., urgent task → more assertive)
- D2 — Sustained behavioral shift that correlates with improved performance (the agent is learning)
- D3 — Sudden, large deviation that contradicts core identity → the engine rolls back automatically
Auto-Rollback (D3)¶
When D3 is detected, the engine:
- Reverts to the last stable state snapshot
- Logs the corrupt drift event
- Returns the restored state in the next contract
No manual intervention required. Your agent continues operating from the last known-good state.
Monitoring Drift¶
Use the drift history endpoint to monitor your agent's behavioral evolution over time:
This is useful for:
- Auditing — prove your agent stayed within behavioral bounds
- Debugging — understand why behavior changed
- Compliance — demonstrate drift detection is active