ai-python-basics
Installation
SKILL.md
ai-python-basics
Requires Python 3.12 or later. Install with uv add ai.
Use import ai.
For gateway-routed model IDs, set AI_GATEWAY_API_KEY.
Core pieces:
Modelselects the provider and model.- Messages are typed Python objects.
ai.streammakes one model call and returns one assistant message.ai.Agentwrapsai.streamin a loop that executes Python tools and manages history.
Use gateway model IDs unless you need a direct provider: