Skip to main content
Agent sessions are an optimized interface for AI agents to use integrations. Connect your agent to Nango once through MCP to access 1,400+ APIs.
  • 10,000+ ready-to-use tools. Nango keeps them up to date and improves them using insights from hundreds of millions of production calls.
  • Fewer tokens. On-demand tool search and concise tool responses keep the agent’s context small.
  • You control access. Choose whose accounts the agent uses and what it can do. The agent never sees provider API credentials.
  • Traceable calls. See what the agent called and why in Nango Logs.

How sessions work

Your backend creates a session and gives the agent an MCP URL and a scoped token.
  • Tenant selects whose connections the agent can use.
  • Toolset selects which integrations and tools it can call.
  • Meta tools let it find and run tools and connect integrations.

Quickstart

1

Create a session from your backend

By default, a session covers every tool on the integrations the tenant has a connection for.To define the tenant, select the connections the agent may use with tag selectors:
Requires an API key with the environment:agent_sessions:write scope. See API key scopes.This returns a ready-to-use session:
2

Pass the MCP server to your agent

Pass the mcp_url to your agent, with the session_token as bearer auth:
The Responses API never stores the authorization value, so send it on every request.
Your agent can now use every tool the session exposes.

Session basics

Creating a session

Set the tenant, toolset, and session lifetime when you create a session.
See Tenant, Toolsets & tools, and Meta tools for configuration options. Session creation fails if the tenant matches multiple connections for an integration without a pin, or if the toolset names an unknown integration or tool. Nango returns a session_id and a scoped session_token. Treat the token as a secret and set the shortest lifetime your agent needs.

Session MCP server

Connect to the session’s mcp_url over Streamable HTTP with session_token as the bearer token. tools/list returns enabled meta tools and pinned tools, 50 per page. Pass nextCursor to fetch the next page. Call pinned tools by name and put their arguments in input. The agent can find unpinned tools with nango_tool_search and call them with nango_execute.

Tool changes

Tool availability and schemas can change during a session, including for meta tools. Fetch tool definitions from the session’s MCP server at runtime. Do not hardcode tool names or schemas.

Terminating a session

Sessions expire after expires_in. Create a new session if you need more time. To end a session early, call DELETE /sessions/{session_id}.
Requires an API key with the environment:agent_sessions:write scope, the same one session creation uses.
Termination revokes the session token. New MCP requests return 401, and calls already in progress can finish. Repeating the request returns the original ended_at and reason. An unknown session or a session in another environment returns 404.

Go deeper

Tenant

Select the connections a session uses to decide whose accounts the agent can act on.

Toolsets & tools

Control what the agent can do by choosing which integrations and tools it can use.

Meta tools

Let the agent find and run tools on demand and help users connect integrations when needed.