Overview
Agents are the core intelligent entities in OrbitAI that execute tasks autonomously. Each agent is designed with a specific role, purpose, and context, equipped with tools and capabilities to accomplish their assigned work.Autonomous
Specialized
Tool-Enabled
Context-Aware
Collaborative
Monitored
Key Characteristics
Role-Based Design
Role-Based Design
Purpose-Driven
Purpose-Driven
Contextual Understanding
Contextual Understanding
LLM Integration
LLM Integration
Agent Architecture
Core Components
- Agent Structure
- Agent Executor
- Agent Factory
Agent actor is the fundamental unit that encapsulates:- Identity and configuration
- LLM integration
- Tool access
- Memory management
- Execution state
Agent Parameters
Core Properties
- Required
- LLM Configuration
- Capabilities
- Memory & Knowledge
- Execution & Output
State Properties
Critical Parameters
Role, Purpose, and Context
The most critical parameters that define agent behavior:Role: Define the Agent's Identity
Purpose: State the Primary Objective
Context: Provide Background and Expertise
Temperature Configuration
Temperature controls randomness and creativity:- Low (0.0-0.3)
- Medium (0.4-0.7)
- High (0.8-1.0)
- Data analysis
- Code generation
- Factual reporting
- Structured outputs
- Mathematical tasks
Memory and Context
Memory Systems
OrbitAI provides multiple memory systems for context retention:Short-Term Memory
memory: trueRetains information within a single conversation or task sequence.- Multi-turn conversations
- Sequential task workflows
- Context building within sessions
Long-Term Memory
longTermMemory: truePersists information across sessions and executions.- User preference tracking
- Historical data retention
- Cross-session learning
Entity Memory
entityMemory: trueTracks and remembers named entities (people, places, organizations).- Customer relationship management
- Knowledge graph building
- Entity relationship tracking
Knowledge Sources
knowledgeSources: [paths]Load external knowledge from files.- PDF documents
- Markdown files
- JSON data
- Plain text
Memory Configuration
Fine-tune memory behavior withMemoryConfiguration:
Context Window Management
Manage token limits and context overflow:Context Pruning
Context Pruning
respectContextWindow: true, the system automatically:- Monitors token usage
- Prunes old messages when approaching limits
- Retains system messages and recent context
- Maintains conversation coherence
Memory vs Context Window
Memory vs Context Window
- Store information externally
- Retrieve relevant data as needed
- Not limited by context window
- Slower access (retrieval step)
- All data in active conversation
- Immediate access
- Limited by token count
- Faster processing
Execution Control
Iteration and Reasoning
Control how agents reason through complex problems:maxIter parameter limits the number of reasoning cycles, preventing infinite loops while allowing thorough analysis.Rate Limiting
Prevent API throttling and control costs:Delegation
Enable agents to delegate to other agents:Callbacks and Monitoring
Track agent execution with callbacks:Agent Tools
Tool Integration
Agents gain capabilities through tools:Built-in Tools
Web Search
Calculator
File Operations
Data Analysis
Code Execution
API Integration
Custom Tools
Create domain-specific tools:- Define Tool
- Register Tool
- Tool Best Practices
Tool Selection
Agents automatically select appropriate tools based on:- Task requirements: Tools mentioned in task description
- Agent configuration: Available tools in agent’s tool list
- LLM reasoning: Model determines when tools are needed
- Context: Previous tool usage and results
Structured Outputs
Type-Safe Output Generation
Use Swift’s Codable for structured responses:JSON Schema Validation
Define schemas for output validation:Best Practices
Agent Design
Single Responsibility
Domain Expertise
Appropriate Tools
Temperature Tuning
Performance Optimization
Memory Management
Memory Management
- Reduced resource usage
- Faster execution
- Lower storage costs
Tool Selection
Tool Selection
- Giving every agent all available tools
- Including tools the agent won’t use
- Complex tools for simple tasks
Context Window
Context Window
- Enable
respectContextWindowfor auto-pruning - Set appropriate
maxTokenslimits - Use knowledge sources for large documents
- Implement chunking for very long content
Rate Limiting
Rate Limiting
- Avoid API rate limit errors
- Control costs
- Predictable performance
Security and Safety
Input Validation
Access Control
Output Filtering
Audit Logging
Troubleshooting
Agent Not Producing Expected Results
Agent Not Producing Expected Results
- Vague or unclear role/purpose/context
- Inappropriate temperature setting
- Missing necessary tools
- Insufficient context information
Agent Timeouts
Agent Timeouts
- Insufficient
maxExecutionTime - Complex reasoning requiring many iterations
- Slow tool execution
- LLM provider latency
Tool Execution Failures
Tool Execution Failures
- Tool not registered with ToolsHandler
- Invalid tool parameters
- Tool permissions issues
- Tool dependencies missing
Memory Issues
Memory Issues
- Memory enabled but not needed
- Too many memory items stored
- Large knowledge sources
- Memory not being pruned
Inconsistent Outputs
Inconsistent Outputs
- High temperature setting
- Non-deterministic tool behavior
- Memory state differences
- Random sampling in LLM
Rate Limit Errors
Rate Limit Errors
- No
maxRPMconfigured - Too many concurrent agents
- Rapid successive requests
- Insufficient retry backoff
Debugging Strategies
Enable Verbose Logging
Monitor Metrics
Test with Simple Tasks
Isolate Components