Motivation
Currently, Biomni integrates Anthropic models using their API. Some users may prefer, or be required, to use the claude CLI (Claude Code) instead of direct API access (e.g., for local dev, easier debugging, organization/IT policy, or to avoid managing API keys in the Python environment).
Proposal
Add the ability to use Claude via the official Anthropic CLI (claude) as an alternative backend to direct API calls. This mode would:
- Accept the same prompt/messages payload as the API backend.
- Call the CLI tool via a subprocess and capture the output as the model response.
- Map errors/timeouts into Biomni's existing retry and error-handling logic.
User-facing behavior
- When
LLM_PROVIDER=claude_code (or similar), Biomni will use the CLI instead of the API.
- If the CLI is not installed or cannot be authenticated, Biomni returns a clear error.
- No Anthropic API key is required for this mode.
Implementation suggestions / Feasibility
- Detect CLI presence (e.g.
shutil.which('claude')).
- Start with non-streaming output (collect full stdout); add streaming later if feasible.
- For tool-calling, either:
- Require the prompt to instruct CLI to return a strict JSON block for parsing.
- OR mark CLI backend as text-only, reserving tool-calling for API-based usage.
- Provide a config option to select between API and CLI.
Acceptance Criteria
Related issues: None found for this specific feature. Closest: #284, #264
Motivation
Currently, Biomni integrates Anthropic models using their API. Some users may prefer, or be required, to use the
claudeCLI (Claude Code) instead of direct API access (e.g., for local dev, easier debugging, organization/IT policy, or to avoid managing API keys in the Python environment).Proposal
Add the ability to use Claude via the official Anthropic CLI (
claude) as an alternative backend to direct API calls. This mode would:User-facing behavior
LLM_PROVIDER=claude_code(or similar), Biomni will use the CLI instead of the API.Implementation suggestions / Feasibility
shutil.which('claude')).Acceptance Criteria
Related issues: None found for this specific feature. Closest: #284, #264