Skip to main content
The trust split: authorization decisions (which tools to grant) come from ctx.trusted.claims (set by verified JWT middleware), while non-privileged customization comes from ctx.input (the client request body). This is the most realistic multi-tenant pattern. The factory uses the JWT role to decide tool access, and the client can customize the theme, but tool access stays driven by the JWT role.

Caller-State Truth Table

The behavior depends on JWT middleware configuration. With validate=True: With validate=False (as written below):

Run the Example

Full source: cookbook/05_agent_os/factories/agent/03_jwt_role_factory.py