Session-level policies are the most granular level of governance in Omnigent. They apply only to a single session and are evaluated before agent-spec policies and server-wide default policies. You can attach policies at any time during a session’s lifetime — for example, to restrict what tools are available for a specific task, or to require human approval before sensitive operations.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/omnigent-ai/omnigent/llms.txt
Use this file to discover all available pages before exploring further.
List Session Policies
GET /v1/sessions/{session_id}/policies
Returns all active policies for a session. Includes both store-persisted policies (added via the API or chat) and spec-declared policies (defined in the agent’s YAML). Spec-declared policies have id: null and cannot be patched or deleted through this API.
Path parameter: session_id — the session/conversation identifier.
Response:
Policy identifier, e.g.
"pol_abc123". null for spec-declared policies.Human-readable policy name. Unique within the session.
Handler discriminator:
"python" or "url".Dotted import path (python) or HTTPS URL (url).
Whether the policy is currently active.
"session" for API-attached policies; "spec" for agent-spec-declared policies.Attach a Policy
POST /v1/sessions/{session_id}/policies
Attaches a new policy to a running session.
Human-readable policy name. Must be unique within the session, e.g.
"ask_on_os_tools".Handler discriminator:
"python" (dotted import path) or "url" (HTTPS endpoint).The policy callable. For
type: "python": a dotted import path, e.g. "omnigent.policies.ask_on_os_tools". For type: "url": an HTTPS endpoint, e.g. "https://policies.example.com/eval".Optional keyword arguments passed to the handler when it is a factory function. Only valid for
type: "python". Example: {"allow_list": ["git", "npm"]}.ask_on_os_tools:
409 Conflict if a policy with the same name already exists on the session.
Get a Session Policy
GET /v1/sessions/{session_id}/policies/{policy_id}
Retrieves a single session policy by ID.
Update a Session Policy
PATCH /v1/sessions/{session_id}/policies/{policy_id}
Updates a policy’s mutable fields. The type field is immutable — delete and re-create to change it.
New policy name.
null leaves unchanged.New handler path or URL.
null leaves unchanged.Enable (
true) or disable (false) the policy. null leaves unchanged.Remove a Policy
DELETE /v1/sessions/{session_id}/policies/{policy_id}
Removes a policy from the session. Idempotent — deleting a missing policy returns 204.
Evaluate a Policy
POST /v1/sessions/{session_id}/policies/evaluate
Evaluates all policies for a session against a hypothetical action, without executing it. Useful for testing policy configurations before deploying them, or for hook-driven integrations (e.g. Claude Code’s PreToolUse hook).
The request body follows the proto-compatible EvaluationRequest envelope:
EvaluationResponse:
Policy verdict:
"ALLOW", "DENY", or "ASK" (requires elicitation).Human-readable explanation of a non-ALLOW verdict.
For content-rewriting policies, the modified request payload.
null otherwise.Policy Evaluation Order
Session-level policies are evaluated in this order:- Session policies (attached via
POST /v1/sessions/{id}/policies) — most specific - Agent spec policies (declared in the agent’s YAML
policies:block) - Server-wide default policies (managed via
GET /v1/policies) — most general
DENY or ASK verdict in any layer wins. ALLOW continues to the next layer.
For built-in policy handlers and their
factory_params schemas, see the Policy Registry and the Built-in Policies reference.
For the governance model and policy authoring guide, see Policies guide.