Design governance, safety, policy enforcement, trust scoring, and audit controls for AI agent systems. Use when building agents with external tools, policy-based tool access, semantic intent classification, dangerous prompt detection, multi-agent trust workflows, rate limits, content filters, or audit trails across PydanticAI, CrewAI, OpenAI Agents, LangChain, or AutoGen.
Add governance controls to AI agent systems so tool use, content handling, delegation, rate, and accountability stay inside explicit safety and trust boundaries.
When to invoke
"Add governance to an agent that calls external tools."
"Implement policy-based access control for agent tools."
"Detect dangerous prompts before tool execution."
"Create trust scoring for a multi-agent workflow."
"Add audit trails, rate limits, content filters, or tool restrictions."
1---2name: agent-governance3description: Design governance, safety, policy enforcement, trust scoring, and audit controls for AI agent systems. Use when building agents with external tools, policy-based tool access, semantic intent classification, dangerous prompt detection, multi-agent trust workflows, rate limits, content filters, or audit trails across PydanticAI, CrewAI, OpenAI Agents, LangChain, or AutoGen.4---56<!-- Generated from harness/github-copilot/skills/agent-governance/SKILL.md by harness/claude-code/scripts/convert_from_copilot.py. Edit the source, not this file. -->78# Agent governance patterns910Add governance controls to AI agent systems so tool use, content handling, delegation, rate, and accountability stay inside explicit safety and trust boundaries.1112## When to invoke1314- "Add governance to an agent that calls external tools."15- "Implement policy-based access control for agent tools."16- "Detect dangerous prompts before tool execution."17- "Create trust scoring for a multi-agent workflow."18- "Add audit trails, rate limits, content filters, or tool restrictions."1920## Governance flow2122```text23User Request → Intent Classification → Policy Check → Tool Execution → Audit Log24 ↓ ↓ ↓25 Threat Detection Allow/Deny Trust Update26```2728Apply controls before tool execution, update trust after outcomes, and write audit records for both allowed and denied actions.2930## Governance levels3132| Level | Controls | Use case |33| --- | --- | --- |34| Open | Audit only, no restrictions. | Internal dev/testing. |35| Standard | Tool allowlist plus content filters. | General production agents. |36| Strict | All controls plus human approval for sensitive operations. | Financial, healthcare, legal. |37| Locked | Allowlist only, no dynamic tools, full audit. | Compliance-critical systems. |3839## Control patterns4041| Pattern | Rule | Failure mode prevented |42| --- | --- | --- |43| Policy as configuration | Store policies in YAML/JSON, not hardcoded. | Code deploy required for every policy change. |44| Most-restrictive-wins | Deny always overrides allow when composing policies. | A permissive policy bypasses a stricter one. |45| Pre-flight intent check | Classify intent before tool execution. | Dangerous action is detected only after side effects. |46| Tool allowlist | Permit only named tools for each role, context, or trust level. | Dynamic tool access expands beyond review. |47| Content filter | Block secrets, prompt injection, unsafe content, or regulated data flows. | Agent processes content it must not handle. |48| Human approval | Require approval for high-impact or irreversible operations. | Agent autonomously performs sensitive changes. |49| Rate limit | Bound requests, tool calls, tokens, or cost by actor and time window. | Runaway agent loops or cost spikes. |50| Trust decay | Decay trust scores over time. | Old good behavior grants permanent privilege. |51| Append-only audit | Never modify or delete audit entries. | Compliance evidence can be rewritten. |52| Fail closed | Deny action when governance checks error. | Safety system outage becomes allow-all. |53| Separate policy from logic | Keep enforcement independent from agent business logic. | Business code accidentally bypasses governance. |5455## Implementation checklist5657```markdown58## Agent Governance Implementation Checklist5960### Setup61- [ ] Define governance policy (allowed tools, blocked patterns, rate limits)62- [ ] Choose governance level (open/standard/strict/locked)63- [ ] Set up audit trail storage6465### Implementation66- [ ] Add @govern decorator to all tool functions67- [ ] Add intent classification to user input processing68- [ ] Implement trust scoring for multi-agent interactions69- [ ] Wire up audit trail export7071### Validation72- [ ] Test that blocked tools are properly denied73- [ ] Test that content filters catch sensitive patterns74- [ ] Test rate limiting behavior75- [ ] Verify audit trail captures all events76- [ ] Test policy composition (most-restrictive-wins)77```7879## Framework integration cues8081| Framework | Integration seam |82| --- | --- |83| PydanticAI | Wrap tools or dependencies with a policy check before invocation. |84| CrewAI | Gate crew tools and delegation tasks by role and trust level. |85| OpenAI Agents | Enforce tool allowlists and approval steps before tool calls execute. |86| LangChain | Wrap tools, callbacks, and chains with policy and audit middleware. |87| AutoGen | Gate inter-agent messages, delegation, and tool execution. |8889Read `references/pattern-implementations.md` before writing code for policy objects, classifiers, decorators, trust scoring, audit trails, or framework-specific examples.9091## Criteria9293- [ ] The agent's external tools, APIs, databases, file systems, and shell access are inventoried.94- [ ] Each tool has an allow, deny, approval, and audit rule.95- [ ] Intent classification runs before side-effecting tools.96- [ ] Dangerous prompt, sensitive data, and content filter rules are explicit.97- [ ] Trust scores have update and decay rules.98- [ ] Audit records are append-only and include actor, intent, tool, decision, timestamp, and outcome.99- [ ] Governance errors fail closed.100101## Gotchas102103- **Do not hardcode policy in tool bodies**: policy must be reviewable and changeable outside business logic.104- **Do not rely on audit-only for production sensitive operations**: audit after harm is not prevention.105- **Do not let dynamic tool discovery bypass allowlists**: discovered tools still need explicit policy.106- **Do not delete audit entries**: corrections should append compensating records.107108## Progressive disclosure and bundled resources109110- `references/pattern-implementations.md`: concrete implementations for policy, classifier, decorator, trust scoring, audit trail, and framework integration.111112## Environment shorthand113114Use open governance for `dev/testing`; increase controls before production.115116## Output template117118```markdown119## Agent governance plan120121**Status:** ready | implemented | blocked122**Governance level:** open | standard | strict | locked123**Agent/framework:** <name>124125| Control | Decision | Evidence or implementation |126| --- | --- | --- |127| Tool allowlist | <rule> | <policy path or code seam> |128| Intent classifier | <rule> | <classifier/prompt/model> |129| Human approval | <rule> | <approval path> |130| Audit trail | <rule> | <storage/export> |131| Trust scoring | <rule> | <update/decay formula> |132133### Validation134- Blocked tool denied: pass | fail135- Content filter tested: pass | fail136- Rate limit tested: pass | fail137- Audit event captured: pass | fail138```139140## Quality gate141142- [ ] Governance level is selected based on risk: open, standard, strict, or locked.143- [ ] Policies are configuration or data, not scattered hardcoded conditionals.144- [ ] Most-restrictive-wins behavior is implemented or specified.145- [ ] Side-effecting tool calls require pre-flight intent and policy checks.146- [ ] Audit logging is append-only and records allowed and denied actions.147- [ ] Trust scoring includes decay over time.148- [ ] Fail-closed behavior is tested for policy, classifier, and audit failures.149150## References151152- [Agent Governance Toolkit](https://github.com/microsoft/agent-governance-toolkit)153- [AgentMesh Integrations](https://github.com/microsoft/agent-governance-toolkit)154- [OWASP Top 10 for LLM Applications](https://owasp.org/www-project-top-10-for-large-language-model-applications/)
Run npx skillmds@latest add paulasilvatech/agent-governance in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Design governance, safety, policy enforcement, trust scoring, and audit controls for AI agent systems. Use when building agents with external tools, policy-based tool access, semantic intent classification, dangerous prompt detection, multi-agent trust workflows, rate limits, content filters, or audit trails across PydanticAI, CrewAI, OpenAI Agents, LangChain, or AutoGen. It is listed under AI & ML on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
paulasilvatech (@paulasilvatech) published this skill. Their other Agent Skills are listed on their SkillMD profile.