fermilink.agent_runtime module

class fermilink.agent_runtime.AgentRuntimePolicy[source]

Bases: object

AgentRuntimePolicy(provider: ‘str’ = ‘codex’, sandbox_policy: ‘str’ = ‘enforce’, sandbox_mode: ‘str’ = ‘workspace-write’, model: ‘str | None’ = None, reasoning_effort: ‘str | None’ = None)

__init__(provider='codex', sandbox_policy='enforce', sandbox_mode='workspace-write', model=None, reasoning_effort=None)
Parameters:
  • provider (str)

  • sandbox_policy (str)

  • sandbox_mode (str)

  • model (str | None)

  • reasoning_effort (str | None)

Return type:

None

as_dict()[source]
Return type:

dict[str, str | None]

as_env()[source]
Return type:

dict[str, str]

model: str | None = None
provider: str = 'codex'
reasoning_effort: str | None = None
sandbox_mode: str = 'workspace-write'
sandbox_policy: str = 'enforce'
fermilink.agent_runtime.load_agent_runtime_policy(*, config_path=None)[source]

Load agent runtime policy settings from disk.

Parameters:

config_path (Path | None) – Optional explicit path to the runtime policy file.

Returns:

Loaded runtime policy, or defaults when file is missing/invalid.

Return type:

AgentRuntimePolicy

fermilink.agent_runtime.normalize_model(raw)[source]

Normalize an optional agent model override.

Parameters:

raw (str | None) – Raw model value from user input or configuration.

Returns:

Trimmed model id, or None when unset.

Return type:

str | None

fermilink.agent_runtime.normalize_provider(raw)[source]

Normalize and validate an agent provider name.

Parameters:

raw (str | None) – Raw value from user input or configuration.

Returns:

Normalized provider value.

Return type:

str

fermilink.agent_runtime.normalize_reasoning_effort(raw)[source]

Normalize an optional agent reasoning-effort override.

Parameters:

raw (str | None) – Raw reasoning-effort value from user input or configuration.

Returns:

Lowercased effort value, or None when unset.

Return type:

str | None

fermilink.agent_runtime.normalize_sandbox_mode(raw)[source]

Normalize and validate an agent sandbox mode string.

Parameters:

raw (str | None) – Raw value from user input or configuration.

Returns:

Normalized sandbox mode value.

Return type:

str

fermilink.agent_runtime.normalize_sandbox_policy(raw)[source]

Normalize and validate an agent sandbox policy.

Parameters:

raw (str | None) – Raw value from user input or configuration.

Returns:

Normalized sandbox policy value.

Return type:

str

fermilink.agent_runtime.resolve_agent_runtime_path()[source]

Return the path to the persisted agent runtime policy file.

Returns:

Absolute path to the runtime policy file.

Return type:

Path

fermilink.agent_runtime.resolve_agent_runtime_policy(*, provider=None, sandbox_policy=None, sandbox_mode=None, model=_MODEL_UNSET, reasoning_effort=_REASONING_EFFORT_UNSET, env=None, config_path=None)[source]

Resolve the effective agent runtime policy with override precedence.

Parameters:
  • provider (str | None) – Provider identifier (for example codex, claude, gemini, or deepseek).

  • sandbox_policy (str | None) – Sandbox policy override (enforce or bypass).

  • sandbox_mode (str | None) – Sandbox mode override passed to the provider runtime.

  • model (str | None | object) – Optional model override. Use None to clear persisted model override, or leave unset to keep the current value.

  • reasoning_effort (str | None | object) – Optional reasoning-effort override (low, medium, high, xhigh). Use None to clear persisted override, or leave unset to keep the current value.

  • env (Mapping[str, str] | None) – Environment mapping used when resolving override variables.

  • config_path (Path | None) – Optional explicit path to the runtime policy file.

Returns:

Effective runtime policy after applying precedence rules.

Return type:

AgentRuntimePolicy

fermilink.agent_runtime.save_agent_runtime_policy(*, provider=None, sandbox_policy=None, sandbox_mode=None, model=_MODEL_UNSET, reasoning_effort=_REASONING_EFFORT_UNSET, config_path=None)[source]

Persist agent runtime policy settings and return the stored policy.

Parameters:
  • provider (str | None) – Provider identifier (for example codex, claude, gemini, or deepseek).

  • sandbox_policy (str | None) – Sandbox policy override (enforce or bypass).

  • sandbox_mode (str | None) – Sandbox mode override passed to the provider runtime.

  • model (str | None | object) – Optional model override. Use None to clear persisted model override, or leave unset to keep the current value.

  • reasoning_effort (str | None | object) – Optional reasoning-effort override (low, medium, high, xhigh). Use None to clear persisted override, or leave unset to keep the current value.

  • config_path (Path | None) – Optional explicit path to the runtime policy file.

Returns:

Persisted runtime policy object.

Return type:

AgentRuntimePolicy