fractal.impl package#
Submodules#
fractal.impl.claude module#
Claude Code CLI agent implementation.
- class fractal.impl.claude.ClaudeParser(*, model=None)[source]#
Bases:
StreamParserParser for claude
--output-format stream-jsonoutput.- Parameters:
self (
ClaudeParser)model (
str|None)
Initialize
ClaudeParser.Track the last-priced message id to skip per-block repeats.
- Parameters:
self (
ClaudeParser)model (
str|None)
- feed(line)[source]#
Parse one claude stream line into normalized events.
- Parameters:
self (
ClaudeParser)line (
str)
- Return type:
list[StreamEvent]
- class fractal.impl.claude.ClaudeAgent(node, command=None, provider=None)[source]#
Bases:
AgentClaude Code CLI backend (cost-reporting, caller-minted sessions).
Initialize
Agent.- Parameters:
node (
Node) – The node this agent runs for (config dirs, worktree, ledger).command (
str|None) – Full agent command (e.g.'claude --some-flag'); defaults to the node’s configured agent. Extra words are spliced into every invocation.provider (
str|None) – Provider-route override;Nonemeans native (Node.agentthreads the node’s effective configured route).self (
Agent)
- name: str = 'claude'#
- config_file: str = 'settings.json'#
- can_fork: bool = True#
- mints_session: bool = False#
- needs_pricing: bool = False#
- cost_scope: str = 'call'#
- enforces_budget: bool = True#
- providers: tuple[str, ...] = ('openrouter',)#
- parser(*, model=None)[source]#
Return the stream parser for the bound route.
- Parameters:
self (
ClaudeAgent)model (
str|None)
- Return type:
- tracks_cost(model=None)[source]#
Return whether spend will be recorded.
Natively claude reports its own figures on the stream; through openrouter the close is chain-priced from the result usage, so only a priced model tracks.
- Parameters:
self (
ClaudeAgent)model (
str|None)
- Return type:
bool
fractal.impl.codex module#
Codex CLI agent implementation.
- class fractal.impl.codex.CodexParser(*, model=None)[source]#
Bases:
StreamParserParser for codex
exec --jsonoutput.- Parameters:
self (
CodexParser)model (
str|None)
Initialize
CodexParser.Bind the configured-model fallback and start the wall clock.
- Parameters:
self (
CodexParser)model (
str|None)
- feed(line)[source]#
Parse one codex JSONL line into normalized events.
- Parameters:
self (
CodexParser)line (
str)
- Return type:
list[StreamEvent]
- class fractal.impl.codex.CodexAgent(node, command=None, provider=None)[source]#
Bases:
AgentCodex CLI backend (token-priced, agent-minted threads, no fork).
Initialize
Agent.- Parameters:
node (
Node) – The node this agent runs for (config dirs, worktree, ledger).command (
str|None) – Full agent command (e.g.'claude --some-flag'); defaults to the node’s configured agent. Extra words are spliced into every invocation.provider (
str|None) – Provider-route override;Nonemeans native (Node.agentthreads the node’s effective configured route).self (
Agent)
- name: str = 'codex'#
- config_file: str = 'config.toml'#
- can_fork: bool = False#
- mints_session: bool = True#
- needs_pricing: bool = True#
- cost_scope: str = 'thread'#
- enforces_budget: bool = False#
- providers: tuple[str, ...] = ('openrouter',)#
fractal.impl.grok module#
Grok Build CLI agent implementation.
- class fractal.impl.grok.GrokParser(*, model=None)[source]#
Bases:
StreamParserParser for grok
--output-format streaming-jsonoutput.- Parameters:
self (
GrokParser)model (
str|None)
Initialize
GrokParser.Bind the configured-model fallback and start the wall clock.
- Parameters:
self (
GrokParser)model (
str|None)
- feed(line)[source]#
Parse one grok NDJSON event line into normalized events.
- Parameters:
self (
GrokParser)line (
str)
- Return type:
list[StreamEvent]
- class fractal.impl.grok.GrokAgent(node, command=None, provider=None)[source]#
Bases:
AgentGrok Build CLI backend (cost-reporting, caller-minted sessions).
Initialize
Agent.- Parameters:
node (
Node) – The node this agent runs for (config dirs, worktree, ledger).command (
str|None) – Full agent command (e.g.'claude --some-flag'); defaults to the node’s configured agent. Extra words are spliced into every invocation.provider (
str|None) – Provider-route override;Nonemeans native (Node.agentthreads the node’s effective configured route).self (
Agent)
- name: str = 'grok'#
- config_file: str = 'config.toml'#
- can_fork: bool = True#
- mints_session: bool = False#
- needs_pricing: bool = False#
- cost_scope: str = 'call'#
- enforces_budget: bool = False#
- providers: tuple[str, ...] = ()#
fractal.impl.omp module#
Oh My Pi (omp) CLI agent implementation.
- class fractal.impl.omp.OmpParser(*, model=None)[source]#
Bases:
StreamParserParser for omp
-p --mode jsonoutput.- Parameters:
self (
OmpParser)model (
str|None)
Initialize
OmpParser.Bind the configured-model fallback and start the wall clock.
- Parameters:
self (
OmpParser)model (
str|None)
- feed(line)[source]#
Parse one omp AgentSessionEvent line into normalized events.
- Parameters:
self (
OmpParser)line (
str)
- Return type:
list[StreamEvent]
- class fractal.impl.omp.OmpAgent(node, command=None, provider=None)[source]#
Bases:
AgentOh My Pi CLI backend (cost-reporting, agent-minted sessions).
Initialize
Agent.- Parameters:
node (
Node) – The node this agent runs for (config dirs, worktree, ledger).command (
str|None) – Full agent command (e.g.'claude --some-flag'); defaults to the node’s configured agent. Extra words are spliced into every invocation.provider (
str|None) – Provider-route override;Nonemeans native (Node.agentthreads the node’s effective configured route).self (
Agent)
- name: str = 'omp'#
- config_file: str = 'config.yml'#
- can_fork: bool = True#
- mints_session: bool = True#
- needs_pricing: bool = False#
- cost_scope: str = 'call'#
- enforces_budget: bool = False#
- providers: tuple[str, ...] = ()#
fractal.impl.opencode module#
opencode CLI agent implementation.
- class fractal.impl.opencode.OpencodeParser(*, model=None)[source]#
Bases:
StreamParserParser for opencode
run --format jsonoutput.- Parameters:
self (
OpencodeParser)model (
str|None)
Initialize
OpencodeParser.Bind the configured-model fallback and start the wall clock.
- Parameters:
self (
OpencodeParser)model (
str|None)
- feed(line)[source]#
Parse one opencode JSON event line into normalized events.
- Parameters:
self (
OpencodeParser)line (
str)
- Return type:
list[StreamEvent]
- class fractal.impl.opencode.OpencodeAgent(node, command=None, provider=None)[source]#
Bases:
Agentopencode CLI backend (cost-reporting, agent-minted sessions).
Initialize
Agent.- Parameters:
node (
Node) – The node this agent runs for (config dirs, worktree, ledger).command (
str|None) – Full agent command (e.g.'claude --some-flag'); defaults to the node’s configured agent. Extra words are spliced into every invocation.provider (
str|None) – Provider-route override;Nonemeans native (Node.agentthreads the node’s effective configured route).self (
Agent)
- name: str = 'opencode'#
- config_file: str = 'opencode.json'#
- can_fork: bool = True#
- mints_session: bool = True#
- needs_pricing: bool = False#
- cost_scope: str = 'call'#
- enforces_budget: bool = False#
- results_per_step: bool = True#
- providers: tuple[str, ...] = ()#
Module contents#
Implementations for fractal.