Code Examples

Don't start from scratch. Browse interactive blueprints, switch languages, copy snippets, and jump straight into the sandbox.

Interactive example

Multi-Step Research Flow

Chain search, analysis, and summary phases into one reusable workflow with typed inputs and traceable outputs.

Run in sandbox
typescript
import { GraphBuilder, llmNode, toolNode } from 'servoagent'

const graph = new GraphBuilder('research-flow')
  .addNode(toolNode('search', 'Search', { connector: 'web-search' }))
  .addNode(llmNode('analyze', 'Analyze', { model: 'GPT_4O' }))
  .addNode(llmNode('summarize', 'Summarize', { model: 'GPT_4O_MINI' }))
  .connect('search', 'analyze')
  .connect('analyze', 'summarize')
  .setEntryPoint('search')
  .addEndNode('summarize')
  .build()

Expected output

Run created: run_123
Status: completed
Output: prioritized summary with sources