Built-in Agents
AgentMap provides a comprehensive set of built-in agents for common workflow tasks. All agents inherit from BaseAgent
and implement a process()
method for data transformation.
Agent Architecture
BaseAgent Foundation
Every AgentMap agent follows the same architectural pattern:
class BaseAgent:
def __init__(self, name: str, prompt: str, context: Dict[str, Any] = None):
self.name = name
self.prompt = prompt
self.context = context or {}
self.input_fields = self.context.get("input_fields", [])
self.output_field = self.context.get("output_field", None)
def process(self, inputs: Dict[str, Any]) -> Any:
"""Transform inputs to output - implemented by each agent type"""
raise NotImplementedError("Subclasses must implement process()")
Key Principles:
- Single Responsibility: Each agent has one clear purpose
- Data Flow: Input fields →
process()
method → output field - Error Handling: Built-in exception handling and error routing
- Service Injection: Optional services (LLM, storage) injected via protocols
Agent Execution Flow
- Input Extraction: System extracts values from state using
input_fields
- Processing: Agent's
process()
method transforms inputs - Output Integration: Result stored in state using
output_field
- Flow Control: Success routes to
next_node
, errors toerror_node
Agent Categories
🧠 LLM Agents
AI-powered agents using language models for reasoning and generation:
Agent Type | Purpose | Key Features |
---|---|---|
llm | General LLM processing | Multi-provider support, routing, memory |
summary | Text summarization | Configurable length, format options |
classification | Content classification | Custom categories, confidence scoring |
💾 Storage Agents
Data persistence and retrieval from various storage systems:
Agent Type | Purpose | Key Features |
---|---|---|
csv_reader | Read CSV files | Collection-based access, format options |
csv_writer | Write CSV data | Append/overwrite modes, validation |
json_reader | Read JSON documents | Path-based access, collection support |
json_writer | Write JSON data | Document management, nested paths |
📁 File Agents
File system operations for document processing:
Agent Type | Purpose | Key Features |
---|---|---|
file_reader | Read file contents | Multiple formats, encoding detection |
file_writer | Write file contents | Path creation, backup options |
directory_list | List directory contents | Filtering, recursive scanning |
🔧 Control Flow Agents
Workflow orchestration and routing logic:
Agent Type | Purpose | Key Features |
---|---|---|
orchestrator | Intelligent routing | Multi-strategy node selection |
router | Conditional routing | Rule-based decision making |
parallel | Parallel execution | Concurrent processing, synchronization |
🏗️ Core Agents
Basic building blocks for data flow and workflow control:
Agent Type | Purpose | Key Features |
---|---|---|
input | User input collection | Interactive prompts, validation |
echo | Data passthrough | State inspection, debugging |
default | Custom processing | Placeholder for custom logic |
Interactive Agent Catalog
Explore all available agents with examples and configuration options:
AgentMap Agent Catalog
Browse all available agent types with examples and configurations
DefaultAgent
default
The simplest agent that logs its execution and returns a message with the prompt.
TestGraph,Start,,Basic node,default,Next,,input,output,Hello World
EchoAgent
echo
Simply returns the input data unchanged.
TestGraph,Echo,,Echo node,echo,Next,,message,response,
BranchingAgent
branching
Used for testing conditional routing. Checks for success/failure indicators in inputs.
TestGraph,Branch,,Decision point,branching,SuccessPath,FailurePath,input,decision,Make a choice
SuccessAgent
success
Testing agent that always succeeds.
TestGraph,AlwaysSucceed,,Success node,success,Next,,input,result,I always succeed
FailureAgent
failure
Testing agent that always fails.
TestGraph,AlwaysFail,,Failure node,failure,Next,,input,result,I always fail
InputAgent
input
Prompts for user input during execution.
TestGraph,GetInput,,User input node,input,Process,,message,user_input,Please enter your name:
LLMAgent
llm
Uses configurable LLM providers for text generation with intelligent routing support.
QAGraph,Question,{"routing_enabled": true, "task_type": "analysis"},Ask a question,llm,Answer,,question,response,Answer this question: {question}
OpenAIAgent
openai
(aliases: gpt
chatgpt
)Backward compatibility wrapper for LLMAgent with OpenAI provider.
QAGraph,Question,{"model": "gpt-4", "temperature": 0.7},Ask a question,openai,Answer,,question,response,Answer this question: {question}