Temporal activity that executes Gemini SDK API calls with real credentials.
The TemporalApiClient in the workflow dispatches calls here. This activity holds a user-provided genai.Client and forwards structured requests. Credentials are fetched/refreshed only within the activity — they never appear in workflow event history.
| Class | |
Wraps a genai.Client and exposes Temporal activities for SDK calls. |
| Function | _classify |
Map a Gemini APIError to an ApplicationError Temporal can act on. |
| Async Function | _drain |
Collect every SSE event from an interaction stream, heartbeating per event. |
| Function | _resolve |
Reconstruct HttpOptions from serializable overrides, or None. |
| Constant | _RETRYABLE |
Undocumented |
Map a Gemini APIError to an ApplicationError Temporal can act on.
Transient statuses (timeouts, rate limits, 5xx) stay retryable so the activity's retry policy applies; everything else (e.g. 4xx client errors) is marked non-retryable so the workflow fails fast instead of retrying a request that cannot succeed.
Collect every SSE event from an interaction stream, heartbeating per event.
stream is the SDK's async streaming response; its concrete class is not a stable public name, so it is typed structurally — only async with / async for / event.model_dump(...) are used.