Four small switches that make a PraisonAI agent safer, more deterministic, and easier to interrupt in production.Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
All four are opt-in and zero-overhead when unused. No existing code changes behaviour unless you actively enable a feature.
Quick reference
seed
Per-call determinism. Pass
seed=42 to Agent.chat() and the LLM receives the same seed — same prompt, same output.cancel_token
Cooperative cancellation. Pass an
InterruptController to Agent.chat() and trip it from another thread to abort cleanly.Tool validator
Attach any
ToolValidatorProtocol to reject bad tool-call arguments before the tool function runs.PII redaction
One call —
enable_pii_redaction() — scrubs API keys, SSNs, credit cards, and emails from every message sent to the LLM.Deterministic seed
Per-call random seed. Overrides any
seed set on the underlying LLM instance for this call only.Cooperative cancellation
cancel_token is checked at agent start and right before the LLM call — no hard kills, no partial writes.A cooperative cancellation token. When tripped (via
tok.request(reason)), the next checkpoint raises InterruptedError.Tool argument validation
Why attach via attribute instead of __init__?
Why attach via attribute instead of __init__?
Agent.__init__ already has many parameters; adding a validator slot would grow the public surface.
Attribute-assignment keeps the feature fully opt-in with zero surface impact on simple agents.PII redaction
Scrubs egress to the LLM — the raw prompt still sits in your local chat history for audit.
What gets scrubbed
- Key=value pairs
- Naked tokens
- Identifiers
api_key=sk-…, password: hunter2, token=…, secret_key=… → [REDACTED]Can I customise the rules?
Can I customise the rules?
Yes — import
scrub_pii_text and use it inside your own BEFORE_LLM hook, or extend REDACT_KEYS / _VALUE_PATTERNS before calling enable_pii_redaction().Combined example
Performance
Every feature short-circuits to a single attribute-read when inactive. No background threads, no module-level side-effects, no added imports in the hot path.

