Policies
A policy decides every request an agent makes:allow, ask or deny.
Here: write one, test it without a model, and read its decisions.
Start from a profile, add a rule
A built-in profile plus the one rule you need:issue_refund call now pauses for a person
(Approvals).
Or set "profile": "..." alone. The three profiles on the same four calls
(the script is below):
lookup_order is your tool, search an MCP tool. A delete is high-risk,
so interactive-dev’s ask_high_risk asks. Every profile rule:
policy reference.
A rule
A rule:deny, ask or allow.
How a request is decided
A deny rule matches: denied
Otherwise an ask rule matches: a person decides
Otherwise an allow rule matches: allowed
Otherwise the mode decides
permissive allows, interactive asks, strict denies. The decision’s
reason_code is unknown_capability and matched_rule_ids is empty.matched_rule_ids lists every matching rule in the winning list.
Test a rule before you run
Build the request a tool call makes and ask the evaluator the agent uses. No model needed:tool_provider: local, workspace, artifact, mcp (with
tool_server), skill, sandbox or code. write_file fell through to
strict mode. Put checks like these in your tests.
The profile comparison above:
Three ways to give the policy
- A dict
- Objects
- A policy file
lookups only matches lookup_order.)policy nor policy_path, an
omnicoreagent.policy.json or .omnicoreagent/policy.json in the project
root is merged onto the profile. It can only narrow: its deny and ask
rules are added, the stricter mode wins, and a wider allow is refused.Read the decision
Each tool call in a trajectory has agovernance list:
trajectory["harness"]["governance"] has the policy_hash. An approved
ask shows two entries: ask, then allow with approved.
Options
Inagent_config["governance_config"]:
When things go wrong
ValueError: governance_config cannot set both policy and policy_path
ValueError: governance_config cannot set both policy and policy_path
OmniCoreAgent(...). Pick one: the policy in code, or the file.PolicyLoadError: Policy file is inside an agent-writable directory
PolicyLoadError: Policy file is inside an agent-writable directory
policies/.PolicyLoadError: Policy file escapes trusted project root
PolicyLoadError: Policy file escapes trusted project root
project_root, which is the current directory unless
you set it (path shortened here):project_root to a directory that contains the file, or move it.
Policy file not found: ... means the path is wrong; a relative path is
read from the current directory.PolicyLoadError: YAML policy loading is not enabled
PolicyLoadError: YAML policy loading is not enabled
PolicyLoadError: Auto-discovered policy allow rule broadens the default baseline
PolicyLoadError: Auto-discovered policy allow rule broadens the default baseline
omnicoreagent.policy.json that the agent found on its own tried to
allow something the profile does not:policy_path.A rule is rejected when the policy is built
A rule is rejected when the policy is built
rule_id must be unique across the policy; the fields are those in
A rule; the mode is permissive, interactive or strict.ApprovalRequiredError when the agent connects to an MCP server
ApprovalRequiredError when the agent connects to an MCP server
mcp.server.start and mcp.server.connect are decided when the agent
connects, outside any run, so there is nothing to pause. An ask there
(as in interactive-dev) fails the connection:name you gave them in mcp_tools:
{"rule_id": "docs_server", "capability": "mcp.server.*", "target": {"mcp_server": "docs"}}.
An allow does not lift a profile’s ask, so with a profile, also remove
its ask rule:docs server now connects; any other server is still asked about,
and so still fails to connect.