fermilink.agents package¶
- class fermilink.agents.AgentRegistry[source]¶
Bases:
objectLookup registry for provider adapters.
- __init__(agents)[source]¶
- Parameters:
agents (Iterable[ProviderAgent])
- Return type:
None
- all()[source]¶
- Return type:
tuple[ProviderAgent, …]
- class fermilink.agents.ClaudeAgent[source]¶
Bases:
ProviderAgentClaude provider adapter with provider-native CLI translation.
- REASONING_MAP = {'xhigh': 'high'}¶
- SANDBOX_PERMISSION_MODE = {'read-only': 'plan', 'workspace-write': 'acceptEdits'}¶
- property bin_env_key: str¶
Return environment key used for binary override lookup.
- build_exec_command(*, provider_bin, repo_dir, prompt, sandbox_policy=DEFAULT_SANDBOX_POLICY, sandbox_mode=None, model=None, reasoning_effort=None, json_output=True)[source]¶
Build provider-specific argv for one exec/chat invocation.
- Parameters:
provider_bin (str)
repo_dir (Path)
prompt (str)
sandbox_policy (str)
sandbox_mode (str | None)
model (str | None)
reasoning_effort (str | None)
json_output (bool)
- Return type:
list[str]
- property default_binary: str¶
Return provider CLI default binary name.
- ensure_workspace_instruction_alias(repo_dir)¶
Ensure the provider instruction alias points to
AGENTS.md.- Parameters:
repo_dir (Path)
- Return type:
None
- extract_assistant_text_chunk(event)¶
Extract one assistant text chunk and whether it is a delta chunk.
- Parameters:
event (dict)
- Return type:
tuple[str, bool]
- normalize_process_home(env)¶
Normalize any provider-specific writable home paths.
- Parameters:
env (dict[str, str])
- Return type:
dict[str, str]
- prepare_final_reply_capture_command(command, *, last_message_path, json_output)¶
Apply provider-specific command tweaks for final-reply file capture.
- Parameters:
command (list[str])
last_message_path (Path)
json_output (bool)
- Return type:
list[str]
- prepare_one_shot_exec_command(command)¶
Apply provider-specific command tweaks for one-shot exec runs.
- Parameters:
command (list[str])
- Return type:
list[str]
- prepare_runtime_env(env, *, model=None, reasoning_effort=None)¶
Apply provider runtime env overrides and return cleanup paths.
- Parameters:
env (dict[str, str])
model (str | None)
reasoning_effort (str | None)
- Return type:
tuple[dict[str, str], list[Path]]
Apply provider-specific command tweaks for shared chat/loop turns.
- Parameters:
command (list[str])
last_message_path (Path)
- Return type:
list[str]
- property provider: str¶
Return canonical provider id (for example
codex).
- provider_id()¶
- Return type:
str
- remove_workspace_instruction_alias_symlink(repo_dir)¶
Remove the provider alias symlink while leaving real files untouched.
- Parameters:
repo_dir (Path)
- Return type:
None
- render_stream_event(event, *, use_color=True)¶
Convert one provider stream event to human-readable terminal text.
- Parameters:
event (dict)
use_color (bool)
- Return type:
str | None
- resolve_binary(*, provider_bin_override=None)¶
Resolve executable name/path for this provider.
- Parameters:
provider_bin_override (str | None)
- Return type:
str
- resolve_binary_override(raw_override=None)¶
Resolve an optional compatibility override for this provider binary.
- Parameters:
raw_override (str | None)
- Return type:
str | None
- sanitize_process_env(env)¶
Apply provider-specific subprocess environment sanitation.
- Parameters:
env (dict[str, str])
- Return type:
dict[str, str]
- service_env_overrides(*, cwd)¶
Return provider-specific service env vars derived from the parent env.
- Parameters:
cwd (Path)
- Return type:
dict[str, str]
- supports_auto_compile_metadata_generation()¶
Return whether this provider supports auto-compile metadata generation.
- Return type:
bool
- supports_direct_terminal_stream()¶
Return whether direct terminal passthrough is preferred for this provider.
- Return type:
bool
- uses_json_output_for_second_guess()¶
Return whether second-guess subprocesses should request JSON output.
- Return type:
bool
- class fermilink.agents.CodexAgent[source]¶
Bases:
ProviderAgentCodex provider adapter with parity to the legacy command builder.
- property bin_env_key: str¶
Return environment key used for binary override lookup.
- build_exec_command(*, provider_bin, repo_dir, prompt, sandbox_policy=DEFAULT_SANDBOX_POLICY, sandbox_mode=None, model=None, reasoning_effort=None, json_output=True)[source]¶
Build provider-specific argv for one exec/chat invocation.
- Parameters:
provider_bin (str)
repo_dir (Path)
prompt (str)
sandbox_policy (str)
sandbox_mode (str | None)
model (str | None)
reasoning_effort (str | None)
json_output (bool)
- Return type:
list[str]
- property default_binary: str¶
Return provider CLI default binary name.
- ensure_workspace_instruction_alias(repo_dir)¶
Ensure the provider instruction alias points to
AGENTS.md.- Parameters:
repo_dir (Path)
- Return type:
None
- extract_assistant_text_chunk(event)¶
Extract one assistant text chunk and whether it is a delta chunk.
- Parameters:
event (dict)
- Return type:
tuple[str, bool]
- normalize_process_home(env)[source]¶
Normalize any provider-specific writable home paths.
- Parameters:
env (dict[str, str])
- Return type:
dict[str, str]
- prepare_final_reply_capture_command(command, *, last_message_path, json_output)[source]¶
Apply provider-specific command tweaks for final-reply file capture.
- Parameters:
command (list[str])
last_message_path (Path)
json_output (bool)
- Return type:
list[str]
- prepare_one_shot_exec_command(command)[source]¶
Apply provider-specific command tweaks for one-shot exec runs.
- Parameters:
command (list[str])
- Return type:
list[str]
- prepare_runtime_env(env, *, model=None, reasoning_effort=None)¶
Apply provider runtime env overrides and return cleanup paths.
- Parameters:
env (dict[str, str])
model (str | None)
reasoning_effort (str | None)
- Return type:
tuple[dict[str, str], list[Path]]
Apply provider-specific command tweaks for shared chat/loop turns.
- Parameters:
command (list[str])
last_message_path (Path)
- Return type:
list[str]
- property provider: str¶
Return canonical provider id (for example
codex).
- provider_id()¶
- Return type:
str
- remove_workspace_instruction_alias_symlink(repo_dir)¶
Remove the provider alias symlink while leaving real files untouched.
- Parameters:
repo_dir (Path)
- Return type:
None
- render_stream_event(event, *, use_color=True)¶
Convert one provider stream event to human-readable terminal text.
- Parameters:
event (dict)
use_color (bool)
- Return type:
str | None
- resolve_binary(*, provider_bin_override=None)[source]¶
Resolve executable name/path for this provider.
- Parameters:
provider_bin_override (str | None)
- Return type:
str
- resolve_binary_override(raw_override=None)[source]¶
Resolve an optional compatibility override for this provider binary.
- Parameters:
raw_override (str | None)
- Return type:
str | None
- sanitize_process_env(env)[source]¶
Apply provider-specific subprocess environment sanitation.
- Parameters:
env (dict[str, str])
- Return type:
dict[str, str]
- service_env_overrides(*, cwd)[source]¶
Return provider-specific service env vars derived from the parent env.
- Parameters:
cwd (Path)
- Return type:
dict[str, str]
- supports_auto_compile_metadata_generation()[source]¶
Return whether this provider supports auto-compile metadata generation.
- Return type:
bool
- supports_direct_terminal_stream()[source]¶
Return whether direct terminal passthrough is preferred for this provider.
- Return type:
bool
- uses_json_output_for_second_guess()[source]¶
Return whether second-guess subprocesses should request JSON output.
- Return type:
bool
- uses_json_stream()¶
Return whether shared CLI execution should request stream-json output.
- Return type:
bool
- workspace_instruction_alias_name()¶
Return provider-native instruction alias filename, if any.
- Return type:
str | None
- class fermilink.agents.DeepseekAgent[source]¶
Bases:
ProviderAgentDeepSeek provider adapter with provider-native CLI translation.
- property bin_env_key: str¶
Return environment key used for binary override lookup.
- build_exec_command(*, provider_bin, repo_dir, prompt, sandbox_policy=DEFAULT_SANDBOX_POLICY, sandbox_mode=None, model=None, reasoning_effort=None, json_output=True)[source]¶
Build provider-specific argv for one exec/chat invocation.
- Parameters:
provider_bin (str)
repo_dir (Path)
prompt (str)
sandbox_policy (str)
sandbox_mode (str | None)
model (str | None)
reasoning_effort (str | None)
json_output (bool)
- Return type:
list[str]
- property default_binary: str¶
Return provider CLI default binary name.
- ensure_workspace_instruction_alias(repo_dir)¶
Ensure the provider instruction alias points to
AGENTS.md.- Parameters:
repo_dir (Path)
- Return type:
None
- extract_assistant_text_chunk(event)¶
Extract one assistant text chunk and whether it is a delta chunk.
- Parameters:
event (dict)
- Return type:
tuple[str, bool]
- normalize_process_home(env)¶
Normalize any provider-specific writable home paths.
- Parameters:
env (dict[str, str])
- Return type:
dict[str, str]
- prepare_final_reply_capture_command(command, *, last_message_path, json_output)¶
Apply provider-specific command tweaks for final-reply file capture.
- Parameters:
command (list[str])
last_message_path (Path)
json_output (bool)
- Return type:
list[str]
- prepare_one_shot_exec_command(command)¶
Apply provider-specific command tweaks for one-shot exec runs.
- Parameters:
command (list[str])
- Return type:
list[str]
- prepare_runtime_env(env, *, model=None, reasoning_effort=None)¶
Apply provider runtime env overrides and return cleanup paths.
- Parameters:
env (dict[str, str])
model (str | None)
reasoning_effort (str | None)
- Return type:
tuple[dict[str, str], list[Path]]
Apply provider-specific command tweaks for shared chat/loop turns.
- Parameters:
command (list[str])
last_message_path (Path)
- Return type:
list[str]
- property provider: str¶
Return canonical provider id (for example
codex).
- provider_id()¶
- Return type:
str
- remove_workspace_instruction_alias_symlink(repo_dir)¶
Remove the provider alias symlink while leaving real files untouched.
- Parameters:
repo_dir (Path)
- Return type:
None
- render_stream_event(event, *, use_color=True)¶
Convert one provider stream event to human-readable terminal text.
- Parameters:
event (dict)
use_color (bool)
- Return type:
str | None
- resolve_binary(*, provider_bin_override=None)¶
Resolve executable name/path for this provider.
- Parameters:
provider_bin_override (str | None)
- Return type:
str
- resolve_binary_override(raw_override=None)¶
Resolve an optional compatibility override for this provider binary.
- Parameters:
raw_override (str | None)
- Return type:
str | None
- sanitize_process_env(env)¶
Apply provider-specific subprocess environment sanitation.
- Parameters:
env (dict[str, str])
- Return type:
dict[str, str]
- service_env_overrides(*, cwd)¶
Return provider-specific service env vars derived from the parent env.
- Parameters:
cwd (Path)
- Return type:
dict[str, str]
- supports_auto_compile_metadata_generation()¶
Return whether this provider supports auto-compile metadata generation.
- Return type:
bool
- supports_direct_terminal_stream()¶
Return whether direct terminal passthrough is preferred for this provider.
- Return type:
bool
- uses_json_output_for_second_guess()¶
Return whether second-guess subprocesses should request JSON output.
- Return type:
bool
- uses_json_stream()[source]¶
Return whether shared CLI execution should request stream-json output.
- Return type:
bool
- workspace_instruction_alias_name()¶
Return provider-native instruction alias filename, if any.
- Return type:
str | None
- class fermilink.agents.GeminiAgent[source]¶
Bases:
ProviderAgentGemini provider adapter with provider-native CLI translation.
- property bin_env_key: str¶
Return environment key used for binary override lookup.
- build_exec_command(*, provider_bin, repo_dir, prompt, sandbox_policy=DEFAULT_SANDBOX_POLICY, sandbox_mode=None, model=None, reasoning_effort=None, json_output=True)[source]¶
Build provider-specific argv for one exec/chat invocation.
- Parameters:
provider_bin (str)
repo_dir (Path)
prompt (str)
sandbox_policy (str)
sandbox_mode (str | None)
model (str | None)
reasoning_effort (str | None)
json_output (bool)
- Return type:
list[str]
- property default_binary: str¶
Return provider CLI default binary name.
- ensure_workspace_instruction_alias(repo_dir)¶
Ensure the provider instruction alias points to
AGENTS.md.- Parameters:
repo_dir (Path)
- Return type:
None
- extract_assistant_text_chunk(event)¶
Extract one assistant text chunk and whether it is a delta chunk.
- Parameters:
event (dict)
- Return type:
tuple[str, bool]
- normalize_process_home(env)¶
Normalize any provider-specific writable home paths.
- Parameters:
env (dict[str, str])
- Return type:
dict[str, str]
- prepare_final_reply_capture_command(command, *, last_message_path, json_output)¶
Apply provider-specific command tweaks for final-reply file capture.
- Parameters:
command (list[str])
last_message_path (Path)
json_output (bool)
- Return type:
list[str]
- prepare_one_shot_exec_command(command)¶
Apply provider-specific command tweaks for one-shot exec runs.
- Parameters:
command (list[str])
- Return type:
list[str]
- prepare_runtime_env(env, *, model=None, reasoning_effort=None)[source]¶
Apply provider runtime env overrides and return cleanup paths.
- Parameters:
env (dict[str, str])
model (str | None)
reasoning_effort (str | None)
- Return type:
tuple[dict[str, str], list[Path]]
Apply provider-specific command tweaks for shared chat/loop turns.
- Parameters:
command (list[str])
last_message_path (Path)
- Return type:
list[str]
- property provider: str¶
Return canonical provider id (for example
codex).
- provider_id()¶
- Return type:
str
- remove_workspace_instruction_alias_symlink(repo_dir)¶
Remove the provider alias symlink while leaving real files untouched.
- Parameters:
repo_dir (Path)
- Return type:
None
- render_stream_event(event, *, use_color=True)¶
Convert one provider stream event to human-readable terminal text.
- Parameters:
event (dict)
use_color (bool)
- Return type:
str | None
- resolve_binary(*, provider_bin_override=None)¶
Resolve executable name/path for this provider.
- Parameters:
provider_bin_override (str | None)
- Return type:
str
- resolve_binary_override(raw_override=None)¶
Resolve an optional compatibility override for this provider binary.
- Parameters:
raw_override (str | None)
- Return type:
str | None
- sanitize_process_env(env)¶
Apply provider-specific subprocess environment sanitation.
- Parameters:
env (dict[str, str])
- Return type:
dict[str, str]
- service_env_overrides(*, cwd)¶
Return provider-specific service env vars derived from the parent env.
- Parameters:
cwd (Path)
- Return type:
dict[str, str]
- supports_auto_compile_metadata_generation()¶
Return whether this provider supports auto-compile metadata generation.
- Return type:
bool
- supports_direct_terminal_stream()¶
Return whether direct terminal passthrough is preferred for this provider.
- Return type:
bool
- uses_json_output_for_second_guess()¶
Return whether second-guess subprocesses should request JSON output.
- Return type:
bool
- class fermilink.agents.ProviderAgent[source]¶
Bases:
ABCBase provider contract for binary resolution and command assembly.
- abstract property bin_env_key: str¶
Return environment key used for binary override lookup.
- build_exec_command(*, provider_bin, repo_dir, prompt, sandbox_policy=DEFAULT_SANDBOX_POLICY, sandbox_mode=None, model=None, reasoning_effort=None, json_output=True)[source]¶
Build provider-specific argv for one exec/chat invocation.
- Parameters:
provider_bin (str)
repo_dir (Path)
prompt (str)
sandbox_policy (str)
sandbox_mode (str | None)
model (str | None)
reasoning_effort (str | None)
json_output (bool)
- Return type:
list[str]
- abstract property default_binary: str¶
Return provider CLI default binary name.
- ensure_workspace_instruction_alias(repo_dir)[source]¶
Ensure the provider instruction alias points to
AGENTS.md.- Parameters:
repo_dir (Path)
- Return type:
None
- extract_assistant_text_chunk(event)[source]¶
Extract one assistant text chunk and whether it is a delta chunk.
- Parameters:
event (dict)
- Return type:
tuple[str, bool]
- normalize_process_home(env)[source]¶
Normalize any provider-specific writable home paths.
- Parameters:
env (dict[str, str])
- Return type:
dict[str, str]
- prepare_final_reply_capture_command(command, *, last_message_path, json_output)[source]¶
Apply provider-specific command tweaks for final-reply file capture.
- Parameters:
command (list[str])
last_message_path (Path)
json_output (bool)
- Return type:
list[str]
- prepare_one_shot_exec_command(command)[source]¶
Apply provider-specific command tweaks for one-shot exec runs.
- Parameters:
command (list[str])
- Return type:
list[str]
- prepare_runtime_env(env, *, model=None, reasoning_effort=None)[source]¶
Apply provider runtime env overrides and return cleanup paths.
- Parameters:
env (dict[str, str])
model (str | None)
reasoning_effort (str | None)
- Return type:
tuple[dict[str, str], list[Path]]
Apply provider-specific command tweaks for shared chat/loop turns.
- Parameters:
command (list[str])
last_message_path (Path)
- Return type:
list[str]
- abstract property provider: str¶
Return canonical provider id (for example
codex).
- remove_workspace_instruction_alias_symlink(repo_dir)[source]¶
Remove the provider alias symlink while leaving real files untouched.
- Parameters:
repo_dir (Path)
- Return type:
None
- render_stream_event(event, *, use_color=True)[source]¶
Convert one provider stream event to human-readable terminal text.
- Parameters:
event (dict)
use_color (bool)
- Return type:
str | None
- resolve_binary(*, provider_bin_override=None)[source]¶
Resolve executable name/path for this provider.
- Parameters:
provider_bin_override (str | None)
- Return type:
str
- resolve_binary_override(raw_override=None)[source]¶
Resolve an optional compatibility override for this provider binary.
- Parameters:
raw_override (str | None)
- Return type:
str | None
- sanitize_process_env(env)[source]¶
Apply provider-specific subprocess environment sanitation.
- Parameters:
env (dict[str, str])
- Return type:
dict[str, str]
- service_env_overrides(*, cwd)[source]¶
Return provider-specific service env vars derived from the parent env.
- Parameters:
cwd (Path)
- Return type:
dict[str, str]
- supports_auto_compile_metadata_generation()[source]¶
Return whether this provider supports auto-compile metadata generation.
- Return type:
bool
- supports_direct_terminal_stream()[source]¶
Return whether direct terminal passthrough is preferred for this provider.
- Return type:
bool
- uses_json_output_for_second_guess()[source]¶
Return whether second-guess subprocesses should request JSON output.
- Return type:
bool
Submodules¶
- fermilink.agents.base module
ProviderAgentProviderAgent.bin_env_keyProviderAgent.build_exec_command()ProviderAgent.default_binaryProviderAgent.ensure_workspace_instruction_alias()ProviderAgent.extract_assistant_text_chunk()ProviderAgent.normalize_process_home()ProviderAgent.prepare_final_reply_capture_command()ProviderAgent.prepare_one_shot_exec_command()ProviderAgent.prepare_runtime_env()ProviderAgent.prepare_shared_turn_command()ProviderAgent.providerProviderAgent.provider_id()ProviderAgent.remove_workspace_instruction_alias_symlink()ProviderAgent.render_stream_event()ProviderAgent.resolve_binary()ProviderAgent.resolve_binary_override()ProviderAgent.sanitize_process_env()ProviderAgent.service_env_overrides()ProviderAgent.supports_auto_compile_metadata_generation()ProviderAgent.supports_direct_terminal_stream()ProviderAgent.uses_json_output_for_second_guess()ProviderAgent.uses_json_stream()ProviderAgent.workspace_instruction_alias_name()
insert_option_before_prompt()
- fermilink.agents.claude_agent module
ClaudeAgentClaudeAgent.REASONING_MAPClaudeAgent.SANDBOX_PERMISSION_MODEClaudeAgent.bin_env_keyClaudeAgent.build_exec_command()ClaudeAgent.default_binaryClaudeAgent.ensure_workspace_instruction_alias()ClaudeAgent.extract_assistant_text_chunk()ClaudeAgent.normalize_process_home()ClaudeAgent.prepare_final_reply_capture_command()ClaudeAgent.prepare_one_shot_exec_command()ClaudeAgent.prepare_runtime_env()ClaudeAgent.prepare_shared_turn_command()ClaudeAgent.providerClaudeAgent.provider_id()ClaudeAgent.remove_workspace_instruction_alias_symlink()ClaudeAgent.render_stream_event()ClaudeAgent.resolve_binary()ClaudeAgent.resolve_binary_override()ClaudeAgent.sanitize_process_env()ClaudeAgent.service_env_overrides()ClaudeAgent.supports_auto_compile_metadata_generation()ClaudeAgent.supports_direct_terminal_stream()ClaudeAgent.uses_json_output_for_second_guess()ClaudeAgent.uses_json_stream()ClaudeAgent.workspace_instruction_alias_name()
- fermilink.agents.codex_agent module
CodexAgentCodexAgent.bin_env_keyCodexAgent.build_exec_command()CodexAgent.default_binaryCodexAgent.ensure_workspace_instruction_alias()CodexAgent.extract_assistant_text_chunk()CodexAgent.normalize_process_home()CodexAgent.prepare_final_reply_capture_command()CodexAgent.prepare_one_shot_exec_command()CodexAgent.prepare_runtime_env()CodexAgent.prepare_shared_turn_command()CodexAgent.providerCodexAgent.provider_id()CodexAgent.remove_workspace_instruction_alias_symlink()CodexAgent.render_stream_event()CodexAgent.resolve_binary()CodexAgent.resolve_binary_override()CodexAgent.sanitize_process_env()CodexAgent.service_env_overrides()CodexAgent.supports_auto_compile_metadata_generation()CodexAgent.supports_direct_terminal_stream()CodexAgent.uses_json_output_for_second_guess()CodexAgent.uses_json_stream()CodexAgent.workspace_instruction_alias_name()
- fermilink.agents.deepseek_agent module
DeepseekAgentDeepseekAgent.bin_env_keyDeepseekAgent.build_exec_command()DeepseekAgent.default_binaryDeepseekAgent.ensure_workspace_instruction_alias()DeepseekAgent.extract_assistant_text_chunk()DeepseekAgent.normalize_process_home()DeepseekAgent.prepare_final_reply_capture_command()DeepseekAgent.prepare_one_shot_exec_command()DeepseekAgent.prepare_runtime_env()DeepseekAgent.prepare_shared_turn_command()DeepseekAgent.providerDeepseekAgent.provider_id()DeepseekAgent.remove_workspace_instruction_alias_symlink()DeepseekAgent.render_stream_event()DeepseekAgent.resolve_binary()DeepseekAgent.resolve_binary_override()DeepseekAgent.sanitize_process_env()DeepseekAgent.service_env_overrides()DeepseekAgent.supports_auto_compile_metadata_generation()DeepseekAgent.supports_direct_terminal_stream()DeepseekAgent.uses_json_output_for_second_guess()DeepseekAgent.uses_json_stream()DeepseekAgent.workspace_instruction_alias_name()
- fermilink.agents.gemini_agent module
GeminiAgentGeminiAgent.bin_env_keyGeminiAgent.build_exec_command()GeminiAgent.default_binaryGeminiAgent.ensure_workspace_instruction_alias()GeminiAgent.extract_assistant_text_chunk()GeminiAgent.normalize_process_home()GeminiAgent.prepare_final_reply_capture_command()GeminiAgent.prepare_one_shot_exec_command()GeminiAgent.prepare_runtime_env()GeminiAgent.prepare_shared_turn_command()GeminiAgent.providerGeminiAgent.provider_id()GeminiAgent.remove_workspace_instruction_alias_symlink()GeminiAgent.render_stream_event()GeminiAgent.resolve_binary()GeminiAgent.resolve_binary_override()GeminiAgent.sanitize_process_env()GeminiAgent.service_env_overrides()GeminiAgent.supports_auto_compile_metadata_generation()GeminiAgent.supports_direct_terminal_stream()GeminiAgent.uses_json_output_for_second_guess()GeminiAgent.uses_json_stream()GeminiAgent.workspace_instruction_alias_name()
- fermilink.agents.registry module