Dynamic Tools for AI Agents

Providing tools to AI agents dynamically based on the current conversation context.

🖥️

An interactive version of this guide is available in Membrane Console.

📘

This guide uses Membrane API. Learn more here: Getting Started guide

Overview

Use this when you can't know the right tools ahead of time or when the tool catalog is very large.

✅ When to use:

  • You manage many integrations and actions
  • Tools depend on user intent or runtime context
  • Users may connect new apps during the conversation
  • You want to expose 'everything' without overwhelming the LLM

❌ When not to use:

  • The toolset is small and predictable
  • You want maximum caching efficiency
  • You don't want extra infrastructure (search, indexing)

Step 1: Search actions tool

Give your agent a tool to search for available Actions using semantic search based on intent.

The agent can discover relevant tools dynamically during the conversation without having a pre-defined list.

searchActions

Reference: searchActions

Step 2: Run action tool

Give your agent a tool to run the Action it selected from the search results. Pass the action ID and inputs provided by the agent, and return the output.

runAction

Reference: runAction

Run an action and return the result

// In your agent's tool handler
async function handleRunAction(actionId, input) {
  const result = await membrane.action(actionId).run(input)
  return result.output
}

Reference: ActionAccessor.run