Add src/cli.py

This commit is contained in:
2026-06-05 12:37:44 +00:00
parent bec4a732e3
commit 48da8c1c4a
+37
View File
@@ -0,0 +1,37 @@
"""Commandline interface for the research brief generator.
Usage:
python -m src.cli "Your research question"
The CLI will:
1. Build the LangGraph.
2. Run the graph with the supplied topic.
3. Print the outline, stepbystep notes, and final brief.
"""
import asyncio
import sys
from .brief import build_graph
def main():
if len(sys.argv) < 2:
print("Usage: python -m src.cli \"Your research question\"")
sys.exit(1)
topic = sys.argv[1]
graph = build_graph()
state = {
"topic": topic,
"outline": None,
"step_index": 0,
"notes": [],
"final_brief": None,
}
result = asyncio.run(graph.invoke(state))
# The graph already prints progress.
# Print final brief if not already printed.
if result.get("final_brief"):
print("\n=== Final Brief ===")
print(result["final_brief"])
if __name__ == "__main__":
main()