Set organization and project policies
Restrict environment sizes, agent tools, model call limits and project-owned resources across your organization or in one project.
Set guardrails on what environments, agents, LLM Gateway and Secrets allow. Anyone with Viewer or a product role can see the policies that apply; editing policies requires Owner or Policy Admin, on the Team or Enterprise plan (Limits and quotas).
An organization's policy applies to every project, and a project can only tighten what its organization allows.
Edit a policy or retention window in the console
- In your organization, click Settings, then Policies (for guardrails) or Data retention (for retention windows on agents, sites, stopped environments and request logs). To tighten a rule for one project alone, open the project's Settings › Policies or Settings › Data retention instead.
- Beside the policy you want to change, click Edit.
- Set the constraint:
- For a boolean policy, select Enforce (or clear it to unset).
- For an allow-list policy (such as Allowed tools), select Only those chosen and select the allowed values, or select all.
- For a maximum or retention policy (such as Largest disk or Agent and file retention), enter the maximum value within kosem's bounds, or clear it to inherit.
- Click Save.
Changes take effect within seconds across kosem. Lowering a retention policy deletes older records during the next hourly cleanup pass.
Update a policy with the API
Policies use JSON Merge Patch (application/merge-patch+json) and optimistic concurrency with ETag and If-Match. Set your API key (Call the API) and your organization's ID:
export KOSEM_API_KEY='kosem_sk_…'
export KOSEM_ORG='org_01m5r8w2k3e9vbt6g0d4x7qz1h'Read a policy first to get its current ETag response header:
curl -s -i "https://api.kosem.ai/v1/organizations/$KOSEM_ORG/policies/environments.maxDiskGib" \
-H "Authorization: Bearer $KOSEM_API_KEY"Set a maximum disk size of 50 GiB across all projects (send {"spec": null} to unset a policy):
export KOSEM_ETAG='"Mg"'
curl -s -X PATCH "https://api.kosem.ai/v1/organizations/$KOSEM_ORG/policies/environments.maxDiskGib" \
-H "Authorization: Bearer $KOSEM_API_KEY" \
-H "Content-Type: application/merge-patch+json" \
-H "If-Match: $KOSEM_ETAG" \
-d '{"spec": {"max": 50}}'To tighten a policy for a single project, call /v1/projects/$KOSEM_PROJECT/policies/{constraint} instead. If someone changed the policy since you read it, kosem answers 412 with ETAG_MISMATCH (Errors).