Hierarchical Task Agent
This workflow uses a hierarchical team of AI agents (CrewAI) for complex research. A Manager delegates to an Investigator and an Editor to ensure a reliable and verified response.
+3
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
ChatOutput-1ki92[<div><img alt="logo" src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Output]
style ChatOutput-1ki92 stroke:#a170ff
Prompt-1d7fs[<div><img alt="logo" src="/_astro/square-terminal.BMOXc-nZ.svg" style="height: 20px !important;width: 20px !important"/></div>Prompt]
style Prompt-1d7fs stroke:#a170ff
ChatInput-niave[<div><img alt="logo" src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Input]
style ChatInput-niave stroke:#a170ff
CrewAIAgent-4hpce[<div><img alt="logo" src="/_astro/crewai.CIO1Tb4h.svg" style="height: 20px !important;width: 20px !important"/></div>Editor Agent]
style CrewAIAgent-4hpce stroke:#a170ff
CrewAIAgent-azzrz[<div><img alt="logo" src="/_astro/crewai.CIO1Tb4h.svg" style="height: 20px !important;width: 20px !important"/></div>Manager Agent]
style CrewAIAgent-azzrz stroke:#a170ff
CrewAIAgent-syb3i[<div><img alt="logo" src="/_astro/crewai.CIO1Tb4h.svg" style="height: 20px !important;width: 20px !important"/></div>Research Agent]
style CrewAIAgent-syb3i stroke:#a170ff
HierarchicalTask-na6d4[<div><img alt="logo" src="/_astro/crewai.CIO1Tb4h.svg" style="height: 20px !important;width: 20px !important"/></div>Hierarchical Task]
style HierarchicalTask-na6d4 stroke:#a170ff
HierarchicalCrew-zc0xb[<div><img alt="logo" src="/_astro/crewai.CIO1Tb4h.svg" style="height: 20px !important;width: 20px !important"/></div>Crew]
style HierarchicalCrew-zc0xb stroke:#a170ff
OpenAIModel-dkg5c[<div><img alt="logo" src="/_astro/openAI.BhmuxEs3.svg" style="height: 20px !important;width: 20px !important"/></div>LLM]
style OpenAIModel-dkg5c stroke:#a170ff
OllamaWebSearch-4f66r[<div><img alt="logo" src="/_astro/Ollama.D_3DT10O.svg" style="height: 20px !important;width: 20px !important"/></div>Ollama Web Search]
style OllamaWebSearch-4f66r stroke:#a170ff
OllamaTurboModel-wbjnr[<div><img alt="logo" src="/_astro/Ollama.D_3DT10O.svg" style="height: 20px !important;width: 20px !important"/></div>Ollama Cloud]
style OllamaTurboModel-wbjnr stroke:#a170ff
OllamaTurboModel-lz82z[<div><img alt="logo" src="/_astro/Ollama.D_3DT10O.svg" style="height: 20px !important;width: 20px !important"/></div>Ollama Cloud2]
style OllamaTurboModel-lz82z stroke:#a170ff
OllamaTurboModel-q40bu[<div><img alt="logo" src="/_astro/Ollama.D_3DT10O.svg" style="height: 20px !important;width: 20px !important"/></div>Ollama Cloud3]
style OllamaTurboModel-q40bu stroke:#a170ff
Prompt-1d7fs -.- HierarchicalTask-na6d4
linkStyle 0 stroke:#a170ff
HierarchicalTask-na6d4 -.- HierarchicalCrew-zc0xb
linkStyle 1 stroke:#a170ff
CrewAIAgent-syb3i -.- HierarchicalCrew-zc0xb
linkStyle 2 stroke:#a170ff
CrewAIAgent-4hpce -.- HierarchicalCrew-zc0xb
linkStyle 3 stroke:#a170ff
OpenAIModel-dkg5c -.- HierarchicalCrew-zc0xb
linkStyle 4 stroke:#a170ff
CrewAIAgent-azzrz -.- HierarchicalCrew-zc0xb
linkStyle 5 stroke:#a170ff
HierarchicalCrew-zc0xb -.- ChatOutput-1ki92
linkStyle 6 stroke:#a170ff
OllamaWebSearch-4f66r -.- CrewAIAgent-syb3i
linkStyle 7 stroke:#a170ff
OllamaTurboModel-wbjnr -.- CrewAIAgent-syb3i
linkStyle 8 stroke:#a170ff
OllamaTurboModel-lz82z -.- CrewAIAgent-4hpce
linkStyle 9 stroke:#a170ff
OllamaTurboModel-q40bu -.- CrewAIAgent-azzrz
linkStyle 10 stroke:#a170ff
ChatInput-niave -.- Prompt-1d7fs
linkStyle 11 stroke:#a170ff
🧩 Overview
This workflow implements a hierarchical AI‑team that answers complex user queries.
A user message is first transformed into a structured prompt, which defines a single task.
The task is then delegated to a crew of specialized agents: a manager, an investigator and an editor.
The manager, powered by an OpenAI model, orchestrates the crew; the investigator and editor use Ollama models and a web‑search tool to gather and validate information.
Finally, the crew’s consolidated, verified answer is displayed to the user in the chat output.
⚙️ Main Features
- User‑centric interaction: The workflow starts with the user’s chat message and ends with an answer presented back in the same chat interface.
- Hierarchical task creation: A prompt component builds a clear task description that feeds a hierarchical task component.
- Multi‑agent collaboration: A manager agent coordinates a crew of an investigator and an editor, each with dedicated language models and toolsets.
- External web search integration: The investigator agent can call an Ollama‑based web‑search tool to retrieve up‑to‑date information.
- Quality control: The editor agent reviews the investigator’s output for bias or inaccuracies before final delivery.
- Dynamic model selection: All agents can be configured to use different LLMs (OpenAI or Ollama) and tool sets.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Chat Input | Receives the user’s message from the playground chat. | User text, optional attachments | Structured chat message |
| Prompt | Builds a prompt template from the chat message. | Chat message | Prompt message (task description) |
| Hierarchical Task | Creates a task object from the prompt. | Prompt message | Task description and expected outcome |
| Investigator Agent | Researches the topic, optionally using web search. | Task description, Ollama Turbo model, Web‑search tool | Research notes |
| Editor Agent | Validates and edits the investigator’s findings. | Research notes, Ollama Turbo model | Edited, bias‑checked summary |
| Manager Agent | Orchestrates the crew, integrates outputs, and ensures quality. | Task description, manager LLM (OpenAI), agents | Consolidated answer |
| Hierarchical Crew | Orchestrates the agents, executes the task, and aggregates results. | Task, manager agent, investigator agent, editor agent | Final message for the user |
| Chat Output | Displays the final answer in the playground chat. | Final message from crew | Visible chat reply |
🧠 Notes
- The workflow relies on external AI model services: an OpenAI model for the manager and Ollama Turbo models for the investigator and editor.
- An Ollama‑based web‑search tool is available to the investigator; credentials for this tool must be configured.
- The crew operates in a single session, and the OpenAI model is reused for all manager‑related interactions.
- The system preserves conversation context by passing conversation IDs between components.
- Caching is enabled for model and tool responses to improve performance on repeated queries.
- The design is modular: new agents, models, or tools can be added by extending the crew configuration without altering the core workflow.