Package ai.acolite.agentsdk.core
Class Runner
- All Implemented Interfaces:
EventEmitter<RunHookEvents<Object,TextOutput>>
Runner
Executes agents and manages their interactions with models.
Ported from TypeScript OpenAI Agents SDK Source: run.ts
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInput parameters for handoff tool calls. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <TContext,TOutput extends AgentOutputType>
RunResult<TContext, ?> Static convenience method to run an agent with a single text input (blocking).static <TContext,TOutput extends AgentOutputType>
RunResult<TContext, ?> Static method to run an agent with custom configuration (blocking).static <TContext,TOutput extends AgentOutputType>
CompletableFuture<RunResult<TContext, ?>> Static method to run an agent asynchronously with a single text input.static <TContext,TOutput extends AgentOutputType>
CompletableFuture<RunResult<TContext, ?>> Static method to run an agent asynchronously with custom configuration.static <TContext,TOutput extends AgentOutputType>
StreamedRunResult<TContext, Agent<TContext, TOutput>> runStreamed(Agent<TContext, TOutput> agent, String input) Static method to run an agent with streaming event emission.static <TContext,TOutput extends AgentOutputType>
StreamedRunResult<TContext, Agent<TContext, TOutput>> runStreamed(Agent<TContext, TOutput> agent, String input, RunConfig config) Static method to run an agent with streaming and custom configuration.Methods inherited from class ai.acolite.agentsdk.core.EventEmitterDelegate
emit
-
Constructor Details
-
Runner
public Runner()
-
-
Method Details
-
run
public static <TContext,TOutput extends AgentOutputType> RunResult<TContext,?> run(Agent<TContext, TOutput> agent, String input) Static convenience method to run an agent with a single text input (blocking).This is the primary entry point for simple hello-world usage.
- Type Parameters:
TContext- The context typeTOutput- The output type- Parameters:
agent- The agent to runinput- The input text- Returns:
- The run result
-
runAsync
public static <TContext,TOutput extends AgentOutputType> CompletableFuture<RunResult<TContext,?>> runAsync(Agent<TContext, TOutput> agent, String input) Static method to run an agent asynchronously with a single text input.- Type Parameters:
TContext- The context typeTOutput- The output type- Parameters:
agent- The agent to runinput- The input text- Returns:
- CompletableFuture that resolves to the run result
-
run
public static <TContext,TOutput extends AgentOutputType> RunResult<TContext,?> run(Agent<TContext, TOutput> agent, String input, RunConfig config) Static method to run an agent with custom configuration (blocking).- Type Parameters:
TContext- The context typeTOutput- The output type- Parameters:
agent- The agent to runinput- The input textconfig- Custom run configuration- Returns:
- The run result
-
runAsync
public static <TContext,TOutput extends AgentOutputType> CompletableFuture<RunResult<TContext,?>> runAsync(Agent<TContext, TOutput> agent, String input, RunConfig config) Static method to run an agent asynchronously with custom configuration.- Type Parameters:
TContext- The context typeTOutput- The output type- Parameters:
agent- The agent to runinput- The input textconfig- Custom run configuration- Returns:
- CompletableFuture that resolves to the run result
-
runStreamed
public static <TContext,TOutput extends AgentOutputType> StreamedRunResult<TContext,Agent<TContext, runStreamedTOutput>> (Agent<TContext, TOutput> agent, String input) Static method to run an agent with streaming event emission.Returns immediately with a StreamedRunResult. Events are emitted in real-time as execution progresses. Use toStream() to iterate over events.
- Type Parameters:
TContext- The context typeTOutput- The output type- Parameters:
agent- The agent to runinput- The input text- Returns:
- StreamedRunResult with event stream
-
runStreamed
public static <TContext,TOutput extends AgentOutputType> StreamedRunResult<TContext,Agent<TContext, runStreamedTOutput>> (Agent<TContext, TOutput> agent, String input, RunConfig config) Static method to run an agent with streaming and custom configuration.- Type Parameters:
TContext- The context typeTOutput- The output type- Parameters:
agent- The agent to runinput- The input textconfig- Custom run configuration- Returns:
- StreamedRunResult with event stream
-