docs: add Secure Agent Design guide - #6796
Conversation
Add a dedicated required-reading guide covering trust boundaries, prompt injection (direct and indirect), tool abuse, output validation, approval gates, limited delegation, and agent isolation. Register it under Guides > Agents and cross-link from related production docs. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdded a comprehensive Secure Agent Design guide. It covers trust boundaries, prompt injection, tool abuse, validation, approvals, delegation, and isolation. Related architecture, agent, MCP, and navigation pages now link to the guide. ChangesSecure Agent Design documentation
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a new Edge documentation guide, Secure Agent Design, and wires it into navigation and related pages to serve as a production-focused security checklist for building tool-using agents in CrewAI.
Changes:
- Introduces a new
Secure Agent Designguide covering trust boundaries, prompt injection, tool abuse controls, output validation, approval gates, delegation limits, and isolation patterns. - Adds cross-links from existing production/security documentation to the new guide.
- Registers the new guide in
docs/docs.jsonunder Guides → Agents.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/edge/en/mcp/security.mdx | Adds a “broader production checklist” link to Secure Agent Design. |
| docs/edge/en/guides/agents/secure-agent-design.mdx | New production security checklist guide with patterns and code examples. |
| docs/edge/en/guides/agents/crafting-effective-agents.mdx | Adds a tip linking to Secure Agent Design for production readers. |
| docs/edge/en/concepts/production-architecture.mdx | Adds a Security section and summary bullet linking to Secure Agent Design. |
| docs/docs.json | Adds the new guide to the Guides → Agents navigation group. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Clarify framework primitives vs design patterns, document hook fail-open behavior, fix memory isolation and sandbox guidance, soften brittle guardrail examples, and expand the production checklist (A2A trust, HITL providers, SSRF/egress, red-team). Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
Replace placeholder tools with SerperDevTool/ScrapeWebsiteTool/FileReadTool and a typed SendEmailTool, wire complete Agent/Task/Crew examples, use sanitized tool-hook names, and make flow/guardrail snippets self-contained. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
docs/edge/en/guides/agents/secure-agent-design.mdx:268
- The
constrain_writeshook example is doing a very naive path check (only".."and POSIX absolute paths viastartswith("/")). SinceFileWriterToolalso takes adirectoryargument (and runs on non-POSIX systems), this example can be misleading for production security guidance. Consider validating the full resolved path usingcrewai_tools.security.safe_path.validate_file_path, which also handles symlinks and platform-specific path semantics, and abort with the actual validation error.
filename = ctx.tool_input.get("filename", "")
if ".." in filename or filename.startswith("/"):
raise HookAborted(
reason="invalid file path",
source="file-policy",
Strip overbuilt Agent/Crew/Flow samples back to short snippets, and point cross-links at /edge/en/... so mint broken-links passes for the edge-only guide. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
docs/edge/en/guides/agents/secure-agent-design.mdx:109
- This new edge-only guide uses internal links with the
/en/...prefix (e.g. Tool hooks/LLM hooks/HITL/Task guardrails). In the edge docs, internal links should use/edge/en/...(as in other pages likedocs/edge/en/learn/tool-hooks.mdx) and the PR description says this was done to keepmintlify broken-linkspassing. Please update these (and the other/en/...links elsewhere in this page) to/edge/en/....
| Hard blocks on dangerous calls | [Tool hooks](/en/learn/tool-hooks) (`PRE_TOOL_CALL` + `HookAborted`) |
| Inspect model traffic | [LLM hooks](/en/learn/llm-hooks) |
| Human approval for irreversible actions | Tool hooks + [HITL](/en/learn/human-in-the-loop) |
| Output checks before side effects | [Task guardrails](/en/concepts/tasks#task-guardrails) |
OSS CrewAI is typically used in operator-controlled environments. Remove the shipping checklist and soften production-required framing. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
agent.kickoff() uses AgentExecutor and returns LiteAgentOutput; it does not run through a LiteAgent class. Update Secure Agent Design and the Agents concept note accordingly. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/edge/en/concepts/agents.mdx`:
- Around line 641-644: Sync the `kickoff()` documentation update from
`docs/edge/en/concepts/agents.mdx` into the corresponding Arabic, Korean, and
Brazilian Portuguese MDX files, following the mappings and translation
requirements in `DOCS_TRANSLATIONS.md`; preserve the same AgentExecutor behavior
and LiteAgentOutput details in each translation.
- Around line 641-644: Synchronize the direct kickoff() section across the
localized agent concept docs: add the complete English-equivalent section to the
Arabic and Brazilian Portuguese files, and update the Korean note to use the
AgentExecutor symbol. Keep the content and LiteAgentOutput return behavior
consistent across all locales.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4417a52c-1d44-47a6-b658-88f0f968bd01
📒 Files selected for processing (2)
docs/edge/en/concepts/agents.mdxdocs/edge/en/guides/agents/secure-agent-design.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/edge/en/guides/agents/secure-agent-design.mdx
Rewrite the guide in short factual prose aligned with actual CrewAI behavior: kickoff vs Task/Crew controls, Agent.guardrail kickoff-only, global CrewBase hooks, tool HookAborted scope, fail-open hooks, and memory fallback. Add ar/ko/pt-BR pages and nav entries. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
pt-BR/ko lack a2a-agent-delegation; all locales lack e2bsandboxtools. Point those hrefs at the English pages so mint broken-links passes. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
Detect changes failed intermittently with a self-signed certificate error when dorny/paths-filter (node20 action forced onto Node 24) called the GitHub API. Set NODE_OPTIONS=--use-system-ca on those steps. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
This reverts commit ed030e4.
Shorten sentences, define controls in plain language, and drop jargon such as fail-open and ACL. Keep the same APIs, path differences, and locale coverage. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
Keep the guide focused on threat model and execution-path behavior, point knobs at Customize Agents, warn that backstory is a soft control, replace the Flow stub with a state handoff, and add the missing pt-BR kickoff note. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
Align Secure Agent Design with the human_input contract: post-run output review, no tool gate, and no check of who approved. Keep pre-execution blocking on tool hooks. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
Keep the approval-vs-control note in the overview and section 6 only. Shorten the tables and related-guide card. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
Use response_format and result.pydantic so the Flow handoff is OutreachNotes, not a raw string dump. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
Adds a Secure Agent Design guide under Guides → Agents. The guide covers trusted vs untrusted input, prompt injection, tool abuse, output checks, approval gates, delegation limits, and agent isolation.
This page is the design and threat-model guide. Execution limits (
max_rpm,max_iter,max_execution_time), verbosity, and agent settings stay on Agents and Customize Agents, so an Advanced config page can own those knobs without overlapping this guide.HITL is approval, not a control. That warning lives in the overview and in section 6 only. Task
human_input=Truereviews the final answer after tools ran; it does not gate tool execution. Pre-execution blocking stays on tool hooks (HookAborted). This matches thehuman_inputcontract called out in #7096.The isolation Flow example now stores validated
OutreachNotes(response_format+result.pydantic) and passes onlyclaimsandsourcesto the sender. It does not dumpresult.raw.The prose is simplified technical English: short sentences, defined terms, and no jargon such as “fail open” or “ACL”. The same APIs and execution-path limits remain.
Accuracy notes (matched to code):
agent.kickoff()usesAgentExecutor/LiteAgentOutput. It does not create a Task or a Crew.Agent.guardrailruns on kickoff only. Task guardrails andhuman_inputrun on the Task path.@CrewBase@onhooks are added to the global hook list when the crew is created.HookAbortedblocks that tool call. The run continues.HookAborted, CrewAI ignores the error and the tool still runs.memory=Falseon an agent does not turn off crew memory.allow_delegationdefaults toFalse. A2Atrust_remote_completion_statusdefaults toFalse.Also in this update:
backstoryexample is labeled as a soft control.concepts/agents.mdxnow has the directkickoff()section and theAgentExecutor/LiteAgentOutputnote.Locales: edge
en,pt-BR,ko, andarpages plus nav entries. Frozendocs/v*/is unchanged.Locale links to EN-only A2A and E2B pages keep the
/en/...prefix somint broken-linkspasses. The Arabic kickoff note now matches the EnglishAgentExecutorbehavior.