Skip to content

Latest commit

 

History

History
123 lines (75 loc) · 5.61 KB

File metadata and controls

123 lines (75 loc) · 5.61 KB
title Agent Workflow Patterns
description Agent Workflow Patterns component details
graph LR
    LLM_Augmentation_Layer["LLM Augmentation Layer"]
    Embedding_Models["Embedding Models"]
    Orchestration_Workflow["Orchestration Workflow"]
    Routing_Workflow["Routing Workflow"]
    Intent_Classification_Workflow["Intent Classification Workflow"]
    Parallel_LLM_Workflow["Parallel LLM Workflow"]
    Swarm_Workflow["Swarm Workflow"]
    Evaluation_Optimization_Workflow["Evaluation & Optimization Workflow"]
    Orchestration_Workflow -- "uses" --> LLM_Augmentation_Layer
    Routing_Workflow -- "uses" --> LLM_Augmentation_Layer
    Routing_Workflow -- "uses" --> Embedding_Models
    Intent_Classification_Workflow -- "uses" --> LLM_Augmentation_Layer
    Intent_Classification_Workflow -- "uses" --> Embedding_Models
    Parallel_LLM_Workflow -- "uses" --> LLM_Augmentation_Layer
    Swarm_Workflow -- "uses" --> LLM_Augmentation_Layer
    Evaluation_Optimization_Workflow -- "uses" --> LLM_Augmentation_Layer
Loading
This documentation was generated by [CodeBoarding](https://github.com/CodeBoarding/GeneratedOnBoardings) to provide comprehensive architectural insights into the mcp-agent framework.

Details

Abstract Components Overview

LLM Augmentation Layer

This foundational component provides a unified and augmented interface for interacting with various Large Language Models (LLMs) from different providers (e.g., Anthropic, OpenAI, Google). It abstracts away provider-specific API calls, handles structured completion, and integrates with the agent's context. It also includes a ModelSelector for choosing optimal LLMs.

Related Classes/Methods:

  • mcp_agent.workflows.llm.augmented_llm.AugmentedLLM (218:668)
  • mcp_agent.workflows.llm.llm_selector.ModelSelector (96:413)
  • mcp_agent.workflows.llm.augmented_llm_anthropic.AnthropicAugmentedLLM (110:722)

Embedding Models

This component offers a standardized interface for generating and managing text embeddings using various underlying embedding models (e.g., Cohere, OpenAI). These vector representations of text are crucial for semantic search, similarity comparisons, and other vector-based operations.

Related Classes/Methods:

  • mcp_agent.workflows.embedding.embedding_base.EmbeddingModel (13:31)
  • mcp_agent.workflows.embedding.embedding_cohere.CohereEmbeddingModel (18:72)
  • mcp_agent.workflows.embedding.embedding_openai.OpenAIEmbeddingModel (18:70)

Orchestration Workflow

Responsible for managing complex, multi-step agent behaviors. It defines how agents plan, execute, and refine sequences of actions and tasks, often involving iterative processes and dynamic task management. This enables agents to break down complex problems into manageable steps and coordinate their execution.

Related Classes/Methods:

  • mcp_agent.workflows.orchestrator.orchestrator.Orchestrator (45:585)
  • mcp_agent.workflows.orchestrator.orchestrator_models.AgentTask (26:31)
  • mcp_agent.workflows.orchestrator.orchestrator_prompts

Routing Workflow

Intelligently directs incoming requests or tasks to the most appropriate agent, tool, or sub-workflow. It supports various routing strategies, including LLM-based decision-making and embedding-based similarity matching, enabling dynamic and context-aware task distribution within the agent system.

Related Classes/Methods:

  • mcp_agent.workflows.router.router_base.Router (63:275)
  • mcp_agent.workflows.router.router_llm.LLMRouter (81:373)
  • mcp_agent.workflows.router.router_embedding.EmbeddingRouter (28:239)

Intent Classification Workflow

Dedicated to identifying the underlying intent of a user's query or system message. It leverages both LLM-based reasoning and embedding-based similarity to accurately classify intents, which then informs the agent's subsequent actions or selection of appropriate workflows.

Related Classes/Methods:

  • mcp_agent.workflows.intent_classifier.intent_classifier_base.IntentClassifier (42:85)
  • mcp_agent.workflows.intent_classifier.intent_classifier_llm.LLMIntentClassifier (63:243)
  • mcp_agent.workflows.intent_classifier.intent_classifier_embedding.EmbeddingIntentClassifier (32:177)

Parallel LLM Workflow

Enables the concurrent execution of multiple LLM calls or agent actions. It implements "fan-out" to distribute tasks in parallel and "fan-in" to aggregate their results, significantly improving the efficiency and throughput of LLM-intensive operations.

Related Classes/Methods:

  • mcp_agent.workflows.parallel.parallel_llm.ParallelLLM (23:279)
  • mcp_agent.workflows.parallel.fan_in.FanIn (30:422)
  • mcp_agent.workflows.parallel.fan_out.FanOut (23:243)

Swarm Workflow

Facilitates collaborative problem-solving among multiple agents. It enables agents to interact, share information, and collectively work towards a common goal, supporting complex, distributed agent behaviors and multi-agent systems.

Related Classes/Methods:

  • mcp_agent.workflows.swarm.swarm.Swarm (189:310)
  • mcp_agent.workflows.swarm.swarm_anthropic.AnthropicSwarm (8:41)
  • mcp_agent.workflows.swarm.swarm_openai.OpenAISwarm (8:40)

Evaluation & Optimization Workflow

Provides mechanisms for evaluating the performance, quality, and effectiveness of agent outputs or entire workflows. It can be used to assess responses, identify areas for improvement, and potentially guide the agent towards optimizing its future actions.

Related Classes/Methods:

  • mcp_agent.workflows.evaluator_optimizer.evaluator_optimizer.EvaluatorOptimizerLLM (47:475)