Back to Prompt Library
implementation
Define LangGraph State Machine for Trial Matching
Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.
Linked challenge: LangChain IL-6 Pathway Clinical Trial Matching Workflow
Format
Code-aware
Lines
16
Sections
5
Linked challenge
LangChain IL-6 Pathway Clinical Trial Matching Workflow
Prompt source
Original prompt text with formatting preserved for inspection.
16 lines
5 sections
No variables
0 checklist items
from typing import TypedDict, List
from langgraph.graph import StateGraph, END
from langchain_openai import ChatOpenAI
class TrialState(TypedDict):
patient_data: dict
extracted_biomarkers: dict
is_eligible: bool
reasoning: List[str]
workflow = StateGraph(TrialState)
# Define nodes for extraction, verification, and decision
def extract_biomarkers(state: TrialState):
# Extract hsCRP and IL-6
return state
workflow.add_node('extract', extract_biomarkers)
workflow.set_entry_point('extract')
# Complete state graph routingAdaptation plan
Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.
Keep stable
Hold the task contract and output shape stable so generated implementations remain comparable.
Tune next
Update libraries, interfaces, and environment assumptions to match the stack you actually run.
Verify after
Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.