Skip to content

Add Anthropic native thinking capture for tool-call responses #152

Description

@antoinezambelli

Summary

Forge?s Anthropic adapter currently extracts text and tool_use blocks from tool-call responses but does not yet map native thinking blocks into Forge?s existing ToolCall.reasoning carrier.

This was identified while testing:

Claude Code ? Forge Proxy ? LiteLLM ? Claude models

using Forge?s Anthropic backend path.

Current behavior

For non-streaming responses, AnthropicClient extracts text and tool_use blocks. If visible text accompanies a tool call, Forge uses its existing text-as-reasoning fallback.

For streaming responses, it handles text_delta and input_json_delta.

Native thinking and thinking_delta are not currently captured. This applies to both Forge Proxy and direct AnthropicClient / WorkflowRunner use because response extraction happens inside the shared backend adapter.

Target behavior

Bring Anthropic in line with Forge?s other reasoning-capable clients:

  • Capture native plaintext thinking and thinking_delta.
  • Prefer structured thinking over the existing visible-text fallback.
  • Attach reasoning only to the first tool call.
  • Preserve text-only responses as visible text.
  • Let the existing reasoning_replay policy determine whether captured reasoning is omitted, exposed, or replayed.

This issue is limited to mapping plaintext Anthropic thinking into Forge?s existing ToolCall.reasoning and replay-policy behavior. Native Anthropic thinking-block round-tripping is a separate concern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions