Tool providers
The Agent Builder is part of the Mastra Enterprise Edition. Production deployments require a valid EE license. Contact sales for more information.
Tool providers let Builder-created agents call tools from third-party apps such as Gmail, Slack, or GitHub. The Builder reuses the same tool providers as the editor, so any provider registered on MastraEditor is available in the Builder.
This page covers what's specific to the Builder: setting up connections, choosing a connection scope, and managing connections. To register a provider and enable its toolkits, see Tools.
PrerequisitesDirect link to Prerequisites
Before agents can use integration tools in the Builder:
- Register a tool provider on the
toolProvidersmap ofMastraEditor(see below). - Set up a Composio auth config for each toolkit you want to use (see below).
- Configure a storage adapter on the
Mastrainstance. Connection state persists throughMastra.storage.
Register a tool providerDirect link to Register a tool provider
The Builder reuses the editor's tool providers. Register each provider you want to expose on the toolProviders map of MastraEditor. Mastra ships providers for Composio and Arcade; add a provider by giving it a key and an instance.
import { Mastra } from '@mastra/core'
import { MastraEditor } from '@mastra/editor'
import { ComposioToolProvider } from '@mastra/editor/composio'
export const mastra = new Mastra({
agents: {
/* your agents */
},
editor: new MastraEditor({
toolProviders: {
composio: new ComposioToolProvider({
apiKey: process.env.COMPOSIO_API_KEY!,
allowedToolkits: ['gmail', 'googlecalendar'],
}),
},
}),
})
Each provider's toolkits become available in the Builder once it is registered. Use allowedToolkits to restrict which toolkits the provider exposes — by slug, such as gmail or googlecalendar. Omit it to expose every toolkit the provider offers. To add another provider, import it and add another entry to toolProviders. For the full list of providers and their options, see Tools — Integration providers.
Set up a Composio auth configDirect link to Set up a Composio auth config
Each toolkit a user can connect needs its own auth config in the Composio dashboard. An auth config defines how Composio authenticates with an app — its OAuth client, scopes, and credentials. Each toolkit needs its own because requirements vary by app: some share common OAuth methods, while others need extra setup. Without an enabled config, the connection flow fails.
- Open the Composio dashboard and select the toolkit you want to enable, for example Gmail or GitHub.
- Create an auth config for the toolkit and complete the app-specific setup. Composio's auth config docs cover the fields each app requires.
- Enable the auth config.
Keep exactly one auth config enabled per toolkit. When a user connects the toolkit, the provider resolves the single enabled config for that toolkit and starts the OAuth flow against it.
The provider throws if a toolkit has zero enabled auth configs or more than one. Enable exactly one auth config per toolkit you expose in the Builder.
Connect a toolkitDirect link to Connect a toolkit
Once a provider is registered and its auth config is enabled, the toolkit can be connected from the Builder:
- Open the agent and add the toolkit's tools.
- Click Connect on the toolkit and complete the OAuth flow for the account you want to use.
The connected account is bound to the agent, and its tools are ready to use on the next run.
Connection scopeDirect link to Connection scope
When you select a toolkit's tools for an agent, you also pin a connection. The connection determines which account each tool call uses at runtime, with a scope that controls who shares the credential. Today connections are per-author: the connection belongs to the agent's author, and any invoker runs the agent with the author's account.
RelatedDirect link to Related
- Tools: Register providers and browse toolkits in the editor.
- ToolProvider reference: Provider API details.
- Agent Builder API reference: Manage connections programmatically with the
@mastra/client-jsSDK. - Agent Builder overview