Auth & Permissions Module
Overview
Policy enforcement and access control for AI agents
The Auth & Permissions Module is the policy and access layer for the entire platform. It ensures every agent, workflow, tool call, and write action happens within a clearly defined set of permissions. Instead of giving agents broad raw access to APIs or systems, this module sits between the agent and the external world.
Authentication & Registration Models
The platform supports two distinct authentication and registration paths. Each path determines how an agent is created, who owns it, and which permissions layer applies.
Human users authenticate with a bearer token prefixed with ap_.
When registering an agent with this token, the agent is created with owner_id set to the user.
- • Agents count against the user's plan limit
- • Visible in the user's dashboard
- • Inherits RBAC roles and policies scoped to the owner
- • Header:
X-API-Key: ap_your_key
Agents can self-register without a user API key. The agent is created with owner_id: nil and receives its own agent-specific API key.
- • No owner at creation time
- • Not visible in any user's dashboard until claimed
- • Authenticates with its own API key (no
ap_prefix) - • Can later be assigned to a user via
POST /api/v1/agents/assign
Permission Implications
Autonomous agents without an owner do not inherit any user-scoped RBAC roles or policies. They operate solely under platform-wide defaults and any directly-assigned roles. Once an agent is assigned to a user, it falls under that user's permission boundary.
Core Features
Role-Based Access Control
Define roles with specific permissions. Assign roles to agents based on trust level and function.
- • Custom role creation with priorities
- • Permission inheritance
- • System-level protected roles
Policy Engine
Create allow/deny policies with conditions. Policies are evaluated before every action.
- • Resource pattern matching
- • Time-based conditions
- • Risk-level assessment
Approval Workflows
High-risk actions require human approval before execution.
- • Configurable risk thresholds
- • Multi-reviewer support
- • Expiration and escalation
Scoped Credentials
Temporary elevated access with automatic expiration and revocation.
- • Create time-limited elevated credentials
- • Revoke at any time
- • Audit trail for all credential usage
Agent Role Assignment
Assign and revoke roles for individual agents with full permission introspection.
- • Assign roles to any agent
- • Revoke roles dynamically
- • Inspect agent's effective roles and permissions
Policy Templates
Pre-built policy templates for common industries and use cases:
- • Transaction limits
- • Payment approvals
- • Audit requirements
- • PHI access controls
- • HIPAA compliance
- • Data retention policies
- • Department isolation
- • Role hierarchies
- • Compliance workflows
Permission Attributes
Risk Levels
Data Sensitivity
Per-Tool Permissions
Grant permissions scoped to specific tools and actions.
{
"name": "slack_post_messages",
"resource_type": "tool",
"action": "execute",
"tool_name": "slack",
"tool_action": "post_message",
"risk_level": "medium"
}
API Endpoints
Roles
/api/v1/auth/roles
List all roles.
/api/v1/auth/roles
Create a new role.
/api/v1/auth/roles/:id
Get role details.
/api/v1/auth/roles/:id
Update a role.
/api/v1/auth/roles/:id
Delete a role.
/api/v1/auth/roles/:role_id/permissions/:permission_id
Grant a permission to a role.
Permissions
/api/v1/auth/permissions
List all permissions.
/api/v1/auth/permissions
Create a new permission.
Policies
/api/v1/auth/policies
List all policies for the authenticated agent.
/api/v1/auth/policies
Create a new policy with conditions.
{
"name": "deny_production_writes",
"effect": "deny",
"resource_pattern": "production:*",
"action_pattern": "write",
"conditions": { "time_restricted": true }
}
/api/v1/auth/policies/evaluate
Evaluate a policy against a given context and action.
Approval Requests
/api/v1/auth/approval-requests
List approval requests.
/api/v1/auth/approval-requests
Request approval for a high-risk action.
/api/v1/auth/approval-requests/:id/approve
Approve a pending request (reviewers only).
/api/v1/auth/approval-requests/:id/reject
Reject a pending request (reviewers only).
Scoped Credentials
/api/v1/auth/scoped-credentials
Create scoped credentials for temporary elevated access.
/api/v1/auth/scoped-credentials/:id
Revoke scoped credentials.
Policy Templates
/api/v1/auth/policy-templates
List available policy templates.
/api/v1/auth/policy-templates/:id
Get policy template details.
/api/v1/auth/policy-templates/:id/apply
Apply a policy template to create policies from the template.
Agent Role Assignment
/api/v1/auth/agents/:agent_id/roles/:role_id
Assign a role to an agent.
/api/v1/auth/agents/:agent_id/roles/:role_id
Revoke a role from an agent.
/api/v1/auth/agents/:agent_id/roles
Get all roles assigned to an agent.
/api/v1/auth/agents/:agent_id/permissions
Get all effective permissions for an agent (from assigned roles).
Best Practices
Security
- Use scoped credentials instead of raw API keys
- Set up approval workflows for write operations
- Regularly audit policy assignments
Configuration
- Start with deny-by-default policies
- Use industry templates as starting points
- Separate dev and production environments