module documentation

A temporal activity that invokes a LLM model.

Implements mapping of OpenAI datastructures to Pydantic friendly types.

Class ActivityModelInput Input for the invoke_model_activity activity.
Class AgentOutputSchemaInput Data conversion friendly representation of AgentOutputSchema.
Class ApplyPatchToolInput Data conversion friendly representation of an ApplyPatchTool.
Class FunctionToolInput Data conversion friendly representation of a FunctionTool. Contains only the fields which are needed by the model execution to determine what tool to call, not the actual tool invocation, which remains in the workflow context.
Class HandoffInput Data conversion friendly representation of a Handoff. Contains only the fields which are needed by the model execution to determine what to handoff to, not the actual handoff invocation, which remains in the workflow context.
Class HostedMCPToolInput Data conversion friendly representation of a HostedMCPTool. Contains only the fields which are needed by the model execution to determine what tool to call, not the actual tool invocation, which remains in the workflow context.
Class ModelActivity Class wrapper for model invocation activities to allow model customization. By default, we use an OpenAIProvider with retries disabled. Disabling retries in your model of choice is recommended to allow activity retries to define the retry model.
Class ModelTracingInput Conversion friendly representation of ModelTracing.
Class ShellToolInput Data conversion friendly representation of a ShellTool. Contains only the fields which are needed by the model execution to determine what tool to call, not the actual tool invocation, which remains in the workflow context.
Class StreamingActivityModelInput Input for the invoke_model_activity_streaming activity.
Variable ToolInput Undocumented
Class _NoopApplyPatchEditor Satisfies the ApplyPatchEditor protocol for tool reconstruction during model calls.
Function _build_tool Reconstruct a Tool from its data-conversion-friendly input form.
Function _build_tools_and_handoffs Undocumented
Async Function _empty_on_invoke_handoff Undocumented
Async Function _empty_on_invoke_tool Undocumented
Async Function _noop_shell_executor Undocumented
Function _raise_for_openai_status Translate an OpenAI APIStatusError into the right retry posture.
ToolInput = (source)

Undocumented

def _build_tool(tool: ToolInput) -> Tool: (source)

Reconstruct a Tool from its data-conversion-friendly input form.

def _build_tools_and_handoffs(input: ActivityModelInput) -> tuple[list[Tool], list[Handoff[Any, Any]]]: (source)

Undocumented

async def _empty_on_invoke_handoff(_ctx: RunContextWrapper[Any], _input: str) -> Any: (source)

Undocumented

async def _empty_on_invoke_tool(_ctx: RunContextWrapper[Any], _input: str) -> str: (source)

Undocumented

async def _noop_shell_executor(*_a: Any, **_kw: Any) -> str: (source)

Undocumented

def _raise_for_openai_status(e: APIStatusError) -> NoReturn: (source)

Translate an OpenAI APIStatusError into the right retry posture.