Configuration for the orchestration
Options for the orchestration step
LLM model to use for orchestration (from the AI library)
Optional
searchProvider?: anyDefault search provider to use for search-dependent steps
Optional
tools?: Record<string, ResearchStep>Map of tool names to step functions that can be used by the agent
Optional
customPrompt?: stringCustom prompt for the orchestration agent
Optional
maxIterations?: numberMaximum number of iterations
Optional
exitCriteria?: (state: ResearchState) => boolean | Promise<boolean>Optional function that determines when to exit orchestration
Optional
includeInResults?: booleanWhether to include the orchestration results in the final output
Optional
continueOnError?: booleanWhether to continue if a tool execution fails
Optional
toolSelectorFn?: (Custom tool selection function (if provided, uses this instead of LLM)
Optional
retry?: { maxRetries?: number; baseDelay?: number }Retry configuration
Optional
maxRetries?: numberMaximum number of retries
Optional
baseDelay?: 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.