spec-ai-policy
Policy enforcement and plugin system for the spec-ai framework.
Overview
This crate provides the policy engine that controls and restricts agent behavior through:
- Policy Engine: Rule-based enforcement of agent capabilities and permissions
- Plugin System: Extensible architecture for adding custom policies
- Tool Restrictions: Control which tools agents can access
- Agent Profiles: Different permission sets for different agent types
Features
The policy system enables:
- Tool Allowlists: Explicitly allow specific tools per agent profile
- Tool Denylists: Block specific tools from being used
- Memory Limits: Control conversation history retention (
memory_k) - Temperature Controls: Enforce temperature ranges per agent
- Custom Policies: Extend with custom policy plugins
Agent Profiles
Define agents with different capabilities through policy configuration:
[]
= "You are a helpful coding assistant"
= 0.3
= ["file_read", "file_write", "bash", "file_extract"]
= 10
[]
= "You are a research assistant"
= 0.8
= ["bash", "file_write"]
= 20
The prompt_user tool is implicitly allowed unless explicitly denied, ensuring agents can always escalate to humans for clarification.
Dependencies
This crate depends on:
spec-ai-config- Configuration management
Usage
This is an internal crate used by:
spec-ai-core- For enforcing policies during agent executionspec-ai-api- For API-level policy enforcementspec-ai-cli- For CLI command restrictions
For end-user documentation, see the main spec-ai README.