← Back to Docs20250627

008 20250623 13 mabeam deprecate

Documentation for 008_20250623_13_mabeam_deprecate from the Foundation repository.

Yes, absolutely. This is the central architectural question that needs to be resolved for a cohesive and maintainable system. Your refactoring of jido into smaller, focused libraries like jido_action and jido_signal makes this analysis much clearer.

The short answer is: Yes, the jido* family of libraries, when properly integrated, will replace the entire foundation.mabeam namespace and refine how the core foundation services are used.

This isn’t about discarding work; it’s about re-homing functionality to its correct architectural layer. foundation.mabeam was an early, correct attempt to build agent-specific logic, but it belongs in a dedicated agent framework (jido), not within the generic infrastructure layer (foundation).

Here is a detailed breakdown of the functional replacement and a clear plan for the final, unified architecture.


Part 1: Functional Overlap & Replacement Analysis

This table directly compares the functionality of the jido* libraries against foundation and foundation.mabeam.

FunctionalityImplemented in foundation / foundation.mabeamReplaced/Superseded by jido* LibrariesArchitectural Role in Target State
Agent Lifecycle & Supervisionfoundation.mabeam.ProcessRegistryA future jido_agent libraryThe jido_agent library will provide the agent runtime, using Foundation.ProcessRegistry for the underlying process management.
Action/Command ExecutionNonejido_action (Jido.Exec)jido_action is the canonical implementation. It provides the universal “Command Pattern” for the entire stack.
High-Level Coordination (Economic Protocols)foundation.mabeam.Coordination.{Auction, Market}jido coordination modules (to be created/moved)foundation.mabeam version is deprecated. This logic belongs in a higher-level agent framework, not the infrastructure layer. It will be implemented in a full jido library.
Low-Level Coordination (BEAM Primitives)foundation.coordination.primitives.{consensus, elect_leader}Not replaced.This correctly stays in foundation. It provides generic, distributed system primitives that are not agent-specific.
Inter-Process Communicationfoundation.mabeam.Commsjido_signal (Jido.Dispatch, Jido.Bus)foundation.mabeam.Comms is deprecated. jido_signal provides a more robust, abstract, and feature-rich messaging layer with its adapter-based Dispatch system.
Event/Message Definitionfoundation.types.Eventjido_signal (Jido.Signal)Jido.Signal becomes the standard application-level message format. Foundation.Event can be used for low-level system audit logs (e.g., “service started”).
Error Handlingfoundation.types.Error, jido_action.errorStandardize on Foundation.Types.ErrorAll jido* libraries must be refactored to use Foundation.Types.Error as the single, canonical error structure.
Resilience Patterns (Circuit Breaker, etc.)foundation.infrastructure.*Not replaced.foundation.infrastructure provides the core resilience primitives that jido_action and jido_signal adapters should use.

Conclusion of Analysis: The jido* family introduces a cleaner, more abstract layer for application-level concerns (actions, signals, agent logic). It directly replaces the functionality that was beginning to be built, somewhat out of place, in the foundation.mabeam namespace.


Part 2: Proposed Unified Architecture and Deprecation Plan

This is the target architecture. It resolves all redundancies and establishes a clean separation of concerns.

graph TD subgraph "Layer 4: ElixirML / DSPEx (The ML Application)" L4["Defines `Action`s & orchestrates `Agent`s"] end subgraph "Layer 3: Jido (The Agent Framework)" L3["`Jido.Agent`, `Jido.Skill`, Coordination Protocols"] end subgraph "Layer 2: Core Abstractions" subgraph "jido_action (Command Pattern)" L2A["`Jido.Action` & `Jido.Exec`"] end subgraph "jido_signal (Messaging Pattern)" L2B["`Jido.Signal` & `Jido.Dispatch`"] end end subgraph "Layer 1: Foundation (The BEAM OS)" L1["`ProcessRegistry`, `Infrastructure`, `Events`, `Telemetry`, etc."] end subgraph "Deprecated" style Deprecated fill:#ffcdd2,stroke:#c62828 Dep["`foundation.mabeam` namespace"] end L4 --> L3; L3 --> L2A; L3 --> L2B; L2A --> L2B; L2A --> L1; L2B --> L1;

