File size: 752 Bytes
32f259e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from __future__ import annotations

from typing import Dict, Any

from ..state import AgentState
from .workflow import build_workflow_app


def run_pipeline(topic: str, mode: str = "blog") -> AgentState:
    """
    High-level helper to run the full workflow from scratch.
    """
    initial_state: AgentState = {
        "topic": topic,
        "mode": mode,
        "research_snippets": [],
        "outline": [],
        "draft": "",
        "revised_draft": "",
        "final_output": "",
        "meta": {},
    }

    app = build_workflow_app()
    final_state: Dict[str, Any] = app.invoke(initial_state)  # type: ignore[assignment]
    # LangGraph returns a dict compatible with AgentState
    return final_state  # type: ignore[return-value]