Skip to content

Conversation

@destroyersrt
Copy link
Collaborator

@destroyersrt destroyersrt commented Oct 20, 2025

SLIM Protocol Support - Secure Low-latency Interactive Messaging

This PR adds support for the AGNTCY SLIM protocol, enabling agents to communicate via gRPC-based point-to-point messaging with persistent connections. SLIM provides an alternative to HTTP-based A2A communication, offering lower latency and more efficient bi-directional streaming.

🎯 Key Changes

SLIM Protocol Integration

  • Implemented SLIMProtocol adapter (protocols/slim/adapter.py) using official slim-bindings SDK
  • Point-to-point messaging with session management and automatic retries
  • Personal inbox channels for each agent (agent-{id}-inbox)
  • Async message handling with concurrent session support
  • Automatic protocol selection (SLIM preferred when available)

Protocol Router Enhancements

  • Updated ProtocolRouter to launch protocols concurrently
  • SLIM protocol prioritized when supported by both sender and receiver
  • Dynamic endpoint generation for multi-protocol agents
  • Fallback URL construction for SLIM identifiers (slim://{agent_id})

Configuration & Setup

  • Added environment variables for SLIM configuration (SLIM_ENABLED, SLIM_NODE_URL)
  • Docker Compose setup for SLIM control plane and data plane services
  • SLIM submodule integration (agntcy/slim.git)
  • Updated dependencies: slim-bindings, grpcio, protobuf

Agent Bridge Updates

  • Enhanced AgentBridge to handle SLIM URL format (slim://{agent_id})
  • Protocol-aware routing with fallback logic
  • Support for both HTTP endpoints (A2A) and SLIM identifiers
  • Improved agent discovery with multi-protocol support

Testing Infrastructure

  • Added test_sender.py and test_receiver.py for SLIM protocol validation
  • Demonstrates point-to-point messaging with route setup and session management

📦 Architecture

Agent Communication Flow:
Agent A (sender)
└─> ProtocolRouter.send_message()
└─> SLIMProtocol.send_message()
├─> slim.set_route(target_name)
├─> slim.create_session(PointToPoint)
├─> session.publish(message)
└─> session.get_message() [reply]

Agent B (receiver)  
  └─> SLIMProtocol._listen_for_messages()
      └─> slim.listen_for_session()
          ├─> session.get_message()
          ├─> incoming_handler(message)
          └─> session.publish_to(reply)

🔧 Configuration Example

Enable SLIM in your agent:
nanda = NANDA(
agent_id="my-agent",
agent_logic=my_logic,
protocols={
"a2a": {"enabled": True},
"slim": {
"enabled": True,
"node_url": "grpc://localhost:50051"
}
}
)

Environment Variables:
SLIM_ENABLED=true
SLIM_NODE_URL=grpc://localhost:50051

Docker Compose:
docker-compose up -d # Starts SLIM control plane + data plane

✅ Benefits

  • Lower Latency: gRPC-based persistent connections vs HTTP request/response
  • Bi-directional Streaming: Full-duplex communication with session support
  • Reliability: Built-in retries and timeout handling
  • Scalability: Distributed routing via SLIM control plane
  • Security: Shared secret authentication (configurable identity providers)
  • Flexibility: Automatic fallback to A2A when SLIM unavailable

🚀 Protocol Selection Logic

  1. Check if target agent supports SLIM (from registry)
  2. If SLIM available → use SLIM protocol
  3. Otherwise → fallback to A2A (HTTP)
  4. Construct appropriate URL format (slim:// or https://)

📋 Next Steps

  • Environment-based shared secret configuration
  • MLS encryption support for SLIM sessions
  • SLIM connection pooling and reuse
  • Metrics and monitoring for SLIM protocol
  • Integration tests with both A2A and SLIM agents

@destroyersrt destroyersrt self-assigned this Oct 20, 2025
@destroyersrt destroyersrt linked an issue Oct 20, 2025 that may be closed by this pull request
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Support for Agntcy/SLIM

2 participants