Repository navigation
Add an OpenAI Agents SDK adapter for common.ai toolsets - #74767
Merged
Merged
Conversation
AirflowTools turns any ToolProvider or AirflowTool into OpenAI Agents FunctionTools, with the guarantees the Strands, ADK and Anthropic adapters give: masked results, correctable failures returned to the model within the tool's retry limit, and ToolCallError raised out of Runner.run for anything else. Works with openai-agents 0.20 (openai 2.x, what Airflow's constraints resolve to) and 0.21+ (openai 3).
kaxil
requested review from
Lee-W,
amoghrajesh,
ashb,
gopidesupavan and
potiuk
as code owners
October 14, 2026 22:05
phanikumv
reviewed
Oct 15, 2026
pankajkoti
approved these changes
Oct 15, 2026
Co-authored-by: Phani Kumar <[email protected]>
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Teams that build agents with the OpenAI Agents SDK can now give them common.ai's connection-backed toolsets (
SQLToolset,HookToolset,ObjectStorageToolset, sandboxes) without rewriting the agent forAgentOperator. It is the fourth adapter on the framework-neutral tool interface, next to Strands, Google ADK and the Anthropic tool runner, and keeps their guarantees: every result goes through Airflow's secret masker, a failure the model can correct comes back to it within the tool's retry limit, and anything else raisesToolCallErrorout ofRunner.run, so the task fails and Airflow retries it.The guide is
docs/frameworks/openai_agents.rst, with a runnable example Dag. Everything ships experimental.First of four stacked PRs: the next ones add the CI job, OpenTelemetry tracing, and durable replay on retry.
Design rationale
Why common.ai and not the OpenAI provider. The adapter consumes common.ai's tool interface (
AirflowTool,ToolProvider, the masker, thecommon_ai.tool_callsmetric), and the OpenAI provider does not depend on common.ai. The SDK is also not tied to OpenAI's service: it runs other vendors' models through LiteLLM or any OpenAI-compatible endpoint, so it is an agent framework like Strands rather than an OpenAI API client. Operators for OpenAI's hosted APIs, such asOpenAIAgentSessionOperator, stay in the OpenAI provider.AirflowToolsis alist[Tool]. The SDK has no toolset or plugin object;Agent(tools=...)takes a list. Subclassinglist[Tool]keeps the class name the other adapters use and passes type checking asAgent.toolswithout a cast (a function returninglist[FunctionTool]does not, sincelistis invariant).A tool failure reaches the task as
ToolCallError. The runner wraps any exception aFunctionToolraises inUserError("Error running tool ...")unless it is one of the SDK's own types, so the adapter raises a private class that is both aToolCallErrorand anAgentsException.except ToolCallErrorworks in user code, and the task log shows the tool's error rather than a generic one.strict_json_schema=False. The SDK's strict mode marks every property required and rejects existingadditionalPropertiesvalues, which would turn the toolsets' optional parameters into required ones. The schema goes to the model as the toolset wrote it.Retry budget per run. The SDK gives each run its own
Usageobject and passes it to every tool call, so the adapter keys the budget on that object's identity (Usagecompares by value). It does not identify the model turn, so failures of calls that run at the same time count once, as in the ADK adapter.Gotchas
[openai-agents]extra.openai-agents0.21 and later requireopenai>=3, while the workspace holdsopenaibelow 3 through the rootoverride-dependencies, so installing with Airflow's constraints gives 0.20. The adapter is tested on 0.20.0 (openai2.x) and 0.23.1 (openai3).Agent.as_tool()needsfailure_error_function=None, or the SDK hands the failure to the outer model as text. The guide and docstring say so, and a test covers it.{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.