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
.
Functionality | Implemented in foundation / foundation.mabeam | Replaced/Superseded by jido* Libraries | Architectural Role in Target State |
---|---|---|---|
Agent Lifecycle & Supervision | foundation.mabeam.ProcessRegistry | A future jido_agent library | The jido_agent library will provide the agent runtime, using Foundation.ProcessRegistry for the underlying process management. |
Action/Command Execution | None | jido_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 Communication | foundation.mabeam.Comms | jido_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 Definition | foundation.types.Event | jido_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 Handling | foundation.types.Error , jido_action.error | Standardize on Foundation.Types.Error | All 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.
Concrete Plan:
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 withinFoundation.Core.Registry
, managed by the higher-levelJido.Agent
library.foundation.mabeam.Coordination
-> DEPRECATED. The economic protocols (Auction
,Market
) should be implemented as part of a fullJido
agent framework, as they are a form of agent interaction.foundation.mabeam.Comms
-> REPLACED byjido_signal
.jido_signal
offers a more robust and extensible dispatching system.
CENTRALIZE
Error
handling:jido_action.error
-> DEPRECATED.jido_signal.error
-> DEPRECATED.- Refactor
jido_action
andjido_signal
to exclusively useFoundation.Types.Error
and theFoundation.Error
helper module. This creates a single, unified error structure across the entire stack, making error handling and telemetry vastly simpler and more powerful.
STRENGTHEN the
foundation
<->jido*
Connection:jido_signal
dispatchers must usefoundation
’s infrastructure.HttpAdapter
should useConnectionManager
andCircuitBreaker
.PidAdapter
should useProcessRegistry
for lookups.jido_action
implementations will usefoundation
services. This is a key benefit. AnAction
to call an API will useFoundation.Infrastructure
. AnAction
to write a file can emitFoundation.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.
The Request (ElixirML):
- The
ElixirML
orchestrator needs a reviewer. It runs ajido_action
. Jido.Exec.run(ElixirML.Actions.FindAndAssignReviewer, %{task_id: 123})
- The
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}
- The
The Execution Engine (
Jido.Exec
):- It receives the
{:ok, result, signal}
tuple. - It takes the
assign_signal
and passes it to theJido.Signal.Dispatch
system.
- It receives the
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 useFoundation.ProcessRegistry.lookup
to ensure the PID is still valid before sending.
The Infrastructure (
foundation
):- Every step of this process can be wrapped in
Foundation.Telemetry
and can emitFoundation.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
.
- Every step of this process can be wrapped in
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 injido
.- The
jido*
libraries become the standard, layered toolkit for building event-driven, command-oriented applications, withjido_signal
as the messaging layer andjido_action
as the command layer.