Concrete Plan:

  1. DEPRECATE foundation.mabeam: The entire namespace should be marked as deprecated and its logic moved or superseded.

    • foundation.mabeam.ProcessRegistry -> DEPRECATED. Its agent-specific concepts (capabilities, restart policies) will be implemented as metadata within Foundation.Core.Registry, managed by the higher-level Jido.Agent library.
    • foundation.mabeam.Coordination -> DEPRECATED. The economic protocols (Auction, Market) should be implemented as part of a full Jido agent framework, as they are a form of agent interaction.
    • foundation.mabeam.Comms -> REPLACED by jido_signal. jido_signal offers a more robust and extensible dispatching system.
  2. CENTRALIZE Error handling:

    • jido_action.error -> DEPRECATED.
    • jido_signal.error -> DEPRECATED.
    • Refactor jido_action and jido_signal to exclusively use Foundation.Types.Error and the Foundation.Error helper module. This creates a single, unified error structure across the entire stack, making error handling and telemetry vastly simpler and more powerful.
  3. STRENGTHEN the foundation <-> jido* Connection:

    • jido_signal dispatchers must use foundation’s infrastructure. HttpAdapter should use ConnectionManager and CircuitBreaker. PidAdapter should use ProcessRegistry for lookups.
    • jido_action implementations will use foundation services. This is a key benefit. An Action to call an API will use Foundation.Infrastructure. An Action to write a file can emit Foundation.Events for auditing.

Part 3: What the New, Clean Stack Looks Like

Let’s trace how the layers work together in this refined model.

Scenario: An ElixirML program needs to find an available “reviewer” agent and assign it a task.

  1. The Request (ElixirML):

    • The ElixirML orchestrator needs a reviewer. It runs a jido_action.
    • Jido.Exec.run(ElixirML.Actions.FindAndAssignReviewer, %{task_id: 123})
  2. The Action (jido_action):

    • The FindAndAssignReviewer action runs. Its logic is to find an available agent and emit a signal to assign the work.
    • It uses Foundation.ServiceRegistry to find agents with the :reviewer capability.
      # Inside the Action's run/2
      reviewers = Foundation.ServiceRegistry.find_by_capability(:reviewer)
      available_reviewer = select_best(reviewers) # e.g., least busy
      
    • The action’s job is done once it has decided what to do. It then returns a Jido.Signal to communicate that decision.
      # Conclusion of the Action's run/2
      assign_signal = Jido.Signal.new!(
        type: "task.assignment.request",
        source: "/reviewer_pool",
        data: %{task_id: 123, assignee: available_reviewer.id}
      )
      {:ok, %{status: :reviewer_found}, assign_signal}
      
  3. The Execution Engine (Jido.Exec):

    • It receives the {:ok, result, signal} tuple.
    • It takes the assign_signal and passes it to the Jido.Signal.Dispatch system.
  4. The Messaging System (jido_signal):

    • Jido.Dispatch looks at the signal. It might have a dispatch configuration to send it directly to the agent’s PID. jido_dispatch: {:pid, [target: assignee_pid]}
    • The PidAdapter takes over. It might use Foundation.ProcessRegistry.lookup to ensure the PID is still valid before sending.
  5. The Infrastructure (foundation):

    • Every step of this process can be wrapped in Foundation.Telemetry and can emit Foundation.Events for logging and tracing.
    • If the assignment involved an external call (e.g., to a separate task management service), it would have been protected by Foundation.Infrastructure.CircuitBreaker.

Conclusion

The jido* family of libraries provides a higher-level, application-facing set of abstractions for building agentic systems. They replace the agent-specific logic that was beginning to form inside foundation.mabeam and formalize it into a proper, reusable framework.

  • foundation is purified to be the universal BEAM OS kernel.
  • foundation.mabeam is deprecated, with its ideas being properly implemented in jido.
  • The jido* libraries become the standard, layered toolkit for building event-driven, command-oriented applications, with jido_signal as the messaging layer and jido_action as the command layer.