Back to Prompt Library
planning

Design Initial LangGraph Workflow

Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.

Linked challenge: Robotics & Biotech Research Navigator Agent

Format
Code-aware
Lines
32
Sections
9
Linked challenge
Robotics & Biotech Research Navigator Agent

Prompt source

Original prompt text with formatting preserved for inspection.

32 lines
9 sections
No variables
1 code block
Using `LangGraph` within `LangChain`, define an initial graph with at least three nodes: `researcher`, `analyst`, and `synthesizer`. The `researcher` should use a web search tool (e.g., `SerpAPI`) to gather information. The `analyst` should process this information. The `synthesizer` should compile a report. Define the state for your graph and the edges between these nodes, considering how information flows sequentially.

```python
from typing import List, Annotated, TypedDict
from langchain_core.messages import BaseMessage
from langgraph.graph import StateGraph, END

class AgentState(TypedDict):
    research_query: str
    raw_search_results: List[str]
    analyzed_data: str
    final_report: str

def researcher_node(state: AgentState):
    # Simulate SerpAPI call
    print(f'Researcher is searching for: {state["research_query"]}')
    return {'raw_search_results': ['Search Result 1', 'Search Result 2']}

def analyst_node(state: AgentState):
    print('Analyst is processing search results...')
    # Simulate analysis with Claude Opus 4.1
    return {'analyzed_data': 'Processed insights from results.'}

def synthesizer_node(state: AgentState):
    print('Synthesizer is generating report...')
    # Simulate report generation with Claude Opus 4.1
    return {'final_report': 'Comprehensive Report.'}

workflow = StateGraph(AgentState)
workflow.add_node('researcher', researcher_node)
workflow.add_node('analyst', analyst_node)
workflow.add_node('synthesizer', synthesizer_node)

workflow.set_entry_point('researcher')
workflow.add_edge('researcher', 'analyst')
workflow.add_edge('analyst', 'synthesizer')
workflow.add_edge('synthesizer', END)

app = workflow.compile()
```

Adaptation plan

Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.

Keep stable

Preserve the role framing, objective, and reporting structure so comparison runs stay coherent.

Tune next

Swap in your own domain constraints, anomaly thresholds, and examples before you branch variants.

Verify after

Check whether the prompt asks for the right evidence, confidence signal, and escalation path.