Skip to main content

Class: TemporalOpenAIRunner

openaiAgentsWorkflow.TemporalOpenAIRunner

A Temporal-aware agent runner that delegates model calls to Activities.

Use run(agent, input) for request-response runs. Pass { stream: true } to stream incremental events as the model responds — the returned StreamedRunResult is async-iterable. Streaming requires a streamingTopic (set via the plugin's modelParams or the runner's defaultModelParams) and a hosted WorkflowStream in the Workflow.

Constructors​

constructor​

• new TemporalOpenAIRunner(options?): TemporalOpenAIRunner

Parameters​

NameType
options?TemporalOpenAIRunnerOptions

Returns​

TemporalOpenAIRunner

Methods​

run​

▸ run<TAgent, TContext>(agent, input, options?): Promise<RunResult<any, TAgent>>

input accepts a prompt string, structured AgentInputItem[], or a deserialized RunState to resume a previous run across continueAsNew. Capture the current RunState via result.state.toString().

Type parameters​

NameType
TAgentextends Agent<any, any>
TContextundefined

Parameters​

NameType
agentTAgent
inputstring | AgentInputItem[] | RunState<TContext, TAgent>
options?TemporalRunOptions<TContext> & { stream?: false }

Returns​

Promise<RunResult<any, TAgent>>

▸ run<TAgent, TContext>(agent, input, options): Promise<StreamedRunResult<TContext, TAgent>>

Type parameters​

NameType
TAgentextends Agent<any, any>
TContextundefined

Parameters​

NameType
agentTAgent
inputstring | AgentInputItem[] | RunState<TContext, TAgent>
optionsTemporalRunOptions<TContext> & { stream: true }

Returns​

Promise<StreamedRunResult<TContext, TAgent>>