With this project, I wanted to experiment with the create_agent pattern in LangGraph. This was previously known as create_react_agent, but it was renamed in the 1.0 release. I actually think the original name was more descriptive because it explicitly implements the ReAct (Reasoning and Acting) pattern.
ReAct is a fundamental building block for agentic applications. It is a simple but powerful loop: the agent receives instructions, uses its tools to reason and execute, and then reflects on the results until the task is complete.
The Supervisor and Orchestration
Another goal was to explore the supervisor (or orchestrator) pattern via a conversational CLI. The setup is similar to tools like Claude Code where the user interacts through a command line.
In this architecture, user queries go to a Supervisor agent first. Its primary job is to determine intent. Once it understands what the user wants to do, it delegates the work to a specific subagent.
Why Handoffs Matter
The delegation happens using the handoff pattern, which is different from standard execution flows. In many systems, a supervisor acts as a middleman for every single interaction. This becomes a bottleneck in conversational systems that require Human-in-the-Loop (HITL).
If a subagent needs to ask the user for clarification, a traditional flow would require the subagent to pass control back to the supervisor, which then asks the user, receives the answer, and passes it back again.
I think of this as micromanagement vs. full delegation. In real life, you want to hand off a task and say, "Go do this and let me know when it's done." You don't want to be bogged down by the day-to-day details of how the subagent executes. The handoff pattern allows the subagent to own the conversation with the user directly until its specific task is finished.
Building the Content Scout
The Agentic Content Scout allows users to track specific topics, like "AI development news" or "Open world video games." You can define preferences for each topic—for example, prioritizing academic research over marketing fluff, or avoiding social media in favor of reputable news outlets.
The system uses two subagents:
- Topic Manager: Handles the CRUD operations for maintaining topics and preferences.
- Content Scout: Uses the Tavily search tool to find and retrieve articles.
How the Graph Works
The system is built as a LangGraph main graph using MemorySaver as a checkpointer to maintain state. The execution loop follows these steps:
- Input: The user sends a command like "create a topic for AI safety."
-
Intent: The Supervisor receives the message and decides to call the
handoff_to_topicstool. -
Command: The handoff tool returns a LangGraph
Commandobject. This tells the graph to stay within the agent node but switch theactive_agentstate totopic_manager. -
Ownership: The Topic Manager takes over the conversation. If it needs more info, it calls a
gather_preferencestool which triggers a LangGraphinterrupt(). - Pause and Resume: The graph saves its state and returns control to the CLI. Once the user answers, the checkpointer restores the state and the Topic Manager resumes exactly where it left off—without the supervisor ever being involved.
- Completion: Once the subagent finishes, it hands back a summary to the Supervisor, which provides the final response to the user.
The beauty of this pattern is that the supervisor truly delegates. It doesn't micromanage or relay messages. The subagent handles everything, including user interactions, and only reports back when done. The graph's single node design with dynamic routing makes handoffs clean: you just update a state field and loop.
Here is the repo: https://github.com/juhapellotsalo/agentic-content-scout
Top comments (0)