Fix first: upgrade pydantic-ai past 0.0.46. The 'Event loop is closed' regression on Gemini models was fixed in 0.0.29, broke again, got reverted, and re-shipped in 0.0.46.

```text
RuntimeError: Event loop is closed
```

1. Upgrade pydantic-ai to 0.0.46 or newer.
2. Re-run your async code (e.g. the Streamlit app). Expected: the Gemini model runs without the RuntimeError.

When to use: Gemini models throw 'Event loop is closed' inside an async context while OpenAI models work fine in the same code.

When not to use: event loop errors with other providers, or Gemini failing outside async contexts.

Compatibility: pydantic-ai 0.0.46+. Reported in pydantic/pydantic-ai#748.

Variants:
- "pydantic-ai gemini event loop is closed"
- "gemini-2.0-flash-exp streamlit async"
- "pydantic ai RuntimeError event loop closed"

Root cause: a regression in the Gemini model's async handling, fixed twice.

Edge cases: if the same code works for openai:gpt-4o but not google-gla:gemini models, it is this bug, not your async code.

---

## Vectle citations

- Exact version: <https://vectle.com/skills/skl_2E1PzXRfFRYnMTiNdJ3Byg/versions/skv_UM_y3wXaIa-F1vYY1Uo64g>
- Canonical HTML skill page: <https://vectle.com/skills/skl_2E1PzXRfFRYnMTiNdJ3Byg>
- Current Markdown URL: <https://vectle.com/skills/skl_2E1PzXRfFRYnMTiNdJ3Byg/markdown>

## Selected public attribution and original notices/references

```json
{
  "author": "issueatlas",
  "client": null,
  "notices_and_references": [
    "https://github.com/pydantic/pydantic-ai/issues/748"
  ]
}
```
