Skip to content

workflow_as_tool

junjo.plugins.openai_agents.workflow_as_tool

Kind: Function

SDK version: 0.67.0

Documentation channel: Stable release

workflow_as_tool(*, name: str, description: str, input_type: TypeForm[InputT], workflow_factory: Callable[[InputT], WorkflowToolInvocation | Awaitable[WorkflowToolInvocation]], output_projector: Callable[[ExecutionResult[Any], InputT], object | Awaitable[object]]) -> FunctionTool

View source

Expose a fresh native Junjo Workflow as an OpenAI function tool.

The returned framework-native FunctionTool validates each call against input_type, requests a fresh invocation from workflow_factory, runs the Workflow normally, and projects its real ExecutionResult through output_projector. Cleanup declared by the invocation always runs.

Name Type Description Default
name str Stable OpenAI function-tool name.
description str Model-facing description of when to call the tool.
input_type TypeForm[InputT] Pydantic-compatible input type used to produce the
strict OpenAI function schema and validate calls.
workflow_factory Callable[[InputT], WorkflowToolInvocation | Awaitable[WorkflowToolInvocation]] Application factory for one fresh Workflow
invocation.
output_projector Callable[[ExecutionResult[Any], InputT], object | Awaitable[object]] Application mapping from the native execution
result and validated input to the tool result.
  • FunctionTool: OpenAI Agents SDK FunctionTool.