src.ai.providers.anthropic_provider module#

Anthropic Claude Provider for Marcus AI.

Implements semantic task analysis, dependency inference, and intelligent enhancement using Anthropic’s Claude models.

class src.ai.providers.anthropic_provider.AnthropicProvider[source]#

Bases: BaseLLMProvider

Anthropic Claude provider for semantic AI analysis.

Uses Claude to provide intelligent task analysis, dependency inference, and project understanding while maintaining safety and reliability.

__init__(api_key=None)[source]#

Initialize the Anthropic provider.

Parameters:

api_key (str | None) – Explicit Anthropic API key. If omitted, falls back to config.ai.anthropic_api_key then CLAUDE_API_KEY env var. ANTHROPIC_API_KEY is intentionally NOT consulted: setting it in the parent shell switches Claude Code from subscription billing to API billing, so Marcus uses CLAUDE_API_KEY to avoid interfering with Claude Code subprocesses Marcus spawns.

Raises:

ValueError – If no API key is provided and none is discoverable from config or CLAUDE_API_KEY.

Return type:

None

async analyze_task(task, context)[source]#

Analyze task semantics using Claude.

Parameters:
Return type:

SemanticAnalysis

Returns:

Semantic analysis with intent, dependencies, and risks

async infer_dependencies(tasks)[source]#

Infer semantic dependencies between tasks using Claude.

Parameters:

tasks (List[Task])

Return type:

List[SemanticDependency]

Returns:

List of inferred semantic dependencies

async generate_enhanced_description(task, context)[source]#

Generate enhanced task description using Claude.

Parameters:
Return type:

str

Returns:

Enhanced description

async estimate_effort(task, context)[source]#

Estimate task effort using Claude.

Parameters:
Return type:

EffortEstimate

Returns:

Effort estimate with confidence and factors

async analyze_blocker(task, blocker, context)[source]#

Analyze blocker and suggest solutions using Claude.

Parameters:
Return type:

List[str]

Returns:

List of suggested solutions

async complete(prompt, max_tokens=2000)[source]#

Generate a completion for the given prompt.

Parameters:
  • prompt (str)

  • max_tokens (int)

Return type:

str

Returns:

The completion text

async close()[source]#

Close the HTTP client.

Return type:

None