Skip to content

AnthropicLlm.part_to_message_block() drops non-standard FunctionResponse dicts (breaks SkillToolset with Claude)` #4779

Closed

Description

@akashbangad

Describe the Bug:
AnthropicLlm.part_to_message_block() only handles FunctionResponse.response dicts that contain a "content" or "result" key. When SkillToolset.load_skill() returns a response with keys skill_name, instructions, frontmatter, the method falls through and returns an empty string. This means Claude models never see the skill instructions after calling load_skill.

Steps to Reproduce:

  1. Create an agent with AnthropicLlm (any Claude model)
  2. Add a SkillToolset with at least one skill
  3. Ask the agent to use the skill
  4. The agent calls load_skill but receives an empty tool response — it cannot follow the skill instructions

Expected Behavior:
The tool response should contain the full skill instructions returned by load_skill.

Observed Behavior:
The tool response is empty. The agent sees no skill instructions.

Root cause

In anthropic_llm.py, part_to_message_block() checks for response.get("content") and response.get("result") but doesn't handle other dict structures. The load_skill tool returns {"skill_name": ..., "instructions": ..., "frontmatter": ...} which matches neither key.

Environment Details:

  • google-adk: main branch (post-1.26.0)
  • Python: 3.13

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: claude sonnet 4.6 (Other models as well)

Additional Context:
Add any other context about the problem here.

Suggested fix

Add a fallback that serializes arbitrary response dicts:

# In part_to_message_block(), after existing content/result checks:
else:
    content = json.dumps(response_data)

This ensures any FunctionResponse dict is passed to the model, regardless of key names.

How often has this issue occurred?:

  • Always (100%)

Activity

  1. added
    models[Component] This issue is related to model support
    on Mar 10, 2026
  2. added theissue type on Mar 10, 2026
  3. akashbangad commented on Mar 10, 2026

    @akashbangad
    ContributorAuthor

    This PR should fix it - #4780

  4. lachezartodorov-sg commented on Mar 18, 2026

    @lachezartodorov-sg

    +1 I've been struggling with this issue for 2 days.
    It will be great to see the fix in the next versions.
    10x @akashbangad & @wukath

  5. wukath commented on Mar 18, 2026

    @wukath
    Collaborator

    we have imported the PR internally and are working on a fix!

  6. kvodenicharov-sg commented on Mar 19, 2026

    @kvodenicharov-sg

    Amazing!

  7. wukath commented on Mar 19, 2026

    @wukath
    Collaborator

    merged in c26d359

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

Metadata

Metadata

Assignees

Labels

models[Component] This issue is related to model support

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions