# Example 13: Variables & Context # # This example demonstrates using let/const bindings to capture session # outputs and pass them as context to subsequent sessions. # Define specialized agents for the workflow agent researcher: model: sonnet prompt: "You are a thorough research assistant who gathers comprehensive information on topics." agent analyst: model: opus prompt: "You are a data analyst who identifies patterns, trends, and key insights." agent writer: model: opus prompt: "You are a technical writer who creates clear, well-structured documents." # Step 1: Gather initial research (captured in a variable) let research = session: researcher prompt: "Research the current state of quantum computing, including recent breakthroughs, major players, and potential applications." # Step 2: Analyze the research findings (using research as context) let analysis = session: analyst prompt: "Analyze the key findings and identify the most promising directions." context: research # Step 3: Get additional perspectives (refreshing context) let market-trends = session: researcher prompt: "Research market trends and commercial applications of quantum computing." context: [] # Step 4: Combine multiple contexts for final synthesis const report = session: writer prompt: "Write a comprehensive executive summary covering research, analysis, and market trends." context: [research, analysis, market-trends] # Step 5: Iterative refinement with variable reassignment let draft = session: writer prompt: "Create an initial draft of the technical deep-dive section." context: research # Refine the draft using its own output as context draft = session: writer prompt: "Review and improve this draft for clarity and technical accuracy." context: draft # Final polish draft = session: writer prompt: "Perform final editorial review and polish the document." context: draft