agent as a first-class principal - the same way users are granted access to resources today.
This is orthogonal to patterns like Task-Based Authorization. Even if you use task-scoped permissions, you still want to constrain what an agent can do in general - beyond the permissions required for a specific task.
This guide shows how to model agents as principals in a OpenFGA authorization model using an issue-tracking application as an example. The agent receives permissions on domain resources (projects, issues) and inherits access through the same hierarchy that users do.
Authorization model
The following issue-tracking model treatsagent as a first-class principal alongside user:
If your current model is user-centric, the main change is to allow agent anywhere you already allow user for the relationships an agent should hold.
In this example:
agentis added as an allowed subject onorganization.member,project.member,issue.reporter, andissue.assignee.- No new permission types or hierarchies are needed - agents participate in the same structure as users.
agent can now appear in the same relations as user. If your application wants project members to edit projects or issues, that is a separate permission-model decision.
Granting access to agents
Grant an agent membership on a specific project:can_read includes member, this single tuple lets agent:triage-bot read the project and its issues. The agent still cannot edit or delete anything - can_edit and can_delete retain the original owner and admin requirements.
Checking permissions
The examples below assume the issue is linked to its project:can_delete requires reporter or project-level can_delete (which requires owner or admin):
Direct assignment for fine-grained control
Instead of granting project-wide access, you can assign the agent directly to a specific issue:issue:issue-456 but has no access to other issues in the project.
Organization-level agent access
You can also grant an agent membership at the organization level. This gives it read access to all projects in the organization:can_read on every project that belongs to organization:acme, and through that, can read all issues in those projects.
When to use this pattern
Modeling agents as principals works well when:- Your application already has a user-centric authorization model.
- Agents act inside your application’s own domain.
- You want agents to inherit access through the same resource hierarchy as users.
- You want to grant durable, non-task-specific permissions such as project membership or issue assignment.
Migration strategy
If your application already has a user-centric model:- Add the
agenttype to your model. - Include
agentin selected relations where agents need access (member,assignee,reporter, etc.). - Write tuples to grant agents access at the appropriate scope (organization, project, or issue).
- Check permissions using the same API calls you use for users - just with
agent:as the subject. If you want to check for both user and agent permissions, perform a batch check call.
Recommendations
- Least privilege: grant the narrowest scope possible. Prefer project-level membership over organization-level membership.
- Avoid wildcards: do not use
agent:*in production grants.
Related sections
Take a look at the following sections for more information.Task-Based Authorization
Grant agents access to perform specific actions only when necessary, with task-scoped permissions.
RAG Authorization
Ensure AI agents only retrieve documents users are authorized to access.
Authorization for MCP Servers
Control which tools users can access on an MCP server.