Configuration for the orchestration
Options for the orchestration step
LLM model to use for orchestration (from the AI library)
OptionalsearchProvider?: anyDefault search provider to use for search-dependent steps
Optionaltools?: Record<string, ResearchStep>Map of tool names to step functions that can be used by the agent
OptionalcustomPrompt?: stringCustom prompt for the orchestration agent
OptionalmaxIterations?: numberMaximum number of iterations
OptionalexitCriteria?: (state: ResearchState) => boolean | Promise<boolean>Optional function that determines when to exit orchestration
OptionalincludeInResults?: booleanWhether to include the orchestration results in the final output
OptionalcontinueOnError?: booleanWhether to continue if a tool execution fails
OptionaltoolSelectorFn?: (Custom tool selection function (if provided, uses this instead of LLM)
Optionalretry?: { maxRetries?: number; baseDelay?: number }Retry configuration
OptionalmaxRetries?: numberMaximum number of retries
OptionalbaseDelay?: numberBase delay between retries in ms
An orchestration step for the research pipeline
import { research, orchestrate } from '@plust/datasleuth';
import { openai } from '@ai-sdk/openai';
import { google } from '@plust/search-sdk';
const results = await research({
query: 'Impact of climate change on agriculture',
outputSchema: schema,
steps: [
orchestrate({
model: openai('gpt-4o'),
searchProvider: google.configure({ apiKey: process.env.GOOGLE_API_KEY }),
maxIterations: 15,
continueOnError: true,
exitCriteria: (state) => state.data.summary !== undefined
})
]
});
Creates an orchestration step that uses agents to make decisions
This step uses an LLM to dynamically select and execute research tools based on the current state. It can handle an entire research process from start to finish by adaptively choosing the right tools.