Sherpa AI Architecture#

Architecture Overview#

Sherpa AI is designed with a modular architecture that enables flexibility and extensibility. The framework consists of several key components that work together to create powerful AI agents and workflows.

digraph "Sherpa AI Architecture" { graph [fontname="Helvetica", fontsize=14, rankdir=TB, splines=ortho, nodesep=0.8, ranksep=0.8]; node [fontname="Helvetica", fontsize=12, shape=box, style="filled,rounded", fillcolor="#f5f5f5", color="#336790", margin=0.3]; edge [fontname="Helvetica", fontsize=10, color="#555555"]; /* Main Components */ Agents [fillcolor="#d5f5e3", label="Agents\nDomain-specific AI agents"]; Policies [fillcolor="#fdebd0", label="Policies\nDecision-making strategies"]; Memory [fillcolor="#ebdef0", label="Memory\nKnowledge persistence"]; Models [fillcolor="#fadbd8", label="Models\nLLM interfaces"]; Prompts [fillcolor="#e8daef", label="Prompts\nTemplate system"]; Actions [fillcolor="#f9e79f", label="Actions\nSpecialized operations"]; Tools [fillcolor="#d6eaf8", label="Tools\nUtility functions"]; Connectors [fillcolor="#d5f5e3", label="Connectors\nExternal system interfaces"]; Config [fillcolor="#f2f3f4", label="Config\nConfiguration management"]; /* Connections */ Agents -> Models [label="uses"]; Agents -> Prompts [label="loads"]; Agents -> Memory [label="stores/retrieves"]; Agents -> Actions [label="executes"]; Agents -> Policies [label="follows"]; Policies -> Actions [label="selects"]; Actions -> Tools [label="utilizes"]; Actions -> Connectors [label="interacts"]; Models -> Prompts [label="applies"]; Config -> {Agents, Models, Connectors} [style="dashed"]; }

Figure 1: Sherpa AI Architecture Overview#

Components#

Agents#

Agents are specialized AI components designed for specific domains or tasks:

digraph inheritancece3bd2a07a { bgcolor=transparent; fontsize=12; rankdir=TB; size="12.0, 12.0"; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "BaseAgent" [URL="API_Docs/sherpa_ai.agents.html#sherpa_ai.agents.base.BaseAgent",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for all agents in the Sherpa AI system."]; "ABC" -> "BaseAgent" [arrowsize=0.5,style="setlinewidth(0.5)"]; "BaseModel" -> "BaseAgent" [arrowsize=0.5,style="setlinewidth(0.5)"]; "BaseModel" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="!!! abstract \"Usage Documentation\""]; "QAAgent" [URL="API_Docs/sherpa_ai.agents.html#sherpa_ai.agents.qa_agent.QAAgent",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A specialized agent for answering questions and providing information."]; "BaseAgent" -> "QAAgent" [arrowsize=0.5,style="setlinewidth(0.5)"]; "UserAgent" [URL="API_Docs/sherpa_ai.agents.html#sherpa_ai.agents.user.UserAgent",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A specialized agent that redirects tasks to human users."]; "BaseAgent" -> "UserAgent" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Agent Class Hierarchy#

Agents build on a common interface while providing specialized functionality for different use cases:

  • QAAgent: Optimized for question answering

  • Critic: Evaluates outputs and provides feedback

  • MLEngineer: Specialized for machine learning tasks

Policies#

Policies determine how agents make decisions and process information:

  • ReactPolicy: Implements the Reasoning+Acting pattern

  • ChatPolicy: Optimized for conversational interactions

  • State Machine Policies: Use finite state machines for complex workflows

Memory#

Memory systems provide persistence across sessions and interactions:

  • SharedMemory: Allows agents to share information

  • ConversationMemory: Stores conversation history

  • VectorMemory: Enables semantic retrieval of information

Integration#

The power of Sherpa AI comes from the seamless integration of these components. The following diagram shows how data flows through a typical Sherpa AI application:

                 ┌────────────┐
                 │   Input    │
                 └─────┬──────┘
                       │
                       ▼
┌───────────────────────────────────────┐
│              Agent                    │
└───┬───────────────┬──────────────┬────┘
    │               │              │
    ▼               ▼              ▼
┌───────┐      ┌────────┐     ┌────────┐
│ Model │      │ Memory │     │ Policy │
└───┬───┘      └────────┘     └────┬───┘
    │                              │
    ▼                              │
┌───────┐                          │
│ Prompt│                          │
└───┬───┘                          │
    │                              │
    ▼                              │
┌───────┐                          │
│Actions│◄─────────────────────────┘
└───┬───┘
    │
    ▼
┌───────┐
│ Tools │
└───────┘

Sequence Flow#

The sequence diagram below illustrates how a user query flows through the Sherpa AI system:

digraph "Sherpa AI Query Flow" { graph [fontname="Helvetica", fontsize=14, rankdir=TB, splines=line, nodesep=0.8, ranksep=0.8]; node [fontname="Helvetica", fontsize=12, shape=box, style="filled,rounded", fillcolor="#f5f5f5", color="#336790", margin=0.3]; edge [fontname="Helvetica", fontsize=10, color="#555555"]; /* Participants */ User [fillcolor="#f8f9f9", label="User"]; Agent [fillcolor="#d5f5e3", label="QA Agent"]; Policy [fillcolor="#fdebd0", label="React Policy"]; Memory [fillcolor="#ebdef0", label="Memory"]; Model [fillcolor="#fadbd8", label="LLM"]; Action [fillcolor="#f9e79f", label="Search Action"]; /* Invisible edges for layout */ edge [style=invis]; User -> Agent -> Policy -> Memory -> Model -> Action; /* Sequence edges */ edge [style=solid, color="#555555", constraint=false]; User -> Agent [label="1. Query", constraint=false]; Agent -> Memory [label="2. Check Memory", constraint=false]; Memory -> Agent [label="3. Return Context", constraint=false]; Agent -> Policy [label="4. Apply Policy", constraint=false]; Policy -> Action [label="5. Select Action", constraint=false]; Action -> Model [label="6. Get Result", constraint=false]; Model -> Agent [label="7. Generate Response", constraint=false]; Agent -> User [label="8. Final Answer", constraint=false]; /* Rankings for proper sequence layout */ { rank=same; User; } { rank=same; Agent; } { rank=same; Policy; Memory; } { rank=same; Model; Action; } }

Figure 2: Sherpa AI Query Sequence Flow#

This sequence shows:

  1. A user submits a query to the Agent

  2. The Agent checks Memory for relevant context

  3. The Agent’s Policy determines the next action

  4. Actions are executed to gather information

  5. The Model generates a response based on all inputs

  6. The final response is returned to the user