Skip to content

Migrate Evolving Agents Toolkit to Latest BeeAI Framework #137

Description

@matiasmolinas

The Evolving Agents Toolkit (EAT) currently utilizes beeai-framework==0.1.4. This version is significantly outdated compared to the latest releases of the BeeAI framework (e.g., v0.1.23 or newer). This migration aims to update EAT to the latest stable version of beeai-framework to leverage new features, bug fixes, performance improvements, and ensure better long-term maintainability and compatibility.

This is a significant undertaking due to the potential for breaking API changes in BeeAI and EAT's deeply integrated custom architecture (MongoDB backend, SmartLibrary, SmartAgentBus, SmartMemory, etc.).

2. Motivation & Benefits

Migrating to the latest BeeAI framework will provide EAT with:

  • Access to Latest LLM Integrations & Features: Broader LLM provider support (via LiteLLM), advanced LLM capabilities (e.g., new modalities, tool_choice).
  • Improved Core Agent Capabilities: Enhancements to BeeAI's ReActAgent (used by EAT's SystemAgent, ArchitectZero, etc.) and access to new agent types (e.g., ToolCallingAgent).
  • Bug Fixes, Security, and Performance Improvements: Benefit from numerous fixes and optimizations in BeeAI.
  • Enhanced BeeAI Tooling: Access to new built-in tools (SandboxTool, CodeInterpreterTool) and improvements to existing ones.
  • Modernized Framework Internals: Stricter type safety, improved event system (Emitter, Run.on()), and potentially better agent/tool templating mechanisms.
  • Potential for EAT Code Simplification: Evaluate if newer BeeAI features (e.g., caching) can replace or simplify parts of EAT's custom code, particularly the LLMCache.
  • Stay Aligned with Dependency Evolution: Reduce technical debt and make it easier to get community support.
  • Enhanced Interoperability: Potential to leverage newer BeeAI communication protocols (e.g., ACP).

3. Proposed Plan & Tasks

This migration will be approached in phases:

Phase 1: Preparation & Investigation (Target BeeAI Version: TBD - e.g., 0.1.23+)

  • Determine Target BeeAI Version: Identify the latest stable and suitable version of beeai-framework.
  • Detailed Changelog Review: Analyze BeeAI changelogs from v0.1.4 to the target version to identify all breaking changes, new features, and deprecations.
  • Setup Migration Branch: Create a dedicated Git branch for this migration (e.g., feat/beeai-latest-migration).
  • Update requirements.txt: Update beeai-framework to the target version. Resolve any immediate dependency conflicts. Test basic installation and import.
  • Initial Impact Assessment: Identify immediate breaking changes by attempting to run a minimal EAT setup (e.g., instantiating LLMService or a basic ReActAgent). Document major API signature changes, import path errors, etc.

Phase 2: Core Component Migration

  • LLMService (evolving_agents.core.llm_service):
    • Adapt to new ChatModel, EmbeddingModel interfaces in BeeAI (likely via LiteLLMChatModel and potentially new embedding abstractions in BeeAI).
    • Update provider-specific model instantiations (OpenAI, Ollama).
    • Critical Decision: Evaluate BeeAI's internal caching (if any for ChatModel/Tool in the target version) against EAT's custom MongoDB LLMCache.
      • If BeeAI's cache is suitable and MongoDB-compatible (or pluggable): Consider adopting it and potentially deprecating parts of EAT's LLMCache.
      • If not: Ensure EAT's LLMCache continues to function correctly and, if necessary, disable/override BeeAI's internal caching to prevent conflicts.
    • Refactor generate(), embed(), embed_batch(), generate_applicability_text() methods.
  • BeeAI Provider (evolving_agents.providers.beeai_provider):
    • Update agent creation logic (create_agent_instance) to align with new BeeAI AgentFactory or agent instantiation patterns.
    • Update agent execution logic (execute_agent_instance) to use new BeeAI agent run methods or invocation patterns.
    • Adapt tool handling/registration if BeeAI's tool management has changed.
  • EAT Agents (ReActAgent-based):
    • For SystemAgent, ArchitectZero, MemoryManagerAgent, IntentReviewAgent:
      • Update instantiation based on changes to beeai_framework.agents.react.ReActAgent.
      • Review and update prompt engineering if ReActAgent's internal prompting has changed.
      • Verify tool definition, registration, and execution flow within these agents.
      • Adapt to any changes in how AgentMeta, Memory (e.g., TokenMemory), or RunContext are handled.
  • EAT Tools (BeeAI-based):
    • Ensure all EAT tools inheriting from/using beeai_framework.tools.tool.Tool are compatible with the latest interface.
    • Update evolving_agents.tools.tool_factory.DynamicTool and ToolFactory if base BeeAI tool structures have changed.
  • EAT Adapters (OpenAI specific):
    • Review OpenAIToolAdapter, OpenAIGuardrailsAdapter, OpenAITracingAdapter.
    • Determine if newer BeeAI versions offer better native OpenAI Agents SDK integration that could simplify or replace these adapters.

