Skip to main content
Four small switches that make a PraisonAI agent safer, more deterministic, and easier to interrupt in production. The user starts a run; core controls enforce safety policies during execution.

Quick Start

1

PII Redaction

2

Deterministic Seed & Cancellation

3

Tool Validation


How It Works


Configuration Options


Deterministic seed

Per-call determinism for reproducible outputs.

Cooperative cancellation

Thread-safe cancellation without hard kills.
Fixed in PR #2751 (release after 2026-07-07): earlier releases only checked cancel_token on the OpenAI completion path in chat_mixin. The litellm-backed tool loop in llm/llm.py (used for Anthropic, Gemini, Groq, local models, and any non-OpenAI provider) took no cancel token and performed no checkpoint, so /stop and InterruptController.request() were silently no-ops on those providers. Upgrade to get uniform cancellation across every provider.
Tightened in PR #2997 (release after 2026-07-14): every tool-loop iteration now checks cancel_token.is_set() twice — at the top of the iteration and again immediately before dispatching tool calls — in both LiteLLM (llm/llm.py) and OpenAI-native (llm/openai_client.py) paths, sync and async. This closes a window where a /stop arriving between the model returning tool calls and the tools starting could still execute one round of tools before honouring the cancel.

Tool argument validation

Validate tool arguments before execution.
ValidationResult fields:

PII redaction

Scrub sensitive data from LLM requests.
1

Enable once at startup

2

Use agents normally

Every BEFORE_LLM event now passes messages through the scrubber.
3

Disable in tests if needed

What gets scrubbed:
  • Key=value pairs: api_key=sk-…, password: hunter2, token=…[REDACTED]
  • Naked tokens: OpenAI-style sk-ABCDEF… keys → [REDACTED]
  • Identifiers: US SSNs 123-45-6789[REDACTED-SSN], credit cards → [REDACTED-CC], emails → [REDACTED-EMAIL]

Which one do I use?


Common Patterns

Reproducible eval

Cancel from Ctrl+C handler

Disable redaction in tests


Best Practices

Some providers ignore seed or treat it as best-effort. Don’t rely on it for production routing decisions.
InterruptController.request(...) is thread-safe. Trip it from a signal handler, an HTTP cancel endpoint, or a parent supervisor.
Validators run on every tool invocation. Avoid network calls or heavy work — return fast ValidationResult objects.
enable_pii_redaction() only scrubs messages going to the LLM. Your local chat history still has the raw prompt — keep it secure or scrub it separately.

Approval

Human-in-the-loop approvals for sensitive operations

Guardrails

Input and output validation with custom rules

Security Environment Variables

Secure handling of API keys and secrets

Hooks

Event system for BEFORE_LLM and BEFORE_TOOL hooks