Tools for AI Agents
Provide your AI agent with tools from the connections your customers have set up.
An interactive version of this guide is available in Membrane Console.
This guide uses Membrane API. Learn more here: Getting Started guide
Overview
This is the simplest way to provide tools from external apps for your agent.
✅ When to use:
- You can decide which tools the agent needs before the session starts
- The toolset is stable for the session
- You want to leverage LLM context caching
❌ When not to use:
- You have hundreds or thousands of possible tools
- Tools depend heavily on runtime context or user intent
- Users frequently connect new apps during the conversation
Step 1: List connections
Get a list of connections your customer has set up. You will use them to get available tools.
See the Integration Catalog guide to learn how to let your customers create and manage connections.
listConnections
Step 2: Select relevant connections
Let your user select which connections they want the agent to use, or select them programmatically based on your application logic.
Depending on your use case, you will have to choose the right UX for picking connections to get the tools from and the right tradeoff between tools availability and the LLM context usage.
Step 3: Get tools for the selected connection(s)
Get a list of Membrane Actions available for a specific connection. This will return:
- Tools specifically defined for this connection
- Tools defined for the integration this connection belongs
- Default tools for the external app from Membrane Universe (if enabled in your workspace)
If you need tools from multiple connections, make multiple requests and merge the results.
List actions for a connection
Step 4: Map actions to your agent tools structure
Map the Actions to the tool format your LLM and agent framework accepts. You can use id, name, description, inputSchema and outputSchema from the actions response.
Make sure you save id for each action - you will need it to run the action later.
See the Actions documentation for details on the action structure.
// Example: Build tools from actions response
const tools = actions.items.map(action => ({
id: action.id,
name: action.name,
description: action.description,
inputSchema: action.inputSchema,
outputSchema: action.outputSchema,
}))Step 5: Execute tool calls
When your agent calls a tool, run the corresponding Action by its ID with the input provided. Return the output back to the LLM.
If you use an action that can be applied across multiple connections, you will have to additionally pass the connectionId to the run request.
Run an action
Updated 2 days ago