Phase 3: Integration & System-Level Adjustments

  • Dependency Container: Ensure all new/updated services (LLMService, potentially new BeeAI components) are correctly registered and resolved by DependencyContainer.
  • EAT Agent/Tool Factories: Refactor evolving_agents.agents.agent_factory.AgentFactory and evolving_agents.tools.tool_factory.ToolFactory based on changes in BeeAIProvider and tool/agent interfaces.
  • EAT Templates: Update evolving_agents/templates/beeai_agent_template.txt and evolving_agents/templates/beeai_tool_template.txt to generate code compatible with the new BeeAI version.
  • Configuration: Review and update evolving_agents.config.py and .env.example for any new or changed configuration variables required by the new BeeAI framework or EAT's adaptations.
  • Import Paths: Systematically check and update all import statements from beeai_framework throughout the EAT codebase (ref: BeeAI v0.1.12 breaking changes).

Phase 4: Testing

  • Unit Tests: Write/update unit tests for all significantly refactored components (LLMService, providers, core agents).
  • Integration Tests:
    • Test SmartLibrary component creation and retrieval (especially for BeeAI-based components).
    • Test SmartAgentBus registration and capability requests involving BeeAI agents.
    • Test SystemAgent's core orchestration loop with migrated components.
    • Test SmartMemory interactions (ContextBuilderTool, ExperienceRecorderTool via MemoryManagerAgent).
    • Test IntentReview system for BeeAI-related plans.
  • End-to-End Testing (Examples):
    • Systematically test all examples in the examples/ directory.
    • Pay special attention to examples/invoice_processing/architect_zero_comprehensive_demo.py as a full system test.
    • Verify Smart Memory examples like examples/smart_memory_enhancement_real_evolution_demo.py (and scripts/test_smart_memory.py).
  • Performance Testing: Basic performance comparison before/after to identify any significant regressions.

Phase 5: Documentation & Finalization

  • Update EAT Documentation:
    • README.md: Update BeeAI version, any relevant architectural diagrams or descriptions.
    • docs/ARCHITECTURE.md: Reflect any changes due to BeeAI updates.
    • docs/MONGO-SETUP.md, docs/TUTORIAL.md: Ensure they remain accurate.
  • Update Code Comments: Add/update comments explaining new integrations or changes.
  • Code Review: Thorough code review of all changes.
  • Merge: Merge the migration branch into the main development branch.

4. Acceptance Criteria

  • EAT successfully builds and runs using the target version of beeai-framework.
  • All core EAT functionalities are verified and working as expected:
    • SystemAgent orchestration.
    • SmartLibrary operations (create, search, evolve BeeAI components).
    • SmartAgentBus operations (register, discover, request for BeeAI agents).
    • SmartMemory operations.
    • IntentReview system.
    • LLMCache (EAT's or BeeAI's, as decided).
  • All Python examples in the examples/ directory execute successfully and produce expected outcomes.
  • The existing EAT test suite (once fully migrated to MongoDB) passes.
  • EAT documentation (README.md, ARCHITECTURE.md, etc.) is updated to reflect the changes.
  • No major performance regressions are observed in key EAT operations.
  • Code is well-documented and follows EAT's coding standards.

5. Potential Risks & Challenges

  • Extensive Refactoring: Significant code changes will be required across multiple EAT modules.
  • Unforeseen Breaking Changes: BeeAI changelogs might not capture all subtle breaking changes or behavioral differences.
  • Caching Strategy: Deciding on and implementing the correct caching strategy (EAT's custom vs. BeeAI's internal) will be complex.
  • Compatibility with EAT's Custom Systems: Ensuring EAT's MongoDB-centric architecture (SmartLibrary, SmartAgentBus, SmartMemory) integrates smoothly with the new BeeAI version.
  • Testing Complexity: Thoroughly testing all aspects of the complex EAT system will be time-consuming.
  • Resource Allocation: This migration will require significant, dedicated developer time.

6. Relevant Context & Links


This issue will serve as the main tracker for the migration effort. Sub-tasks can be created for specific components or phases as needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions