// AetherShell TUI A2A Protocol Demo
// Launch with: ae tui
//
// This demo showcases the Agent-to-Agent (A2A) messaging protocol:
// - Agent registration with capabilities
// - Direct messaging
// - Broadcasting
// - Task delegation
//
// Note on shape: registration and delivery are addressed by agent name.
// There is no separate "bus" object to create and thread through each call —
// an earlier version of this file assumed one, and every line failed.
// Register agents with their capabilities
a2a_register("researcher", {capabilities: ["research", "analyze", "summarize"]})
a2a_register("writer", {capabilities: ["write", "edit", "format"]})
a2a_register("reviewer", {capabilities: ["review", "critique", "approve"]})
a2a_register("coordinator", {capabilities: ["coordinate", "delegate", "monitor"]})
print("Registered agents: " + a2a_agents())
// Direct message from the coordinator to the researcher
a2a_send("researcher", {
"from": "coordinator",
type: "Task",
content: "Research the latest trends in AI agents"
})
// Broadcast to every registered agent
a2a_broadcast({
"from": "coordinator",
type: "Announcement",
content: "Project kickoff: we are building a technical guide"
})
// Task delegation, naming the capabilities the work needs
a2a_send("researcher", {
"from": "coordinator",
type: "Delegate",
content: "Find 5 key papers on agent communication",
capabilities_required: ["research", "analyze"]
})
// Response back to the coordinator
a2a_send("coordinator", {
"from": "researcher",
type: "Response",
content: "Research complete. Found 5 relevant papers.",
in_reply_to: "task-001"
})
print("Bus status: " + a2a_status())
// The TUI provides:
// - Message flow visualization (nodes and connections)
// - Agent status indicators (idle, sending, receiving, processing)
// - Message queue display per agent
// - Capability registry view
// - Delivery confirmation tracking
//
print("TUI A2A Protocol Demo Ready! Launch with: ae tui")
print("Watch messages flow between agents in real-time!")