Skip to main content
Define custom scope mappings for your AgentOS endpoints to create your own permission structure.
Custom mappings merge with the defaults: routes you list use your scopes, and unlisted routes keep their default requirements. On agent, team, and workflow paths that include a resource ID (like POST /agents/{id}/runs), the middleware rewrites each required scope into the native namespace, keeping only the action. Mapping app:run there means the token needs agents:run for that agent; the custom namespace is ignored. The route handlers check the same native scopes. Custom scopes apply as written on all other paths, such as sessions, memories, and config. Tokens with the configured admin_scope bypass every check.
1

Create a Python file

custom_scope_mappings.py
2

Set up your virtual environment

3

Install dependencies

4

Export your OpenAI API key

5

Setup PostgreSQL Database

6

Run the AgentOS

7

Test Custom Scopes