01 Hello Agent#

Script: example/01_hello_agent.py.

This is the smallest OpenRath program: build a flow.Agent, pass it a Session, and receive an updated session.

python example/01_hello_agent.py

Concept

API

Agent as module

flow.Agent(system_prompt, provider, on_event=...)

Session as runtime value

Session.from_user_message(...).to("local")

Streaming callback

on_event=stream_to_stdout()

Usage accounting

out.cumulative_usage

Needs an OpenAI-compatible key or llm.default_provider config.

← Runnable Examples