Framework Architecture
Last updated
Last updated
Agented framework is a lightweight, modular library for building AI agents with full control over data flows and integrations.
Agents are structured as a hierarchical decision-making system, organized in a tree-like structure, ensuring modularity and clear separation of responsibilities between components. Agents operate within a parent-child framework, where lower-level agents report to their superiors. They can delegate tasks to child agents or invoke functions and inherit access to tools and functions from their parent chain.
The Agent can be configured using:
Agent Config: Settings that define the properties of the agent (name, description, type, etc.).
Prompts: Textual instructions that control the agent's behavior and provide context for its actions.
API Keys: Authentication credentials for accessing external services via APIs.
The Agent Core is the central processing unit of an agent, responsible for its core logic and functionality. The agent core can be configured using:
Agent Input Preparation: Component responsible for processing and formatting input data for the agent.
Steps Manager: Coordinates the sequence of task execution by the agent, defining the order of actions.
Decider: Component that makes decisions about request routing and further actions based on the agent's logic.
The Reflection System empowers AI agents with automated self-monitoring capabilities, enabling them to assess and adapt their performance proactively. Key Components:
Reflection Prompt:
Defines the specific instructions and criteria that guide the agent's self-assessment process.
Determines the behavior and focus of the agent during reflection.
Reflection Schedule:
Configures the frequency and timing of reflection activities using cron schedules.
Ensures periodic self-analysis, enabling agents to stay up-to-date and responsive.
Automated Reflection Process:
Reflections are triggered automatically based on the defined schedule.
The system generates input signals based on the agent's current state and available methods.
This allows agents to:
Perform routine checks and diagnostics.
Update internal states and knowledge.
Execute maintenance tasks.
Adapt to changing environment's.
The automated nature of reflections minimizes the need for manual intervention, promoting continuous improvement and adaptability.
Function Management is responsible for overseeing and providing the executable capabilities that AI agents use to perform diverse tasks. Key Components:
Functions:
Represent the core executable capabilities available to agents. Each function is designed to perform a particular task. Encompass a range of operations, from simple computations to complex interactions.
Asynchronous Retrieval Augmented Generation (async RAG):
Enables agents to asynchronously retrieve and utilize relevant information from external sources.
Augments the agent's knowledge and decision-making capabilities with up-to-date data.
Custom Functions:
User-defined functions tailored to specific agent requirements. Allow agents to perform a wide variety of operations, including:
Database Queries: Interact with databases to retrieve, update, or delete data.
API Calls: Communicate with external APIs to fetch or send information.
File Operations: Read, write, and manipulate files within the system.
Asynchronous Operations: Execute tasks concurrently to enhance performance and responsiveness.
Children Agents facilitate a hierarchical structure within the system, enabling the delegation of specialized tasks and promoting efficient, scalable operations. Key Features:
Hierarchical Organization:
Agents are structured in a parent-child relationship, forming a hierarchical tree. This allows for the creation of complex agent networks.
Lower-level agents report their status and results upward to their parent agents. This framework ensures organized and scalable agent interactions.
Subordinate Agents (Children Agents):
Children agents are subordinate agents within the hierarchy. They are assigned specific, specialized tasks by their parent agents.
Children agents maintain separation of concerns. This reduces complexity and potential conflicts between operational areas.
Sub-agents can be easily added or removed to adjust to changing workloads or requirements.
Sub-agents focus on specific domains or functions. This enhances efficiency and expertise.
Operational Context is a storage used to maintain the current state and context of agents. This includes:
Recent interactions, data processed, and decisions made.
Stored knowledge, learned patterns, and accumulated experience.
The Operational context allows the AI agent to keep track of what it has already done, and to take the next steps based on that.
Provides communication and integration between various system components.
Event Bus, I/O: Communication infrastructure for handling events and I/O operations, allowing components to interact asynchronously and efficiently.
The library supports Asynchronous Requests, enabling agents to handle multiple operations simultaneously without waiting for each task to complete before starting the next. This capability is crucial for:
Performance Optimization: Enhance the responsiveness and throughput of agents by utilizing non-blocking operations.
Concurrency Management: Efficiently manage multiple tasks, especially when dealing with I/O-bound or long-running operations.
Error Handling: Implement robust error handling mechanisms to gracefully manage failures in asynchronous tasks without disrupting the entire agent workflow.
Agents can emit and listen to events, facilitating seamless communication within the agent hierarchy. This feature allows agents to:
React to Changes: Automatically respond to specific events or triggers, ensuring dynamic and adaptive behavior.
Coordinate Tasks: Synchronize actions between parent and child agents, promoting cohesive and organized operations.
Handle Errors: Propagate error states upwards, enabling parent agents to manage and mitigate issues effectively.
Agents are equipped with mechanisms for resource management and cleanup, ensuring the efficient use of system resources and preventing memory leaks or dangling processes. Key aspects include:
Timeouts and Intervals: Automatically manage timing-based operations to prevent tasks from running indefinitely.
Cleanup Procedures: Clear timeouts, intervals, and event listeners upon agent termination or error states, maintaining system integrity.
Retry Logic: Implement retry mechanisms for failed tasks, enhancing reliability and resilience in operations.
The library is designed for extensibility and customization, allowing developers to tailor agents to specific needs. Features include:
Custom Prompts: Define unique prompts and instructions for each agent to guide their behavior and responses.
Function Injection: Assign custom functions to agents, extending their capabilities and enabling specialized tasks.
Mixin Integration: Incorporate mixins to add additional context or functionality, promoting code reuse and modularity.
Agents can integrate with marketplace services, leveraging external functionalities and services to enhance their operations. This includes:
Marketplace Functions: Utilize predefined or custom marketplace functions to perform specialized tasks.
Sandbox Environment: Execute marketplace functions within a secure sandbox to ensure safe and controlled operations.
Dynamic Function Loading: Dynamically load and update functions from the marketplace, ensuring agents can adapt to new requirements without redeployment.
This architecture demonstrates a modular, hierarchical agent system with secure function execution, event-driven communication, and marketplace integration. The design allows for complex agent networks with parent-child relationships, scheduled reflections, and extensible function capabilities.