Introduction
Freyavoice AI is built on several core concepts that work together to create powerful voice AI applications. Understanding these concepts is essential for building effective solutions.Agents
Agents are the heart of Freyavoice AI. They are intelligent voice assistants powered by advanced AI models that can understand natural language, maintain context, and execute actions.What Makes an Agent
An agent consists of several key components: System Prompt: The agent’s instructions and personality. This defines how the agent behaves, what it can do, and how it should respond to different situations. A well-crafted system prompt is crucial for agent performance. Model Configuration: The AI model that powers the agent (GPT-4, Claude, etc.). Different models have different strengths - some are better at reasoning, others at speed or cost efficiency. Voice Settings: How the agent sounds. This includes the voice provider, specific voice selection, speaking speed, and voice stability. The right voice can significantly impact user experience. Functions: Actions the agent can take. Functions allow agents to interact with external systems, query databases, make API calls, and perform other operations beyond just conversation. Context Management: How the agent maintains conversation history and context. This includes conversation length limits, context window management, and memory strategies.Agent Lifecycle
When a call comes in, the agent goes through several stages:- Initialization: The agent loads its configuration, system prompt, and any required functions
- Context Loading: Previous conversation history is loaded if available
- Listening: The agent receives and processes audio input
- Understanding: Speech is converted to text and analyzed
- Reasoning: The AI model processes the input and generates a response
- Action Execution: Any required functions are called
- Response Generation: The response is converted to speech and delivered
- Context Update: The conversation is saved for future reference
Workflows
Workflows are visual, node-based systems that allow you to create complex call routing and processing logic. They enable you to build sophisticated applications that go beyond what a single agent can do.Workflow Components
Nodes: The building blocks of workflows. Each node represents a specific action or decision point:- Agent Nodes: Connect to AI agents to handle conversations
- Function Nodes: Execute custom functions or API calls
- Condition Nodes: Route calls based on conditions (time of day, caller ID, etc.)
- Transfer Nodes: Transfer to human agents or other systems
- Wait Nodes: Pause execution for a specified duration
- Loop Nodes: Repeat actions based on conditions
Workflow Execution
When a workflow is triggered:- Entry Point: Execution starts at the initial node
- Node Processing: Each node executes its logic
- Data Flow: Variables are passed between nodes
- Conditional Routing: Conditions determine which path to take
- Parallel Execution: Some nodes can execute simultaneously
- Completion: The workflow completes when reaching an end node or transfer
When to Use Workflows vs Agents
Use a single agent when:- Your use case is straightforward
- You need a simple conversation flow
- You want to get started quickly
- The agent can handle everything independently
- You need complex routing logic
- Multiple agents need to work together
- You require conditional branching
- You need to integrate with multiple systems
- You want to add human-in-the-loop capabilities
Telephony Layer
The telephony layer connects your agents and workflows to the real world through phone numbers and call handling infrastructure.Phone Numbers
Phone numbers are your connection point to the telephony network. They can be:- Imported: Brought in from providers like Twilio
- Purchased: Acquired through Freya’s marketplace (if available)
- Configured: Set up with specific capabilities (voice, SMS, etc.)
Call Routing
When a call comes in, Freya routes it through several stages:- Inbound Reception: The call is received at the phone number
- Number Resolution: Freya identifies which agent or workflow to use
- Session Creation: A call session is created with unique identifiers
- Agent/Workflow Invocation: The configured agent or workflow is activated
- Call Processing: The agent/workflow handles the conversation
- Call Completion: The call ends and data is saved
Outbound Calling
For outbound calls, the process is similar but initiated by your application:- Call Request: Your application requests an outbound call
- Number Selection: Freya selects the appropriate phone number
- Call Initiation: The call is placed to the destination
- Connection: Once connected, the agent/workflow takes over
- Processing: Same as inbound calls from this point
Integration Points
Freyavoice AI integrates with various external systems: Telephony Providers: Twilio, and other SIP providers for call handling AI Models: OpenAI, Anthropic, and other LLM providers for agent intelligence External APIs: Webhooks and function calls to integrate with your systems Storage: Conversation history, call recordings, and analytics dataData Flow
Understanding how data flows through Freyavoice AI helps you build better applications:- Audio Input: Phone call audio is received
- Speech-to-Text: Audio is converted to text
- Agent Processing: The agent analyzes the text and generates a response
- Function Execution: Any required functions are called
- Text-to-Speech: The response is converted back to audio
- Audio Output: The audio is sent back to the caller
- Data Storage: All interactions are logged for analytics and improvement
Next Steps
Architecture Deep Dive
Learn how these core concepts come together in Freyavoice AI’s architecture.
