The smallest possible end-to-end example: instantiate an Agent with one model config, call ask(), print the reply, then reuse the same Agent for a second turn. No tools, no harness primitives, no plugins — just the bare loop.
"""01 · Hello AgentThe smallest possible example: a bare ``Agent`` with a single LLM config andone ``ask()`` call. No tools, no harness primitives, no plugins.Run:: .venv-beta/bin/python 01_hello_agent.py"""importasynciofromautogen.betaimportAgentfromautogen.beta.configimportGeminiConfigdefsection(title:str)->None:print(f"\n── {title} ───")asyncdefmain()->None:config=GeminiConfig(model="gemini-3-flash-preview",temperature=0)section("Bare Agent — ask and print")agent=Agent("greeter",prompt="You are a friendly but concise assistant. Reply in one sentence.",config=config,)reply=awaitagent.ask("Give me a single tip for learning to play chess.")print(reply.body)section("Reuse the Agent for another ask")reply2=awaitagent.ask("And a tip for learning poker, in one sentence.")print(reply2.body)if__name__=="__main__":asyncio.run(main())