Overview
Policies provide fine-grained access control rules that are evaluated during authorization. Each policy has an effect (allow or deny), a priority, and optional filters for agent, principal, scopes, and time-of-day restrictions.
Access the policies client via client.policies.
Create
Create a new authorization policy:CreatePolicyParams
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
name | str | Yes | — | Human-readable name for the policy. |
effect | str | Yes | — | "allow" or "deny". |
priority | int | No | 0 | Higher priority policies are evaluated first. |
agent_id | str | None | No | None | Restrict to a specific agent. |
principal_id | str | None | No | None | Restrict to a specific principal (user). |
scopes | list[str] | None | No | None | Restrict to specific scopes. |
time_of_day_start | str | None | No | None | Start of allowed/denied time window (HH:MM). |
time_of_day_end | str | None | No | None | End of allowed/denied time window (HH:MM). |
List
List all policies for your developer account:ListPoliciesResponse
| Field | Type | Description |
|---|---|---|
policies | tuple[Policy, ...] | The list of policies. |
total | int | Total number of policies. |
Get
Retrieve a single policy by its ID:Update
Update an existing policy. Only fields you provide will be modified:UpdatePolicyParams
| Field | Type | Required | Description |
|---|---|---|---|
name | str | None | No | New name for the policy. |
effect | str | None | No | New effect ("allow" or "deny"). |
priority | int | None | No | New priority value. |
agent_id | str | None | No | New agent filter. |
principal_id | str | None | No | New principal filter. |
scopes | list[str] | None | No | New scope filter. |
time_of_day_start | str | None | No | New time window start (HH:MM). |
time_of_day_end | str | None | No | New time window end (HH:MM). |
Delete
Delete a policy by its ID:Policy Type
ThePolicy frozen dataclass has the following fields:
| Field | Type | Description |
|---|---|---|
id | str | Unique policy identifier. |
name | str | Human-readable policy name. |
effect | str | "allow" or "deny". |
priority | int | Evaluation priority (higher = first). |
agent_id | str | None | Agent filter (if set). |
principal_id | str | None | Principal filter (if set). |
scopes | tuple[str, ...] | None | Scope filter (if set). |
time_of_day_start | str | None | Time window start. |
time_of_day_end | str | None | Time window end. |
created_at | str | ISO 8601 creation timestamp. |
updated_at | str | ISO 8601 last-updated timestamp. |