An article is the output with the most that can go wrong: it makes factual claims, it cites sources, and a person will put a brand's name on it. Its pipeline is the most elaborate in Studio. It is a state machine with two levels, written with LangGraph, and this page goes through its structure, its state and the choice of model at each node.
Two graphs

The main graph is the editorial process.
| Step | What it does |
|---|---|
select_topic | An editor-in-chief node picks the topic and builds an outline and keywords |
team_dispatch | Runs the team subgraph and writes its sub-steps to the database as they happen, with labels such as writer:2 |
parallel_enrich | Finds or generates images and writes search metadata, concurrently |
final_review | Approves the article or sends it back to the team |
finalize | Ends the graph. The pipeline then stores the article as waiting for a person’s approval |
The one conditional edge in the main graph is after the final review.
def _check_final_review(state: ArticleState) -> str:
"""After final review, either finalize or go back for revision."""
if state.get("status") == "approved":
return "finalize"
else:
return "team_dispatch"
graph.add_conditional_edges(
"final_review",
_check_final_review,
{"finalize": "finalize", "team_dispatch": "team_dispatch"},
)
The team subgraph is the desk that writes. There are several teams, one per subject area such as technology, economy or lifestyle, registered by id and built from the same template. A team researches, writes and reviews, and loops between writer and reviewer until the review passes.
With the stricter mode enabled by a flag, the team gains three nodes at the front and a hard gate after research. The wiring, shortened:
graph.set_entry_point("brand_ammunition")
graph.add_edge("brand_ammunition", "preflight_brief")
graph.add_edge("preflight_brief", "entry_router")
graph.add_conditional_edges(
"entry_router", _should_skip_research,
{"researcher": "researcher", "writer": "writer"},
)
# RESEARCH VALIDATION GATE (hard blocking edge): pass → writer, fail → END(team)
graph.add_conditional_edges(
"researcher", _research_gate,
{"writer": "writer", END: END},
)
graph.add_edge("writer", "reviewer")
Three routing functions decide the conditional edges, and each reads one field of the state.
| Function | Reads | Routes |
|---|---|---|
_should_skip_research | Whether research data already exists | To the writer when it does, which is the resume case |
_research_gate | research_gate_pass, defaulting to true | To the writer, or ends the team without writing |
_should_retry_or_finish | review_passed | Ends the team, or back to the writer |
One state
Both graphs pass one typed dictionary. Its fields fall into groups, and each node writes only its own.
| Group | Fields |
|---|---|
| Input | Platform, team, topic seed, user guide, brand and workspace ids, the writer’s provider and model |
| Topic | Topic, outline, keywords |
| Research | Research data, sources |
| Writing | Draft, draft version |
| Review | Feedback, whether review passed, fact-check issues, a revision guide, a report from the deterministic rules |
| Enrichment | Images, thumbnail, search title and description, tags |
| Tracking | A model log, human approval and feedback, status, error |
| Strict mode only | Article type and brief, brand facts, a source inventory, citations, gate results and their reasons, findings from each gate |
Two fields carry the loop. draft_version counts rewrites, and every ceiling in the system is expressed in it. revision_guide is what the reviewer writes for the writer: on the second and later drafts the writer’s prompt includes it, with required fact corrections listed first.
The model_log field is a list that each node appends to, recording which model actually ran. When an article reads oddly, the log says which combination produced it.
A model per node

The writer’s model is resolved in three steps: the value in the request, then the workspace’s setting, then a default from configuration.
The reviewer’s model is not configurable in the same way. It is derived from the writer’s.
def get_reviewer_llm(writer_provider: str) -> ChatOpenAI | ChatAnthropic:
"""Get cross-check reviewer LLM — automatically the opposite of writer_provider."""
if writer_provider == "openai":
# Writer is GPT → Reviewer is Claude
kwargs: dict = {
"model": settings.claude_model,
...
}
return ChatAnthropic(**kwargs)
# Writer is Claude → Reviewer is GPT
kwargs = {
"model": settings.gpt_model,
...
}
return ChatOpenAI(**kwargs)
Lines are removed where ... appears: temperature, token limits, timeouts, retries and API keys. Two callers use this function: the final review in the main graph, and the fact checker of the default mode. The strict mode’s fabrication audit does not, and runs on a fixed Claude model whichever vendor wrote the draft.
In the strict mode, outputs that feed code are constrained. Its research node forces a tool call whose schema is a list of claims, each with a source URL, and its fabrication check uses a tool call against the citations. The model cannot answer in free prose where a structure is expected.
Running, stopping and resuming
Two phases. A run can stop after select_topic and wait for the user to confirm the outline. Confirming starts the second phase from team_dispatch.
Progress. The pipeline iterates over the graph’s stream. After each step it writes the next step’s name and a selected set of state keys to the article document. One rule protects against the commonest corruption: an empty draft never overwrites a non-empty one.
No checkpointer. LangGraph offers checkpointing, and this graph is compiled without it. The article document already holds what a resume needs: the current step, the draft and its version, the research. A retry works out which step failed and builds a graph that contains only the remaining steps.
Rejection. Rejecting a finished article stores the person’s feedback and sets the status to rejected. A later retry on that article runs a revision pass with the feedback in the state.
Failure modes
| What happens | What the system does | Covered by |
|---|---|---|
| The pipeline raises in a single-phase run | The article is marked failed and its credits are refunded | Credit wiring tests for failed runs |
| The pipeline raises after the outline was confirmed | The article is marked failed and the charge from the first phase stays | The generate route, which passes no refund reference to the second phase |
| The run is cancelled | The article is marked cancelled | The pipeline’s cancellation branch |
| The image or metadata node fails | The failure is swallowed and the article continues without that part | The enrich node’s error handling |
| One of the three reviewers crashes | The others’ results are used, with a neutral default for the missing score | The review node gathers with exceptions returned |
| Research is already present on a retry | The researcher is skipped | The entry router’s condition |
| The research gate fails outright | The team ends without calling the writer | test_research_gate_blocks_writer_when_gate_false |
| The process dies mid-run | The heartbeat stops, the sweeper marks the document as an error | The sweeper and start-up recovery |
Graph wiring has its own tests: that the team subgraph has the original topology with the flag off, and that the strict nodes are inserted in order with it on.
Limits
- The main graph lives in the app layer. The domain package holds the nodes and the team graph. The outer graph and the editor-in-chief node are under the API app, which the layering rules list as known debt.
- Reviewers fail open. A crashed reviewer contributes a neutral score. That keeps runs moving, and it means a review can pass with one reviewer missing.
- Resume is by step, not by node. A retry restarts a whole step. Inside the team, work done before the failure is repeated unless research was already saved.
- The strict mode is behind a flag that defaults to off. Both topologies are in the code and both are tested.
