Build a loan validation agent using the OpenAI Agents SDK with @function_tool decorators, Agent class, and Runner.run() execution. Configured for Azure-hosted models via set_default_openai_client — proving the SDK is not locked to OpenAI.
Run the Lesson 12 Example
Clone the examples
Set up virtual environment
Configure credentials
Start the A2A server
Run the A2A client
Complete source code for this lesson.
Q & A
Can the OpenAI Agents SDK really work with non-OpenAI models?
Yes. set_default_openai_client() accepts any OpenAI-compatible client — AsyncAzureOpenAI, local Ollama, or any provider implementing the chat completions API.
What is the difference between handoffs and A2A delegation?
Handoffs route between agents within the same SDK process. A2A delegates to agents in separate processes, potentially running different frameworks. Handoffs are intra-SDK; A2A is inter-framework.
Why is Runner.run() enough — don't you need a loop?
Runner.run() IS the loop. It sends to the model, checks for tool_calls, executes them, appends results, and repeats until done. result.final_output gives you the last text response.
How does @function_tool differ from other tool decorators?
All tool decorators generate JSON schemas from type hints and docstrings. The difference is cosmetic — OpenAI generates OpenAI-format schemas; LangChain generates its own. The end result for the LLM is equivalent.