AIR

Example: sessions

python
import asyncio
import os
 
from air import AIR
from air.providers.groq import GroqProvider
 
 
async def main():
    air = AIR()
    air.add_provider(GroqProvider(api_key=os.environ["GROQ_API_KEY"], model="llama-3.3-70b-versatile"))
 
    session = air.session("user-123")
 
    await session.chat("My name is Alex.")
    response = await session.chat("What is my name?")
    print(response.content)
 
    history = await session.history()
    for entry in history:
        print(entry["role"], ":", entry["content"])
 
    await session.clear()  # forget this conversation, session id stays known
 
 
if __name__ == "__main__":
    asyncio.run(main())

This example uses the default in memory session store; history is lost when the process exits. See persistent-sessions.md to keep it across restarts.