Skip to content

Python: [Bug]: Should Content.__deepcopy__ preserve unsafe fields #7851

Description

@TaoChenOSU

Description

In Python, Content.__deepcopy__ preserves shallow copies of a list of fields marked in Content._SHALLOW_COPY_FIELDS. Currently the list only contains raw_representation.

Question: Should deepcopy preserve shallow-copied fields?
What we are currently doing obscures the meaning of deepcopy by creating a partially deepcopied object.

Proposal: discard the unsafe object and log a warning.

Package Versions

agent-framework-core

Python Version

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentsUsage: [Issues, PRs], Target: Single agentpythonUsage: [Issues, PRs], Target: Python

    Type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions