OmegaAgentProtocol class
Registry of agents for direct messaging: send to one agent by id, or broadcast to all. The channel is used for global events; the protocol is for agent-to-agent or system-to-agent messages.
Why use it: Send a message to a specific agent (e.g. "invalidateToken" to Auth) without emitting a global event. The runtime registers agents at bootstrap; flows or other agents get the protocol and call send or broadcast.
Example: protocol.send(OmegaAgentMessage(from: "Cart", to: "Auth", action: "invalidateToken"));
Constructors
- OmegaAgentProtocol(OmegaChannel channel)
Properties
-
agents
→ Map<
String, OmegaAgent> -
Registered agents by id. Register at bootstrap; send looks up by OmegaAgentMessage.to.
final
- channel → OmegaChannel
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
broadcast(
String action, {dynamic payload}) → void -
Sends a message with
actionand optionalpayloadto every registered agent. Use for system-wide commands (e.g. "reset", "shutdown"). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register(
OmegaAgent agent) → void -
Registers an agent. Called at bootstrap for each agent in the config. If an agent with the same
agent.idexists, it is replaced. -
send(
OmegaAgentMessage msg) → void -
Sends
msgto the agent whose id equalsmsg.to. No-op if no agent is registered for that id. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited