Documentation

External Service Integration Setup

This guide explains what to configure in LeafMesh so it can talk to your external services. LeafMesh handles the HTTP wire details for each supported framework — you only provide endpoint URLs, credentials, and any framework-specific identifiers.

Addresses and credentials go in the vault, never in the configuration. URLs, endpoints, hosts, keys, tokens, passwords and header rows are entered only on Studio's Infrastructure page, as a record. The agent's block picks the record with connection: <name> (a zapier, composio or n8n tool block: vault_connection). An inline value — including a ${ENV:default} reference — is refused at load, naming the field and the record to create. A connection name may still come from the environment (connection: "${SLACK_CONNECTION:slack-workspace}"). If the record does not exist yet, the agent that needs it is switched off with the reason and works as soon as the record exists, with no restart.

agents: research_crew: name: "research_crew" agent_type: "external" framework: "crewai" connector_config: connection: "crewai-prod" # the record holds the URL and key

Framework Connectors

CrewAI

LeafMesh talks to any CrewAI-compatible deployment that exposes the standard CrewAI run/status endpoints.

Create the record on Infrastructure → External agents → CrewAI with:

  • url — base URL of your CrewAI service
  • api_key — optional bearer token

Then set connector_config: {connection: <record name>} on the agent.

Deploy options: CrewAI Enterprise, self-hosted via crewai deploy, or any CrewAI-compatible service.


LangGraph

LeafMesh talks to any LangGraph Platform-compatible deployment.

Create the record on Infrastructure → External agents → LangGraph with:

  • url — base URL of your LangGraph service
  • api_key — optional API key

Set on the agent's connector_config:

  • connection — the record's name
  • assistant_id — the graph (assistant) to run

If the official langgraph-sdk is installed in your environment, LeafMesh uses it automatically.

Deploy options: LangGraph Platform, langgraph up (self-hosted), or any LangGraph-compatible service.


AutoGen

LeafMesh talks to any AutoGen Studio-compatible deployment.

Create the record on Infrastructure → External agents → AutoGen with:

  • url — base URL of your AutoGen service
  • api_key — optional bearer token

Set on the agent's connector_config:

  • connection — the record's name
  • workflow_id — optional workflow identifier

Deploy options: AutoGen Studio, or any AutoGen-compatible service.


A2A (Agent-to-Agent Protocol)

LeafMesh talks to any agent implementing the A2A protocol.

Create the record on Infrastructure → External agents → A2A Protocol with:

  • url — base URL of the A2A agent
  • auth_token — optional credential

Set on the agent's connector_config:

  • connection — the record's name
  • auth_scheme — optional auth scheme (default: Bearer)

If the official a2a-sdk is installed in your environment, LeafMesh uses it automatically.

Deploy options: Any A2A-compatible agent.


MCP (Model Context Protocol)

LeafMesh talks to any MCP-compliant server over HTTP or stdio.

For http: create the record on Infrastructure → Integrations → MCP (on 2.4.482 it shows under External agents) with the server's url and any token, and set connection to its name.

Set on the agent's connector_config:

  • transport — http or stdio
  • connection — the record's name (for http)
  • For stdio: command + args to launch the server process locally
  • tool_name — the tool LeafMesh should invoke

Deploy options: Any MCP-compatible server.


Zapier

No custom server needed — Zapier is a hosted service.

Create the record on Infrastructure → Integrations → Zapier with:

  • mcp_key — the Zapier MCP key (Zapier retired AI Actions, the REST API an api_key reached)

Set on the agent's connector_config:

  • vault_connection — the record's name (Zapier uses vault_connection; its connection is the Zapier app)
  • action — the Zapier action to run

Setup: get your Zapier MCP key and save it on the record.


Composio

No custom server needed — Composio is a hosted service.

Create the record on Infrastructure → Integrations → Composio with:

  • api_key — your Composio API key

Set on the agent's connector_config:

  • connection — the record's name
  • action — the action to execute
  • entity_id — the entity / integration target

Setup: Create an account at composio.dev, get your API key, set up the integration + entity.


n8n

LeafMesh talks to any n8n workflow exposed via a webhook trigger.

Create the record on Infrastructure → Integrations → n8n with:

  • webhook_url — the URL of your n8n webhook trigger node

Then set connector_config: {connection: <record name>} on the agent.

LeafMesh sends the agent's input_data as the webhook payload and uses the response JSON as the agent output.

