Skip to content

Python: Function invocation conversation-id propagation crashes when chat_options in kwargs is a dict #4305

@moonbox3

Description

@moonbox3

Description

Function invocation conversation-id propagation crashes when chat_options in kwargs is a dict.

_update_conversation_id does:

kwargs["chat_options"].conversation_id = conversation_id

which assumes an object with attribute access. If a dict is provided, this raises AttributeError.

Code Sample

from agent_framework._tools import _update_conversation_id

kwargs = {"chat_options": {}}
_update_conversation_id(kwargs, "conv_1", {})
# Actual: AttributeError: 'dict' object has no attribute 'conversation_id'
# Expected: kwargs['chat_options']['conversation_id'] updated or graceful handling

A full invocation-loop repro also fails in the same spot when tool-calling updates conversation id.

Error Messages / Stack Traces

AttributeError: 'dict' object has no attribute 'conversation_id' and no __dict__ for setting new attributes

Package Versions

agent-framework-core: source checkout at commit 02ba27493

Python Version

Python 3.13.5

Additional Context

This is in a hot path used by the function invocation loop for conversation-based providers.

Metadata

Metadata

Assignees

Labels

agentsIssues related to single agentsbugSomething isn't workingpython

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions