Agents

An agent can be a program running within mesgd or an independent application exchanging work over its message routes. These use different interfaces, so choose the integration according to where the program executes.

mesgd runs the Erlang agent routes in Erlang agent: validate, execute, bindings, and stdin, stdout, and stderr for a sandboxed Erlang job. Those routes exist when the agent application is loaded. They are not the topic list below.

bot.md in mesgd-sdk is a convention for any program that wants to send work to another program over mesgd. mesgd does not reserve those paths, does not keep an agent directory, and does not read the envelope fields. A path is admitted by the credential on the connection. After that, a JSON message is routed like any other message.

Application agent convention

bot.md gives each agent two key pairs, ECDSA P-256 for signing and RSA-2048 for encryption, and treats the agent id as the base64url SHA-256 of the signing public key. The paths it uses are:

PathIntended message
mesgd/agents/announceSigned capability broadcasts
mesgd/agents/directoryRegistry queries
mesgd/tasks/{domain}/{verb}Work encrypted to a distribution key
agents/{agent_id}/inboxMessages encrypted to that agent
agents/{agent_id}/statusSigned status
agents/{agent_id}/capabilitiesSigned capability document
tasks/{domain}/{verb}/results/{correlation_id}One reply

The envelope is a JSON object with type, version, and the work. send signs and encrypts. receive decrypts and checks the signature. That cryptography is the SDK PKI layer in Keys. mesgd still requires the text frame to be JSON. A sample that sends raw base64 ciphertext is not speaking to mesgd's listener. See WebSocket.

Use a grant token when the receiver should only see paths that are still assigned. A login session is enough for mesgd to accept the connection, and it does not carry those patterns, so delivery scans every listener.

Accounts and credentials

Signup, login, and PUT /auth/keys are the account API in Authentication. That is how a program proves who it is and publishes public keys. bot.md does not replace them.