Skip to content

Tool call is skipped if output message stop_reason is "end_of_turn" #206

@vdymna

Description

@vdymna

While working an application that is using an agent with a custom client tool, we have encountered an issue where our tool call is not actually being executed:

Created session_id=974aca77-04dd-454a-a956-0658e2feb26e for Agent(052e14e7-93c1-4e64-ad13-09fcf7b1dce1)
inference> <tool_call>
>>>>>>>>>>>>>>>> actual tool call is being skipped
INFO:     127.0.0.1:42126 - "POST /chat HTTP/1.1" 200 OK

Specifically we appear to be hitting the if not self.tool_parser and chunk.event.payload.turn.output_message.stop_reason in {"end_of_turn"}: statement in the agent.py.

In order to workaround this, we decided to implement a very simple ToolParser and pass that to our agent:

class GraniteToolParser(ToolParser):
    def get_tool_calls(self, output_message: CompletionMessage) -> List[ToolCall]:
        if output_message and output_message.tool_calls:
            return output_message.tool_calls
        else:
            return []

However, I would like to understand what is purpose for that if statement in agent.py?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions