Skip to content

Commit abcf06f

Browse files
jsonbaileyclaude
andcommitted
fix: handle TypeError from unsupported input and alias AgentsRunner to avoid name shadowing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f05a4de commit abcf06f

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

packages/ai-providers/server-ai-openai/src/ldai_openai/openai_agent_runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ async def run(
6363
metrics including aggregated token usage and observed ``tool_calls``.
6464
"""
6565
try:
66-
from agents import Agent, Runner
66+
from agents import Agent, Runner as AgentsRunner
6767
except ImportError:
6868
log.warning(
6969
"openai-agents is required for OpenAIAgentRunner. "
@@ -86,7 +86,7 @@ async def run(
8686
model_settings=model_settings,
8787
)
8888

89-
result = await Runner.run(agent, str(input), max_turns=25)
89+
result = await AgentsRunner.run(agent, str(input), max_turns=25)
9090

9191
tool_calls = [
9292
ld_name

packages/ai-providers/server-ai-openai/src/ldai_openai/openai_model_runner.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ async def run(
4848
:return: :class:`RunnerResult` containing ``content``, ``metrics``,
4949
``raw`` and (when ``output_type`` is set) ``parsed``.
5050
"""
51-
messages = self._coerce_input(input)
51+
try:
52+
messages = self._coerce_input(input)
53+
except TypeError as error:
54+
log.warning(f'OpenAI model runner received unsupported input type: {error}')
55+
return RunnerResult(content='', metrics=LDAIMetrics(success=False, usage=None))
5256

5357
if output_type is not None:
5458
return await self._run_structured(messages, output_type)

0 commit comments

Comments
 (0)