Setup:

  1. Create a workflow in n8n
  2. Add a "Webhook" trigger node (set to POST)
  3. Copy the webhook URL into the n8n record's webhook_url

Deploy options: n8n Cloud, self-hosted via npx n8n, or Docker.


Channel Adapters

Channels require two-way setup: your chat platform sends events TO LeafMesh, and LeafMesh sends messages BACK.

Each channel's tokens and secrets go into a record on Infrastructure → Messaging (Slack, Microsoft Teams, Telegram, Zoho Cliq; Discord and WhatsApp coming; email is under Infrastructure → Workspace → Email). The agent's channel block names the record with connection: <name> and keeps only non-secret settings such as post_channel. In the steps below, bot_token, signing_secret and verify_token are fields of that record; post_channel is set on the agent's channel block.

Slack

Your Slack app must be configured to send events to:

POST https://your-leafmesh-server/channels/slack/{agent_name}/events

Setup:

  1. Create a Slack app at api.slack.com/apps
  2. Enable Event Subscriptions → set Request URL to the endpoint above
  3. Subscribe to message.channels and message.im events
  4. Install the app to your workspace
  5. Copy Bot Token (xoxb-...) → bot_token
  6. Copy Signing Secret → signing_secret
  7. Set the channel ID where the bot posts → post_channel

SDK: Install slack-sdk for the best outbound delivery and inbound signature verification path; LeafMesh falls back to raw HTTP if it is not present.


Telegram

Your Telegram bot must have its webhook set to:

POST https://your-leafmesh-server/channels/telegram/{agent_name}/webhook

Setup:

  1. Create a bot via @BotFather → get the bot token
  2. Set the webhook: curl -X POST "https://api.telegram.org/bot{token}/setWebhook?url=https://your-server/channels/telegram/{agent_name}/webhook&secret_token={signing_secret}"
  3. Copy Bot Token → bot_token
  4. Copy Secret Token → signing_secret (for request verification)
  5. Set the chat ID for outbound messages → post_channel

SDK: Install python-telegram-bot for the best outbound delivery path; LeafMesh falls back to raw HTTP if it is not present.


Discord (coming)

Discord is not available yet. The setup below is for when it is.

Your Discord app must send interactions to:

POST https://your-leafmesh-server/channels/discord/{agent_name}/interactions

Setup:

  1. Create a Discord app at discord.com/developers
  2. Set Interactions Endpoint URL to the endpoint above
  3. Copy Bot Token → bot_token
  4. Copy Public Key → signing_secret (for Ed25519 signature verification)
  5. Set the channel ID for outbound → post_channel

Note: Install pynacl for Ed25519 signature verification. Without it, the adapter returns 503 on inbound requests.


WhatsApp (coming)

WhatsApp is not available to customers yet. The setup below is for when it is.

Your WhatsApp Business account must send webhook events to:

GET/POST https://your-leafmesh-server/channels/whatsapp/{agent_name}/webhook

The GET endpoint handles Meta's verification challenge. The POST endpoint receives message events.

Setup:

  1. Create a Meta Business app at developers.facebook.com
  2. Add the WhatsApp product
  3. Configure webhook → set Callback URL to the endpoint above
  4. Copy Access Token → bot_token
  5. Copy Phone Number ID → post_channel
  6. Copy App Secret → signing_secret (for HMAC-SHA256 verification)
  7. Set Verify Token → verify_token (for webhook verification challenge)

Microsoft Teams

Your Bot Framework registration must send messages to:

POST https://your-leafmesh-server/channels/teams/{agent_name}/messages

Setup:

  1. Register a bot at dev.botframework.com
  2. Set the messaging endpoint to the URL above
  3. Copy Microsoft App ID → bot_token
  4. Copy App Password → signing_secret
  5. Set the default conversation ID → post_channel

SDK: The Bot Framework Python SDK was archived in January 2026. LeafMesh's built-in HTTP path handles OAuth token fetch automatically with no extra package needed and is the recommended option for new deployments. If botframework-connector is installed, LeafMesh will use it for OAuth management.


Common Pattern

For framework connectors, LeafMesh kicks off the run, waits for it to finish (polling as needed), then passes the result downstream to the next agent. Long-running jobs are handled automatically.

For channel adapters, inbound chat events resume or start a session, the mesh runs, and the agent's reply is posted back through the platform's API.

You only enter URLs and credentials, once, as records on the Infrastructure page — LeafMesh handles polling, retries, timeouts, auth, signature verification, and data normalization.

Last updated: 11/10/2026