Skip to content

Conversation

MuhammadHamidRaza
Copy link
Contributor

This Pull Request provides a robust fix for the Agent.clone() method, ensuring it correctly performs a shallow copy as intended. The changes include:

  • Correct Shallow Copy Implementation: The clone() method is updated to properly create new list objects for tools and handoffs, while keeping the inner objects (tool functions and handoff objects) the same. This resolves the AssertionError that was failing in the test suite.
  • Passed All Checks: This PR successfully passes all linting and testing checks, including the test_agent_clone_shallow_copy test which previously failed.
  • Clear Documentation: The docstring for Agent.clone() is updated to clearly explain the shallow-copy behavior.

This fix addresses a critical bug and ensures the clone method behaves as expected, improving the reliability of the SDK. I've focused on creating a solution that is both correct and passes all CI/CD checks, making it ready for a quick merge.

@seratch
Copy link
Member

seratch commented Aug 1, 2025

When you have insights for an existing pull request, sharing it by posting a comment to the PR would be appreciated.

@seratch seratch closed this Aug 1, 2025
@seratch seratch added the duplicate This issue or pull request already exists label Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants