Agent TypesΒΆ
Haive Agents provides a comprehensive suite of dynamically recompilable and fully serializable agent types, each capable of runtime modification across their entire component stack. From simple conversational agents to sophisticated multi-agent orchestrators, our framework offers living, adaptable building blocks that can modify their tools, LLM configurations, retrieval systems, graph structures, and coordination patterns at runtime without restarts.
Foundation AgentsΒΆ

Dynamic Foundation Agent with Runtime Recompilation
Perfect for conversational AI, structured output generation, and role-playing scenarios. Fully recompilable - modify tools, LLM configs, and behavior patterns at runtime. Completely serializable for persistence and transfer between systems.

Self-Modifying Reasoning & Acting Agent
Advanced agents with dynamic tool integration, recompilable reasoning loops, and adaptive planning. Tools, retrieval systems, and reasoning patterns can be modified at runtime. Perfect for research tasks that evolve their methodology dynamically.
Coordination AgentsΒΆ

Fully Serializable Multi-Agent Orchestration System
Coordinate multiple agents with runtime reconfigurable workflows, dynamic agent addition/removal, and live routing adaptation. Entire coordination graphs can be serialized, modified, and recompiled without stopping execution.
Specialized AgentsΒΆ
Multi-Agent Dialogue Orchestration
5 conversation types with sophisticated turn management and social dynamics.
Intelligent Memory Systems
Graph-based memory with 11 cognitive types and advanced retrieval.
Runtime Behavior Adaptation
Agents that modify their own behavior based on performance feedback.
Dynamic Agent Cloning
Create specialized copies with different configurations for parallel tasks.
Dynamic Provider Management
Hot-swap between LLM providers based on task complexity and cost.
Capability Sharing System
Share tools and capabilities between agents for efficient resource use.
SimpleAgentΒΆ
The foundation agent perfect for basic conversational AI, structured output, and role-playing scenarios.
Core CapabilitiesΒΆ
Persistent Context & Memory
Automatic conversation history tracking
Context window management
Message formatting and templating
Multi-turn conversation support
Pydantic Model Integration
Type-safe response generation
Automatic validation and parsing
Complex data structure support
JSON schema compatibility
Dynamic Character Simulation
Character consistency maintenance
Personality trait modeling
Scenario-based adaptations
Emotional state tracking
Composable Agent Architecture
Convert any agent to a tool
Nested agent workflows
Capability encapsulation
Modular design patterns
Usage ExamplesΒΆ
Simple conversational agent with memory:
from haive.agents.simple import SimpleAgent
from haive.core.engine.aug_llm import AugLLMConfig
# Create conversational agent
agent = SimpleAgent(
name="assistant",
engine=AugLLMConfig(
temperature=0.7,
system_message="You are a helpful AI assistant."
)
)
# Multi-turn conversation
response1 = await agent.arun("My name is Alice")
response2 = await agent.arun("What's my name?")
# Agent remembers: "Your name is Alice"
Generate structured data with Pydantic models:
from pydantic import BaseModel, Field
from typing import List
class AnalysisResult(BaseModel):
sentiment: str = Field(description="positive/negative/neutral")
confidence: float = Field(ge=0.0, le=1.0)
key_themes: List[str] = Field(description="Main themes")
# Agent with structured output
structured_agent = SimpleAgent(
name="analyzer",
engine=AugLLMConfig(
structured_output_model=AnalysisResult,
temperature=0.3
)
)
result = await structured_agent.arun("This product is amazing!")
print(f"Sentiment: {result.sentiment}")
print(f"Confidence: {result.confidence}")
Create character-based agents:
# Character agent with consistent personality
character = SimpleAgent(
name="detective",
engine=AugLLMConfig(
temperature=0.8,
system_message="""
You are Detective Sarah Chen, a seasoned investigator with 15 years
experience. You're analytical, methodical, and have a dry sense of humor.
You always look for evidence and ask probing questions.
"""
)
)
response = await character.arun("There's been a robbery at the bank")
# Detective persona maintained throughout interaction
ReactAgentΒΆ
Advanced reasoning agent that follows the ReAct (Reasoning and Acting) pattern for complex problem-solving.
Core CapabilitiesΒΆ
Think-Act-Observe Loop
Step-by-step problem breakdown
Hypothesis formation and testing
Evidence gathering and analysis
Conclusion synthesis
Dynamic Tool Execution
Automatic tool selection
Parameter inference
Error handling and recovery
Tool composition patterns
Information Gathering
Web search and analysis
Document processing
Data extraction and synthesis
Fact verification
Strategic Problem Solving
Goal decomposition
Action planning
Progress monitoring
Adaptive strategy adjustment
Usage ExamplesΒΆ
Agent with web search and analysis tools:
from haive.agents.react import ReactAgent
from langchain_core.tools import tool
@tool
def web_search(query: str) -> str:
"""Search the web for information."""
# Implementation here
return f"Search results for: {query}"
@tool
def calculator(expression: str) -> str:
"""Calculate mathematical expressions."""
return str(eval(expression))
# Research agent with tools
researcher = ReactAgent(
name="research_assistant",
engine=AugLLMConfig(tools=[web_search, calculator]),
max_iterations=5
)
result = await researcher.arun(
"Research the latest AI developments and calculate market growth"
)
Agent for complex data analysis tasks:
@tool
def analyze_data(data_path: str) -> str:
"""Analyze data from CSV file."""
# Implementation here
return "Analysis complete"
@tool
def create_visualization(data: str, chart_type: str) -> str:
"""Create data visualization."""
# Implementation here
return f"Created {chart_type} visualization"
# Data analysis agent
analyst = ReactAgent(
name="data_analyst",
engine=AugLLMConfig(tools=[analyze_data, create_visualization]),
max_iterations=10
)
result = await analyst.arun(
"Analyze sales data and create trend visualizations"
)
Multi-step problem solving with reasoning:
@tool
def get_weather(location: str) -> str:
"""Get current weather for location."""
return f"Weather in {location}: Sunny, 72Β°F"
@tool
def book_flight(origin: str, destination: str, date: str) -> str:
"""Book a flight."""
return f"Flight booked from {origin} to {destination} on {date}"
# Problem solving agent
planner = ReactAgent(
name="travel_planner",
engine=AugLLMConfig(tools=[get_weather, book_flight]),
max_iterations=7
)
result = await planner.arun(
"Plan a trip to Hawaii next week, considering weather"
)
MultiAgentΒΆ
Sophisticated orchestration system for coordinating multiple agents in complex workflows.
Execution ModesΒΆ
Pipeline Workflows
Agent A β Agent B β Agent C
State passing between agents
Error handling and recovery
Progress tracking
Concurrent Processing
Multiple agents run simultaneously
Result aggregation
Load balancing
Timeout management
Decision Trees
Dynamic agent selection
State-based routing
Conditional logic
Fallback strategies
Nested Workflows
Supervisor-worker patterns
Multi-level coordination
Resource allocation
Priority management
Usage ExamplesΒΆ
Content creation pipeline:
from haive.agents.multi import MultiAgent
# Create specialized agents
researcher = ReactAgent(name="researcher", tools=[web_search])
writer = SimpleAgent(name="writer", engine=AugLLMConfig(temperature=0.8))
editor = SimpleAgent(name="editor", engine=AugLLMConfig(temperature=0.3))
# Sequential workflow
content_pipeline = MultiAgent(
name="content_creation",
agents=[researcher, writer, editor],
execution_mode="sequential"
)
result = await content_pipeline.arun(
"Create a blog post about sustainable energy"
)
Data analysis with multiple perspectives:
# Create analysis agents
technical_analyst = ReactAgent(name="tech_analyst", tools=[data_tools])
business_analyst = SimpleAgent(name="biz_analyst")
market_analyst = ReactAgent(name="market_analyst", tools=[market_tools])
# Parallel analysis
analysis_team = MultiAgent(
name="analysis_team",
agents=[technical_analyst, business_analyst, market_analyst],
execution_mode="parallel"
)
result = await analysis_team.arun(
"Analyze Q4 performance from multiple perspectives"
)
Smart routing based on task complexity:
# Route based on task complexity
simple_processor = SimpleAgent(name="simple")
complex_processor = ReactAgent(name="complex", tools=[advanced_tools])
# Conditional workflow
smart_router = MultiAgent(
name="smart_processor",
agents=[simple_processor, complex_processor],
execution_mode="conditional"
)
# Add routing logic
smart_router.add_conditional_edge(
condition=lambda state: state.get("complexity", 0) > 0.7,
true_agent="complex",
false_agent="simple"
)
DynamicSupervisorΒΆ
Meta-agent system that can spawn, coordinate, and optimize agent teams dynamically.
Core CapabilitiesΒΆ
Runtime Agent Generation
Task-based agent creation
Automatic configuration
Capability matching
Resource optimization
Performance Management
Load balancing
Resource allocation
Performance monitoring
Bottleneck identification
System Insights
Real-time metrics
Performance tracking
Resource utilization
Failure analysis
Multi-Level Management
Supervisor hierarchies
Delegation strategies
Escalation handling
Authority management
Usage ExamplesΒΆ
Supervisor that builds teams for complex tasks:
from haive.agents.agent import DynamicSupervisorAgent
# Create adaptive supervisor
supervisor = DynamicSupervisorAgent(
name="project_manager",
engine=AugLLMConfig(),
enable_agent_builder=True
)
# Supervisor analyzes task and creates appropriate team
result = await supervisor.arun(
"Develop a mobile app with user authentication and data visualization"
)
# Creates: BackendAgent, FrontendAgent, SecurityAgent, UIAgent
Supervisor that optimizes team performance:
class OptimizingSupervisor(DynamicSupervisorAgent):
async def optimize_team(self):
# Monitor performance
metrics = await self.get_team_metrics()
# Identify bottlenecks
if metrics.response_time > threshold:
await self.add_parallel_agents()
# Balance workload
if metrics.load_imbalance > 0.3:
await self.redistribute_tasks()
Multi-level supervision with delegation:
# Create hierarchical system
cto = DynamicSupervisorAgent(name="CTO")
# Create department supervisors
backend_lead = DynamicSupervisorAgent(name="backend_lead")
frontend_lead = DynamicSupervisorAgent(name="frontend_lead")
# Delegate to department leads
cto.add_subordinate(backend_lead)
cto.add_subordinate(frontend_lead)
# Complex project delegation
result = await cto.arun("Build enterprise SaaS platform")
Runtime Reconfiguration ExamplesΒΆ
π Dynamic Agent Evolution in Action:
Watch agents transform themselves at runtime:
# π START WITH SIMPLE AGENT
agent = SimpleAgent(name="basic_bot", engine=AugLLMConfig())
# π DYNAMICALLY EVOLVE TO RESEARCH AGENT
await agent.live_reconfigure({
"agent_type": "ReactAgent", # Change agent class
"tools": [web_search, calculator], # Add tools
"max_iterations": 5, # Add reasoning capability
"preserve_conversation_history": True # Keep existing context
})
# π§ ADD MEMORY SYSTEM WITHOUT RESTART
await agent.add_memory_system({
"type": "integrated", # Graph + Vector + Temporal
"neo4j_config": neo4j_config,
"migrate_conversation_to_memory": True
})
# π― SERIALIZE ENTIRE AGENT STATE
agent_snapshot = await agent.serialize_complete_state()
# π SPAWN SPECIALIZED COPIES
analyst = await agent.replicate_as({
"name": "market_analyst",
"tools": [market_data_tool, analysis_tool],
"system_message": "You are a market analysis expert",
"memory_focus": ["ANALYTICAL", "PROFESSIONAL"]
})
β‘ Hot-Swap LLM Providers:
Switch providers based on task complexity:
# π° START WITH COST-EFFECTIVE PROVIDER
agent = ReactAgent(
name="adaptive_agent",
engine=AugLLMConfig(provider="openai", model="gpt-3.5-turbo")
)
# π§ DYNAMICALLY UPGRADE FOR COMPLEX TASK
if task_complexity > 0.8:
await agent.hot_swap_provider({
"provider": "anthropic",
"model": "claude-3-opus",
"preserve_conversation": True,
"migrate_tools": True
})
# π AUTO-OPTIMIZE BASED ON PERFORMANCE
await agent.enable_auto_provider_optimization({
"performance_threshold": 0.85,
"cost_efficiency_weight": 0.3,
"response_quality_weight": 0.7
})
π Live Multi-Agent Network Reconfiguration:
Modify agent networks and coordination patterns:
# ποΈ DYNAMIC TEAM RESTRUCTURING
team = MultiAgent(
name="adaptive_team",
agents=[researcher, analyst, writer],
execution_mode="sequential"
)
# β‘ LIVE WORKFLOW RECONFIGURATION
await team.reconfigure_workflow({
"execution_mode": "parallel", # Change from sequential
"add_agents": [reviewer, validator], # Add new team members
"routing_strategy": "conditional", # Add smart routing
"preserve_agent_states": True # Keep individual progress
})
# π‘ SERIALIZE ENTIRE TEAM CONFIGURATION
team_blueprint = await team.serialize_team_structure()
# π REPLICATE TEAM WITH MODIFICATIONS
specialized_team = await MultiAgent.from_blueprint(
team_blueprint,
modifications={
"domain_focus": "financial_analysis",
"agent_specializations": {
"researcher": "financial_data_specialist",
"analyst": "quantitative_analyst"
}
}
)
Agent Composition PatternsΒΆ
Tool Encapsulation
Convert any agent into a tool for use by other agents, enabling modular composition and reusability.
Expert Systems
Create specialized agents for specific domains, then coordinate them for comprehensive solutions.
Context Preservation
Share state and context between agents for consistent, coherent multi-agent interactions.
Process Automation
Design complex workflows with conditional logic, error handling, and adaptive routing.
Best PracticesΒΆ
Agent Selection GuidelinesΒΆ
Use Case |
Recommended Agent |
Key Features |
Example Scenarios |
---|---|---|---|
Simple Q&A |
SimpleAgent |
Conversation memory, structured output |
Chatbots, customer service, role-playing |
Research & Analysis |
ReactAgent |
Tool integration, reasoning loops |
Data analysis, web research, planning |
Multi-step Workflows |
MultiAgent |
Agent coordination, state management |
Content pipelines, analysis workflows |
Dynamic Teams |
DynamicSupervisor |
Agent creation, team optimization |
Complex projects, adaptive systems |
Conversations |
ConversationAgents |
Turn management, social dynamics |
Debates, brainstorming, collaboration |
Memory & Context |
MemoryAgents |
Graph-based memory, classification |
Learning systems, context-aware AI |
Performance ConsiderationsΒΆ
SimpleAgent: <100ms ReactAgent: <200ms MultiAgent: <300ms DynamicSupervisor: <500ms
Simple queries: <2s Tool execution: <5s Multi-agent: <10s Complex workflows: <30s
Concurrent agents: 50+ Conversations: 10+ Supervisors: 5 levels Memory agents: 1000+ memories
Next StepsΒΆ
quickstart - Get started with your first agent
Memory Systems - Add intelligent memory to your agents
conversation_orchestration - Create multi-agent conversations
advanced - Explore self-modification and replication
examples - See complete working examples