Overview
This guide focuses on CrewAI-native controls you can use to reduce security risk in production systems. The goal is simple: keep agent behavior bounded, least-privileged, and reviewable.1) Bound execution to prevent runaway behavior
Use execution limits on agents and crews so failures degrade predictably instead of spiraling.Recommended controls
max_rpm: cap request rate to providersmax_iter: cap iterative reasoning/tool cyclesmax_execution_time: hard timeout for long-running work
2) Apply least privilege to tools
Avoid giving every tool to every agent. Give each agent only the tools required for its task.Why this matters
- Reduces blast radius for prompt injection or logic errors
- Prevents accidental access to unrelated systems
- Improves traceability of who can do what
3) Treat delegation as a trust boundary
Whenallow_delegation=True, an agent can route work to other agents. That can be useful, but it is also a security boundary.
Safe delegation patterns
- Keep delegation disabled by default
- Enable it only for roles that truly need orchestration
- Pair delegation with clear task constraints and bounded execution
4) Constrain outputs with schemas and expectations
Use structured outputs whenever possible to reduce ambiguous or unsafe free-form responses.Recommended controls
output_pydanticfor schema-validated task outputexpected_outputto describe strict acceptance criteria
5) Add human oversight for high-stakes actions
For sensitive operations (for example financial actions, production mutations, or customer-impacting changes), add human review at the right point in the execution path.What human_input=True does
Task human_input=True pauses after the agent has run its tools and produced a result. It prompts for human feedback on the final answer before that output is accepted and finalized. It does not gate tool execution — an agent on a task with human_input=True can still call destructive or side-effect tools before any human sees the run.
Use human_input=True when you want a human to review, refine, or approve the task output before it becomes the official result (for example training workflows or quality review).
When you need approval before tools run
For checkpoints such as:- Before running irreversible tools
- Before external side effects (emails, tickets, writes)
- Before policy or security exceptions
- Tool hooks with
@on(InterceptionPoint.PRE_TOOL_CALL)andrequest_human_input()— blocks the tool call until approved - Execution hooks on Crew and Flow runs
- @human_feedback on Flow steps for workflow-level approval
verbose=True on agents involved in sensitive flows so execution details are easier to inspect during debugging and incident review.
Operational checklist
Use this quick checklist before production rollout:- Every agent has bounded execution (
max_rpm,max_iter,max_execution_time) - Tool access is scoped per role (no broad shared tool list)
- Delegation is disabled unless explicitly required
- High-impact tasks use
output_pydanticand preciseexpected_output - Pre-execution approval gates exist for irreversible or side-effect tools (tool hooks, Flow hooks, or
@human_feedback) -
human_input=Trueis used only where post-run output review is sufficient - Agent runs are logged or traced for post-incident review
