Use tools from several apps in one agent session
List one entry per provider deployment in the providers array of metorial.connect(). The session serves every tool, prefixed with its provider name.
To give one agent tools from several apps, list one entry per provider deployment in the providers array of metorial.connect(). The session serves all of their tools through one connection and prefixes each tool with its provider name, so tools from different apps cannot collide. Each entry carries its own auth and tool filter.
What you'll learn
- How to deploy two providers from the CLI
- How to attach both to one session in TypeScript and Python
- How to mix per-user connections and filters in the same session
Before you start
- Install the CLI and sign in
- A secret API key in
METORIAL_API_KEY
With the CLI
Deploy two providers
Metorial Search and Metorial Crawl are built in and need no credentials. Copy both deployment IDs (pde_...).
Export the IDs
Optional: save the combination
A session template stores the list under one ID. Pass it as sessionTemplateId in a provider entry instead of repeating the list in code.
With the SDK
Install the SDK and an adapter:
Save this as session.ts or session.py. It attaches both deployments and prints the combined tool list. Pass session.tools() to your model SDK or framework as usual.
Mix auth and filters per app
Each entry is independent. This list gives an agent web search, one user's Slack account, and read access to the same user's GitHub account:
The auth config IDs come from the per-user OAuth flow. A session accepts up to 100 providers.
Check it worked
The program prints the tools of both providers and metorial_connection_status, the diagnostic tool Metorial adds to every session. The AI SDK adapter lowercases tool names, so the TypeScript program prints them in lower case.
If a provider cannot be reached, the session still works. Ask the agent to call metorial_connection_status, or list the session's errors:
Troubleshooting
Cannot associate more than 100 providers to a session
Split the providers across sessions, or use fewer deployments.
Provider requires an auth config to be provided
One of the entries needs a sign-in and has no provider auth config. Add providerAuthConfigId to that entry.
Next steps
- Limit the tools an agent can use: the filter types and how to find tool keys
- Let each user connect their own account: where the provider auth config IDs come from
- Sessions: connections, messages and session templates