Crowe Forest Architecture
The Crowe Forest Architecture organizes intelligent agents into domain-specific trees. Each agent is an expert node with a unique specialization, allowing the forest to dynamically assign tasks to the most relevant agent using keyword extraction and embedding-based similarity matching.
A forest is composed of multiple trees, each representing a knowledge domain (e.g., Finance, Legal, Research). Within each tree, agents are ranked by their relevance to a given task. Tasks are processed asynchronously, ensuring fast, scalable execution.
Module Path
crowe.structs.tree_forest
Core Components
Class: TreeAgent
Represents an individual expert agent inside a tree.
system_prompt
str
Defines the agent’s domain expertise.
llm
callable
The language model used for task execution.
agent_name
str
Identifier for the agent.
system_prompt_embedding
tensor
Embedding vector for semantic matching.
relevant_keywords
list[str]
Keywords auto-extracted from the prompt.
distance
float?
Embedding similarity distance to another agent.
Key Methods
calculate_distance(other_agent)
→ float Calculates cosine similarity between two agents.run_task(task)
→ Any Executes the assigned task and logs the I/O.is_relevant_for_task(task, threshold=0.7)
→ bool Determines if the agent should handle the task.
Class: Tree
A container of agents within the same domain.
tree_name
str
Domain name for the tree.
agents
list[TreeAgent]
Agent instances within the tree.
Key Methods
calculate_agent_distances()
Precomputes similarity scores between agents.find_relevant_agent(task)
→ TreeAgent? Selects the best-matched agent for the task.log_tree_execution(task, agent, result)
Logs details of execution for auditing.
Class: ForestCrowe
The top-level orchestrator managing multiple trees.
trees
list[Tree]
All registered trees in the forest.
Key Methods
find_relevant_tree(task)
→ Tree? Finds the most suitable tree for the task.run(task)
→ Any Selects the best agent from the best tree and runs the task.
Example Code
from crowe.structs.tree_forest import TreeAgent, Tree, ForestCrowe
# Agents
finance_agents = [
TreeAgent(system_prompt="Stock market analysis", agent_name="Stock Analyst"),
TreeAgent(system_prompt="Financial planning & budgeting", agent_name="Planner"),
TreeAgent(system_prompt="Retirement strategies", agent_name="Retirement Advisor")
]
tax_agents = [
TreeAgent(system_prompt="Tax filing and compliance", agent_name="Tax Expert"),
TreeAgent(system_prompt="Investment strategy", agent_name="Investment Strategist"),
TreeAgent(system_prompt="ROTH IRA guidance", agent_name="ROTH Specialist")
]
# Trees
finance_tree = Tree(tree_name="Finance", agents=finance_agents)
tax_tree = Tree(tree_name="Tax & Investment", agents=tax_agents)
# Forest
crowe_forest = ForestCrowe(trees=[finance_tree, tax_tree])
# Task
task = "Our company is in Delaware, how do we file taxes for free?"
result = crowe_forest.run(task)
print(result)
Workflow
Agent Creation Define each expert with a
system_prompt
.Tree Formation Group agents into domain-specific trees.
Forest Execution Forest scans all trees, selects the best tree → best agent → executes task.
Result Delivery Output is returned, execution is logged.
Architecture Advantages
Domain Modularity — Add or remove entire trees without disrupting others.
Precision Matching — Combines keyword & embedding similarity for accurate selection.
Asynchronous Scaling — Handles many tasks in parallel.
Audit-Friendly — Detailed execution logs per task.
Mermaid Diagram
graph TD
A[ForestCrowe] --> B[Finance Tree]
A --> C[Tax & Investment Tree]
B --> B1[Stock Analyst]
B --> B2[Planner]
B --> B3[Retirement Advisor]
C --> C1[Tax Expert]
C --> C2[Investment Strategist]
C --> C3[ROTH Specialist]
Summary
The Crowe Forest Architecture transforms agent orchestration into a search + match + execute pipeline. By structuring agents into trees and forests, the system achieves:
Scalability for growing knowledge bases
Relevance-driven routing for higher task accuracy
Transparent logging for trust and compliance
Last updated