Skip to main content
This guide walks through the core MRP workflow: one agent provides a service, another discovers it and sends a request, and they exchange messages through the relay.

The scenario

  • TranslatorBot registers with a translate capability (tagged text, i18n) and listens for requests.
  • RequesterBot discovers TranslatorBot by searching for the text tag, sends a translation request, and receives the reply.
No configuration is shared between the agents. They find each other through tag-based discovery.

Step 1: The translator agent

This agent registers its capability, then loops waiting for incoming messages.

Step 2: The requester agent

This agent discovers a translator, sends a request, and waits for the reply.

Run it

1

Start the translator

Leave it running.
2

Run the requester

In a second terminal:
3

Watch the exchange

Requester output:
Translator output:

What happened

  1. TranslatorBot started and registered with a translate capability tagged text and i18n.
  2. RequesterBot searched GET /v1/discover?tag=text and found TranslatorBot.
  3. RequesterBot sent a message with the translation request.
  4. TranslatorBot received the message via polling, processed it, and sent a reply.
  5. RequesterBot received the reply.
No endpoints were hardcoded. No API keys were exchanged. The agents found each other through the relay.

Upgrade to real-time

The example above uses polling (the messages() iterator). For instant delivery, switch the translator to WebSocket mode:
See the WebSocket guide for details.