1from typing import Iterator # noqa
2from kern.agent import Agent, RunOutput # noqa
3from kern.models.aws import Claude
4
5agent = Agent(
6 model=Claude(id="us.anthropic.claude-sonnet-4-20250514-v1:0"), markdown=True
7)
8
9# Get the response in a variable
10# run_response: Iterator[RunOutputEvent] = agent.run("Share a 2 sentence horror story", stream=True)
11# for chunk in run_response:
12# print(chunk.content)
13
14# Print the response in the terminal
15agent.print_response("Share a 2 sentence horror story", stream=True)