[Bug]: Gemini TTS creates a client per utterance without closing it
Reproduction
On main c0a5762, patch google.genai.Client with a mocked client, return a normal generate_content response, and call GeminiTTSModel.synthesize("hello"). Neither client.aio.aclose() nor client.close() is called. The same omission applies to streamed responses and API exceptions.
Impact
A fresh SDK client is constructed for each nonempty utterance, but its HTTP resources are never explicitly closed. Repeated synthesis relies on garbage collection rather than releasing resources when the request/stream finishes. The installed google-genai SDK exposes separate synchronous close() and asynchronous aio.aclose() methods.
Proposed scope
Give each synthesis invocation ownership of its client, keeping it alive through stream consumption and closing both transports on completion, error, cancellation, or explicit early generator close. Construct streaming clients lazily so an unconsumed returned generator does not allocate an open client. Add offline lifecycle regressions.
Codex-assisted investigation; no live provider requests required.
Source: agentscope-ai/agentscope