The smallest Agent Framework + Temporal sample: one Agent over TemporalChatClient, invoked once. The model call runs as the microsoft_agent_framework.invoke_model Activity with a 60-second start-to-close timeout, so Temporal retries it and it survives a Worker restart.
MicrosoftAgentFrameworkPlugin(chat_clients=...)on the Client, with theOpenAIChatClientbuilt on the Worker fromOPENAI_API_KEYAgent(client=TemporalChatClient("gpt-4o-mini", start_to_close_timeout=...))in a@workflow.defnawait agent.run(prompt)andresponse.text, unchanged from Agent Framework
Prerequisites: uv sync --group microsoft-agent-framework, OPENAI_API_KEY in the Worker's environment, and a Temporal dev server (temporal server start-dev). Run both commands from the repository root.
# Terminal 1
uv run microsoft_agent_framework_plugin/hello_world/run_worker.py
# Terminal 2
uv run microsoft_agent_framework_plugin/hello_world/run_workflow.pyThe starter prints Result: and the haiku. In the Temporal UI the Workflow microsoft-agent-framework-hello-world shows one microsoft_agent_framework.invoke_model Activity with the summary gpt-4o-mini.
| File | Description |
|---|---|
workflow.py |
HelloWorldWorkflow with one Agent |
run_worker.py |
Builds the plugin with the OpenAI chat client factory and starts the Worker |
run_workflow.py |
Executes the Workflow and prints the result |