Home / Function/ generate_tool_call_response() — anthropic-sdk-python Function Reference

generate_tool_call_response() — anthropic-sdk-python Function Reference

Architecture documentation for the generate_tool_call_response() function in _beta_runner.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  e6eb0ae3_dad5_13a8_e981_1b176438b0fe["generate_tool_call_response()"]
  e1032e12_8173_7783_f9c6_c9b9260e5366["BaseAsyncToolRunner"]
  e6eb0ae3_dad5_13a8_e981_1b176438b0fe -->|defined in| e1032e12_8173_7783_f9c6_c9b9260e5366
  b6f147a7_041c_a75b_75d3_8d273a48e4e5["generate_tool_call_response()"]
  b6f147a7_041c_a75b_75d3_8d273a48e4e5 -->|calls| e6eb0ae3_dad5_13a8_e981_1b176438b0fe
  e767db6b_72ea_d60e_0f49_54ac2dd6c0a7["__run__()"]
  e767db6b_72ea_d60e_0f49_54ac2dd6c0a7 -->|calls| e6eb0ae3_dad5_13a8_e981_1b176438b0fe
  b5b59a19_0646_9f18_1716_6cbb729f18af["_generate_tool_call_response()"]
  e6eb0ae3_dad5_13a8_e981_1b176438b0fe -->|calls| b5b59a19_0646_9f18_1716_6cbb729f18af
  b6f147a7_041c_a75b_75d3_8d273a48e4e5["generate_tool_call_response()"]
  e6eb0ae3_dad5_13a8_e981_1b176438b0fe -->|calls| b6f147a7_041c_a75b_75d3_8d273a48e4e5
  style e6eb0ae3_dad5_13a8_e981_1b176438b0fe fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/lib/tools/_beta_runner.py lines 525–538

    async def generate_tool_call_response(self) -> BetaMessageParam | None:
        """Generate a MessageParam by calling tool functions with any tool use blocks from the last message.

        Note the tool call response is cached, repeated calls to this method will return the same response.

        None can be returned if no tool call was applicable.
        """
        if self._cached_tool_call_response is not None:
            log.debug("Returning cached tool call response.")
            return self._cached_tool_call_response

        response = await self._generate_tool_call_response()
        self._cached_tool_call_response = response
        return response

Subdomains

Frequently Asked Questions

What does generate_tool_call_response() do?
generate_tool_call_response() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/lib/tools/_beta_runner.py.
Where is generate_tool_call_response() defined?
generate_tool_call_response() is defined in src/anthropic/lib/tools/_beta_runner.py at line 525.
What does generate_tool_call_response() call?
generate_tool_call_response() calls 2 function(s): _generate_tool_call_response, generate_tool_call_response.
What calls generate_tool_call_response()?
generate_tool_call_response() is called by 2 function(s): __run__, generate_tool_call_response.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free