Skip to content

agent_as_tool

junjo.plugins.openai_agents.agent_as_tool

Kind: Function

SDK version: 0.67.0

Documentation channel: Stable release

agent_as_tool(*, name: str, description: str, input_type: TypeForm[InputT], agent_factory: Callable[[InputT], AgentToolInvocation[AgentInputT, AgentOutputT, DependenciesT] | Awaitable[AgentToolInvocation[AgentInputT, AgentOutputT, DependenciesT]]], output_projector: Callable[[AgentExecutionResult[AgentOutputT], InputT], object | Awaitable[object]]) -> FunctionTool

View source

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

The returned framework-native FunctionTool validates each call against input_type, requests a fresh invocation from agent_factory, runs the Junjo Agent normally, and projects its real AgentExecutionResult 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.
agent_factory Callable[[InputT], AgentToolInvocation[AgentInputT, AgentOutputT, DependenciesT] | Awaitable[AgentToolInvocation[AgentInputT, AgentOutputT, DependenciesT]]] Application factory for one fresh Junjo Agent
invocation with typed dependencies.
output_projector Callable[[AgentExecutionResult[AgentOutputT], InputT], object | Awaitable[object]] Application mapping from the native execution
result and validated input to the tool result.
  • FunctionTool: OpenAI Agents SDK FunctionTool.