Skip to content

Support async context manager for CopilotClient #341

@pamelafox

Description

@pamelafox

As a best practice, many SDKs that have Client() classes that require close()ing also support Python's async context manager protocol, like the Azure Python SDKs. That way, developers can write "async with CopilotClient() as client" and then not worry about explicitly closing. You can add support by implementing aenter and aexit dunder methods.

My motivation for asking:

Using the Python SDK, I mistakenly neglected to call session.destroy()/client.stop() and managed to use up all of my Mac's memory when running evals (200 copilot server processes).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions