Skip to content

Commit fd72ec5

Browse files
aditik0303claude
andcommitted
docs(governance): clarify OpenAI Agents tool-name + duck-typing rationale
AFTER_TOOL reads the tool name directly from the SDK-provided tool at both on_tool_start and on_tool_end, so no start→end correlation is needed (addresses the #899-style tool-identity review note). Also record that the run-item/response text extraction is duck-typed intentionally, since the SDK shapes are not stable public models. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 4ecb14e commit fd72ec5

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

  • packages/uipath-openai-agents/src/uipath_openai_agents/governance

packages/uipath-openai-agents/src/uipath_openai_agents/governance/adapter.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,12 @@ async def on_tool_start(self, context: Any, agent: Any, tool: Any) -> None:
268268
async def on_tool_end(
269269
self, context: Any, agent: Any, tool: Any, result: Any
270270
) -> None:
271-
"""Evaluate AFTER_TOOL rules immediately after a tool is invoked."""
271+
"""Evaluate AFTER_TOOL rules immediately after a tool is invoked.
272+
273+
The SDK passes ``tool`` to both ``on_tool_start`` and ``on_tool_end``,
274+
so the name is read directly here — no start→end correlation is needed
275+
(unlike callback frameworks whose end hook omits the tool).
276+
"""
272277
try:
273278
tool_name = getattr(tool, "name", None) or "unknown"
274279
tool_result = "" if result is None else _stringify(result)
@@ -301,6 +306,10 @@ async def on_handoff(self, context: Any, agent: Any, source: Any) -> None:
301306

302307
# --------------------------------------------------------------------------
303308
# Delegation + text extraction (module-level, sync, duck-typed)
309+
#
310+
# Extraction is duck-typed on purpose: the OpenAI Agents SDK's run-item /
311+
# response shapes are not stable public models, so we read attributes
312+
# defensively rather than isinstance-checking SDK types that may move.
304313
# --------------------------------------------------------------------------
305314

306315

0 commit comments

Comments
 (0)