How to Secure Agents Acting on Behalf of Users

Jun 9, 2025

2 mins

Matt (Co-Founder and CEO)

AI agents are transformative, but allowing them to act on behalf of users introduces significant security challenges. The key is to design delegation flows that are verifiable, revocable, and safe at scale. This isn't about giving agents full user access; it's about granting them just enough permission to fulfill their delegated tasks, securely and transparently.

1. Establish a Clear, Verifiable Delegation Event

Every agent action on behalf of a user must be traceable back to a specific, auditable delegation event. This means:

  • Explicit User Consent: The user must explicitly authorize the agent to perform certain types of actions or achieve a specific goal. This isn't a one-time "accept all" permission but rather a context-aware grant.

  • Intent Capture: The system should capture the intent behind the delegation. What specific task or outcome is the user asking the agent to achieve? This intent forms the basis for the agent's authorized scope.

  • Digital Signature/Proof of Delegation: Implement mechanisms (e.g., signed tokens, verifiable credentials) that link the agent's identity and its requested actions directly to the user's initial authorization. This creates an undeniable audit trail.

2. Implement Fine-Grained, Dynamic Scoping

Forget broad "admin" roles or static API keys. Agent access needs to be precisely controlled:

  • Least Privilege by Default: Agents should only have the minimum permissions necessary for their immediate task. No more.

  • Time-Bound Access: Grant credentials that are short-lived and automatically expire. This drastically reduces the window of opportunity for attackers if a token is compromised.

  • Intent-Bound Credentials: Link the agent's access directly to the captured intent. If the agent deviates from its original purpose, its credentials should become invalid. This is where a Domain Specific Language (DSL) for access control becomes powerful, allowing you to express complex access policies based on context.

  • Conditional Access: Permissions can be conditional based on factors like time of day, IP address, or specific data attributes.

3. Prioritize Revocability and Lifecycle Management

The ability to instantly revoke an agent's access is paramount:

  • Granular Revocation: Don't just revoke all of an agent's access. Be able to revoke specific permissions or a single delegated task without impacting other legitimate agent activities.

  • User-Initiated Revocation: Users must have a clear and easy way to review and revoke any delegations they've granted to agents, similar to managing app permissions on a smartphone.

  • Automated Lifecycle Management: Tie agent identity and credentials to their lifecycle. When an agent completes its task or is de-provisioned, its access should be automatically revoked.

4. Implement Strong Agent Identity and Authentication

Agents need their own first-class identity, separate from human users:

  • Unique Agent IDs: Every agent instance should have a unique, auditable identifier.

  • Cryptographic Attestation: Agents should prove their identity cryptographically (e.g., using certificates or signed attestations) before being granted access.

  • Secure Credential Delivery: Never embed sensitive credentials directly into agent code. Use secure secrets management systems to deliver credentials at runtime.

5. Comprehensive Auditing and Monitoring

If you can't see it, you can't secure it:

  • Full Audit Trails: Log every action an agent takes, linked back to its unique ID, the originating user's delegation, and the specific intent.

  • Anomaly Detection: Monitor agent behavior for deviations from expected patterns. Unusual API calls, data access, or resource usage could signal a compromise.

  • User Notification: Inform users about significant actions taken by agents on their behalf, allowing them to detect and report unauthorized activity.