Spaces:
Sleeping
Sleeping
| 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] | |