Loading...
const result = await runAgent({
goal: 'Translate the article, summarize it and add tags',
tools: allTools,
});const translated = await llm.generate({ prompt: translatePrompt(article) });
const summary = await llm.generate({ prompt: summaryPrompt(translated.text) });
const tagged = await llm.generate({ prompt: tagPrompt(summary.text) });
const tags = parseTags(tagged.text);
if (tags.length === 0) throw new Error('Tagging step failed');The steps are known, so code fixes their order and the model only does each step, which is simpler to test.
When the task always follows the same steps. Agents fit open-ended tasks where the next step depends on earlier results.
Prompt chaining, routing to a specialized prompt, running steps in parallel, and an evaluator step that checks and refines output.
Yes. A fixed workflow can call an agent for one open-ended step and keep the other steps deterministic.