Skip to content

feat(core): keep the cached prefix fixed when deferred tools are found #113

Open

Description

@gopaljigaur

Deferred tools (#74) use a client-side search_tools tool that adds found tools to the request. Tools sit first in the cached prefix, so every search makes the next request miss the prompt cache for tools, system prompt and history.

Anthropic documents two paths that keep the prefix fixed: server-side tool search, and a custom client-side search whose tool result returns tool_reference blocks while every tool is sent with defer_loading: true. LiteLLM 1.105.1 passes defer_loading and tool_reference through unchanged. It drops tool_search_tool_result for server-side search; BerriAI/litellm#46440 fixes that and is merged but not released.

Proposal On providers that support it, send all tools with defer_loading and return tool_reference blocks from search_tools (or use server-side search once LiteLLM releases #46440), keeping the current path as the fallback. Keep found tools for the whole session on those providers, matching Anthropic, OpenAI and Pydantic AI.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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