praval.providers.anthropic

Anthropic provider implementation for Praval framework.

Provides integration with Anthropic’s Claude models through the Messages API with support for conversation history and system messages.

Classes

AnthropicProvider(config)

Anthropic provider for LLM interactions.

class praval.providers.anthropic.AnthropicProvider(config)[source]

Bases: object

Anthropic provider for LLM interactions.

provider_name = 'anthropic'
capabilities = ProviderCapabilities(text=True, chat_completions=False, responses_api=False, tools=True, streaming=True, native_streaming=True, tool_streaming=True, structured_outputs=True, json_schema_mode='json_schema', multimodal=True, image_input=True, file_input=False, audio_input=False, video_input=False, audio_transcription=False, speech_generation=False, reasoning=True, reasoning_effort=True, reasoning_budget=True, embeddings=False, local=False, server_tools=False, mcp=False, computer_use=False)
__init__(config)[source]
generate(messages, tools=None, *args, **kwargs)
invoke(request, tools=None)[source]

Invoke Anthropic through the provider-neutral adapter surface.

Return type:

ModelResponse

Parameters:
  • request (ModelRequest)

  • tools (List[Dict[str, Any]] | None)

continue_with_tool_results(request, response, tool_results)[source]

Submit runtime-executed tool results to Anthropic.

Return type:

ModelResponse

Parameters:
stream(request, tools=None)[source]

Stream Anthropic messages as provider-neutral events.

Return type:

Iterator[ModelEvent]

Parameters:
  • request (ModelRequest)

  • tools (List[Dict[str, Any]] | None)

close()[source]

Close the underlying SDK client when supported.

Return type:

None

resume_tool_flow(suspended_state, tools, hitl_context=None)[source]

Resume an interrupted Anthropic tool-use flow from persisted state.

Return type:

str

Parameters:
  • suspended_state (Dict[str, Any])

  • tools (List[Dict[str, Any]] | None)

  • hitl_context (Dict[str, Any] | None)