Skip to main content

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

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.
Agents are created with specific purposes that guide their actions and define their primary objectives within the system.
Agents maintain context through detailed background information, memory systems, and knowledge bases, enabling sophisticated reasoning.
Agents leverage Large Language Models for natural language understanding, reasoning, and content generation.

Agent Architecture

Core Components

The Agent actor is the fundamental unit that encapsulates:
  • Identity and configuration
  • LLM integration
  • Tool access
  • Memory management
  • Execution state

Agent Parameters

Core Properties

The role, purpose, and context form the agent’s “system message” that shapes all LLM interactions.

State Properties

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:
Use professional titles that reflect real-world expertise levels and specializations.
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:
Avoid generic context. Provide specific expertise, methodologies, and guidelines that shape agent behavior.

Temperature Configuration

Temperature controls randomness and creativity:
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: memory: trueRetains information within a single conversation or task sequence.
Use cases:
  • Multi-turn conversations
  • Sequential task workflows
  • Context building within sessions

Long-Term Memory

Enabled with: longTermMemory: truePersists information across sessions and executions.
Use cases:
  • User preference tracking
  • Historical data retention
  • Cross-session learning

Entity Memory

Enabled with: entityMemory: trueTracks and remembers named entities (people, places, organizations).
Use cases:
  • Customer relationship management
  • Knowledge graph building
  • Entity relationship tracking

Knowledge Sources

Configured with: knowledgeSources: [paths]Load external knowledge from files.
Supported formats:
  • PDF documents
  • Markdown files
  • JSON data
  • Plain text

Memory Configuration

Fine-tune memory behavior with MemoryConfiguration:

Context Window Management

Manage token limits and context overflow:
When respectContextWindow: true, the system automatically:
  1. Monitors token usage
  2. Prunes old messages when approaching limits
  3. Retains system messages and recent context
  4. Maintains conversation coherence
Memory Systems:
  • Store information externally
  • Retrieve relevant data as needed
  • Not limited by context window
  • Slower access (retrieval step)
Context Window:
  • All data in active conversation
  • Immediate access
  • Limited by token count
  • Faster processing
Use memory for large knowledge bases and long-term retention. Keep recent, relevant information in the context window.

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:

Tool Selection

Agents automatically select appropriate tools based on:
  1. Task requirements: Tools mentioned in task description
  2. Agent configuration: Available tools in agent’s tool list
  3. LLM reasoning: Model determines when tools are needed
  4. 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:
Use structured outputs for:
  • API integrations
  • Database storage
  • UI rendering
  • Data pipelines
  • System integrations

Best Practices

Agent Design

Single Responsibility

Design agents with one clear purposeGood:
Bad:

Domain Expertise

Provide specific, relevant expertiseGood:
Bad:

Appropriate Tools

Only include necessary toolsGood:
Bad:

Temperature Tuning

Match temperature to task typeGood:
Bad:

Performance Optimization

Enable memory only when needed:
Benefits:
  • Reduced resource usage
  • Faster execution
  • Lower storage costs
Optimize tool assignment:
Avoid:
  • Giving every agent all available tools
  • Including tools the agent won’t use
  • Complex tools for simple tasks
Manage context efficiently:
Strategies:
  • Enable respectContextWindow for auto-pruning
  • Set appropriate maxTokens limits
  • Use knowledge sources for large documents
  • Implement chunking for very long content
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

Symptoms: Agent outputs are off-target or low qualityCommon Causes:
  1. Vague or unclear role/purpose/context
  2. Inappropriate temperature setting
  3. Missing necessary tools
  4. Insufficient context information
Solutions:
Symptoms: Tasks fail with timeout errorsCommon Causes:
  1. Insufficient maxExecutionTime
  2. Complex reasoning requiring many iterations
  3. Slow tool execution
  4. LLM provider latency
Solutions:
Monitor averageExecutionTime to set appropriate timeouts.
Symptoms: Agent reports tool execution errorsCommon Causes:
  1. Tool not registered with ToolsHandler
  2. Invalid tool parameters
  3. Tool permissions issues
  4. Tool dependencies missing
Solutions:
Symptoms: High memory usage or memory-related errorsCommon Causes:
  1. Memory enabled but not needed
  2. Too many memory items stored
  3. Large knowledge sources
  4. Memory not being pruned
Solutions:
Symptoms: Agent produces different outputs for same inputsCommon Causes:
  1. High temperature setting
  2. Non-deterministic tool behavior
  3. Memory state differences
  4. Random sampling in LLM
Solutions:
Symptoms: API rate limit exceeded errorsCommon Causes:
  1. No maxRPM configured
  2. Too many concurrent agents
  3. Rapid successive requests
  4. Insufficient retry backoff
Solutions:

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.