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
Self-directed execution with intelligent decision-making
Specialized
Configured with specific roles and domain expertise
Tool-Enabled
Access to tools for extended capabilities
Context-Aware
Maintains memory and understands task context
Collaborative
Works with other agents in orchestrated workflows
Monitored
Comprehensive metrics and performance tracking
Key Characteristics
Role-Based Design
Role-Based Design
Each agent has a defined role that shapes its behavior and decision-making process. Roles provide context for how the agent should approach tasks and interact with other agents.
Purpose-Driven
Purpose-Driven
Agents are created with specific purposes that guide their actions and define their primary objectives within the system.
Contextual Understanding
Contextual Understanding
Agents maintain context through detailed background information, memory systems, and knowledge bases, enabling sophisticated reasoning.
LLM Integration
LLM Integration
Agents leverage Large Language Models for natural language understanding, reasoning, and content generation.
Agent Architecture
Core Components
- Agent Structure
- Agent Executor
- Agent Factory
The
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
| Property | Type | Description |
|---|---|---|
id | OrbitAIID | Unique identifier (UUID) for the agent |
role | String | The agent’s role or title (e.g., “Senior Data Analyst”) |
purpose | String | Primary objective and responsibility |
context | String | Background information and expertise details |
The role, purpose, and context form the agent’s “system message” that shapes all LLM interactions.
State Properties
| Property | Type | Description |
|---|---|---|
currentTask | ORTask? | Currently executing task |
taskHistory | [ORTask] | Completed task history |
totalUsageMetrics | UsageMetrics | Cumulative usage statistics |
executionCount | Int | Number of tasks executed |
averageExecutionTime | TimeInterval | Average task completion time |
State properties are automatically managed during agent execution and provide insights into agent performance.
Critical Parameters
Role, Purpose, and Context
The most critical parameters that define agent behavior:1
Role: Define the Agent's Identity
The role establishes who the agent is. Be specific and professional:
2
Purpose: State the Primary Objective
The purpose clarifies what the agent should accomplish:
3
Context: Provide Background and Expertise
The context gives the agent detailed background knowledge:
Temperature Configuration
Temperature controls randomness and creativity:- Low (0.0-0.3)
- Medium (0.4-0.7)
- High (0.8-1.0)
Use for:
- 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
Enabled with: Use cases:
memory: trueRetains information within a single conversation or task sequence.- Multi-turn conversations
- Sequential task workflows
- Context building within sessions
Long-Term Memory
Enabled with: Use cases:
longTermMemory: truePersists information across sessions and executions.- User preference tracking
- Historical data retention
- Cross-session learning
Entity Memory
Enabled with: Use cases:
entityMemory: trueTracks and remembers named entities (people, places, organizations).- Customer relationship management
- Knowledge graph building
- Entity relationship tracking
Knowledge Sources
Configured with: Supported formats:
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
When
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
Memory Systems:
- 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:The
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
Search the internet for current information
Calculator
Perform mathematical calculations
File Operations
Read, write, and manipulate files
Data Analysis
Analyze and process datasets
Code Execution
Execute code safely
API Integration
Call external APIs
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
Design agents with one clear purpose✅ Good:❌ Bad:
Domain Expertise
Provide specific, relevant expertise✅ Good:❌ Bad:
Appropriate Tools
Only include necessary tools✅ Good:❌ Bad:
Temperature Tuning
Match temperature to task type✅ Good:❌ Bad:
Performance Optimization
Memory Management
Memory Management
Enable memory only when needed:Benefits:
- Reduced resource usage
- Faster execution
- Lower storage costs
Tool Selection
Tool Selection
Optimize tool assignment:Avoid:
- Giving every agent all available tools
- Including tools the agent won’t use
- Complex tools for simple tasks
Context Window
Context Window
Manage context efficiently:Strategies:
- Enable
respectContextWindowfor auto-pruning - Set appropriate
maxTokenslimits - Use knowledge sources for large documents
- Implement chunking for very long content
Rate Limiting
Rate Limiting
Prevent throttling:Benefits:
- Avoid API rate limit errors
- Control costs
- Predictable performance
Security and Safety
1
Input Validation
Validate all inputs and parameters:
2
Access Control
Limit agent access to sensitive operations:
3
Output Filtering
Filter potentially harmful outputs:
4
Audit Logging
Track agent actions for security:
Troubleshooting
Agent Not Producing Expected Results
Agent Not Producing Expected Results
Symptoms: Agent outputs are off-target or low qualityCommon Causes:
- Vague or unclear role/purpose/context
- Inappropriate temperature setting
- Missing necessary tools
- Insufficient context information
Agent Timeouts
Agent Timeouts
Symptoms: Tasks fail with timeout errorsCommon Causes:
- Insufficient
maxExecutionTime - Complex reasoning requiring many iterations
- Slow tool execution
- LLM provider latency
Tool Execution Failures
Tool Execution Failures
Symptoms: Agent reports tool execution errorsCommon Causes:
- Tool not registered with ToolsHandler
- Invalid tool parameters
- Tool permissions issues
- Tool dependencies missing
Memory Issues
Memory Issues
Symptoms: High memory usage or memory-related errorsCommon Causes:
- Memory enabled but not needed
- Too many memory items stored
- Large knowledge sources
- Memory not being pruned
Inconsistent Outputs
Inconsistent Outputs
Symptoms: Agent produces different outputs for same inputsCommon Causes:
- High temperature setting
- Non-deterministic tool behavior
- Memory state differences
- Random sampling in LLM
Rate Limit Errors
Rate Limit Errors
Symptoms: API rate limit exceeded errorsCommon Causes:
- No
maxRPMconfigured - Too many concurrent agents
- Rapid successive requests
- Insufficient retry backoff
Debugging Strategies
1
Enable Verbose Logging
2
Monitor Metrics
3
Test with Simple Tasks
4
Isolate Components
Next Steps
Tasks
Learn how agents execute tasks
Tools
Extend agent capabilities with tools
Orbits
Orchestrate agents in workflows
Memory
Implement memory systems
For additional support, consult the GitHub Discussions or check the Issue Tracker.