Mandate
agent_gate.mandate
¶
The mandate: what the agent may touch, and the gate's own limits.
A person writes the mandate as TOML. The gate looks for it at
$AGENT_GATE_MANDATE, then at .agent_gate/mandate.toml in the working
directory or any parent. Without one, the gate asks before every
consequential action.
Mandate(source, digest='none', task='', paths=(), hosts=(), git_remotes=(), recipients=(), mcp_tools=(), max_denials=3, retry_similarity=0.85, outward='ask', model=ModelConfig())
dataclass
¶
The task, its targets and the gate's limits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Path | None
|
the mandate file, or |
required |
found
property
¶
True when a mandate file was loaded.
allows_host(host)
¶
True when host is a listed host or a subdomain of one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
host
|
str
|
a hostname, any case. |
required |
Source code in src/agent_gate/mandate.py
71 72 73 74 75 76 77 | |
allows_path(path)
¶
True when path lies under a mandate path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
an absolute, resolved path. |
required |
Source code in src/agent_gate/mandate.py
64 65 66 67 68 69 | |
allows_recipient(address)
¶
True when address is a listed recipient.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address
|
str
|
an email address. |
required |
Source code in src/agent_gate/mandate.py
87 88 89 90 91 92 | |
allows_remote(remote)
¶
True when remote (host/owner/repo) is a listed git remote.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
remote
|
str
|
a normalized remote, as :func: |
required |
Source code in src/agent_gate/mandate.py
79 80 81 82 83 84 85 | |
ModelConfig(enabled=False, backend='anthropic', model='claude-haiku-5-5', effort='low', endpoint='http://localhost:8080/v1', api_key_env='SYNTH_API_KEY', timeout_seconds=20.0)
dataclass
¶
Settings for the System 1 model gate.
backend is anthropic (the Claude API) or openai (any
OpenAI-compatible server, such as oMLX or Ollama, at endpoint). The
openai backend sends the value of the api_key_env variable as a
bearer token when it is set.
find_mandate(cwd)
¶
Locate the mandate file for a working directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cwd
|
Path
|
the directory the agent is working in. |
required |
Returns:
| Type | Description |
|---|---|
Path | None
|
the mandate path, or |
Source code in src/agent_gate/mandate.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
load_mandate(cwd)
¶
Load the mandate that governs cwd.
Relative paths in the file resolve against the project directory, the
parent of .agent_gate/.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cwd
|
Path
|
the directory the agent is working in. |
required |
Returns:
| Type | Description |
|---|---|
Mandate
|
the mandate; |
Source code in src/agent_gate/mandate.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |