agent_as_tool
junjo.plugins.openai_agents.agent_as_tool
Kind: Function
SDK version: 0.67.0
Documentation channel: Stable release
Signature
Section titled “Signature”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]]) -> FunctionToolExpose 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.
Parameters
Section titled “Parameters”| 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. |
Returns
Section titled “Returns”FunctionTool: OpenAI Agents SDKFunctionTool.