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.

Attribute
Type
Description

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.

Attribute
Type
Description

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.

Attribute
Type
Description

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


Workflow

  1. Agent Creation Define each expert with a system_prompt.

  2. Tree Formation Group agents into domain-specific trees.

  3. Forest Execution Forest scans all trees, selects the best tree → best agent → executes task.

  4. 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


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