1import asyncio
2
3from kern.agent import Agent
4from kern.models.google import GeminiInteractions
5
6agent = Agent(
7 model=GeminiInteractions(id="gemini-3-flash-preview"),
8 markdown=True,
9)
10
11if __name__ == "__main__":
12 # --- Sync ---
13 agent.print_response("Share a 2 sentence horror story")
14
15 # --- Sync + Streaming ---
16 agent.print_response("Share a 2 sentence horror story", stream=True)
17
18 # --- Async ---
19 asyncio.run(agent.aprint_response("Share a 2 sentence horror story"))
20
21 # --- Async + Streaming ---
22 asyncio.run(agent.aprint_response("Share a 2 sentence horror story", stream=True))