Skip to content

python: fix SDK logic to yield or not yield messages #87

@reyammer

Description

@reyammer

Context:

if msg.status_code != ResponseStatus.OK:
log.error(
"[Session][Stream][Response] %d:%s",
msg.status_code,
msg.status_message,
)
break
# Check if this message is about a tool call; if so,
# deal with it and reply to the backend without
# yielding the message -- it's not for the user!
if msg.message_type == MessageType.LOCAL_TOOL_CALL:
log.info(f"Received tool call request: {msg.get_content()!r}")
tool_output_message = self._execute_tool(msg)
await ws.send(tool_output_message.model_dump_json())

Currently it seems that:

  • we do not yield error messages (which is not ideal as we are hiding important error information)
  • we yield local_tool-related messages (the idea was that we would not yield them, that seems an implementation bug)

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