sentinelize • AI Agent SDK

sentinelize: Return an opaque sentinel token standing in for “secret“.

sentinelize

Function

</div>

This function is defined in the secrets module.

Return an opaque sentinel token standing in for `secret`.

The model only ever sees the returned token; the plaintext is held in a per-process map and never placed in prompts, tool arguments, transcripts or logs. Calling again with the same secret returns the same token (stable within a process). The secret is also registered for log redaction so an accidental leak of the plaintext is still masked.

Any non-empty string is sentinelised — the opaque, randomly-minted token never collides with ordinary text, so there is no minimum length (a short PIN or password must be hidden just as a long key is). Only an empty or non-string value is returned verbatim.

Signature

python
def sentinelize(secret: str) -> str

Parameters

ParamField str

No description available.

Returns

ResponseField str

The result of the operation.

Uses

  • _stdlib_secrets.token_hex
  • register_secret_for_redaction

Source

View on GitHub

praisonaiagents/secrets.py at line 421