Improve custom agent resolution rate with session context (beta)

Last updated:

Session context gives your custom agent access to a visitor's recent activity in Pendo during a live conversation. Your agent can use this to understand what the visitor was doing in your app before they reached out, so it can give faster, more relevant answers.

Note: This feature is available in open beta.

If your agent runs on Intercom Fin, see Improve Fin resolution rate with session context (beta) instead.

Use cases

Session context lets your agent look up what a visitor recently did in your app. You can use it to:

  • Reduce back-and-forth by showing your agent what the visitor already tried.
  • Improve answer accuracy by grounding responses in actual visitor behavior, not only the visitor's description of the problem.
  • Shorten time to resolution by skipping troubleshooting steps the visitor has already completed.

How it works

Session context is delivered through the Pendo MCP server as the getSessionActivity tool:

  1. A visitor starts a conversation with your agent and describes an issue.
  2. Your agent calls getSessionActivity with the visitor's Pendo Visitor ID.
  3. Pendo returns recent activity from the visitor's current session, including Pages visited, tagged Features clicked, tagged Track Events, and related frustration signals. Untagged clicks and Track Events aren't included.
  4. Your agent uses this activity to reference what the visitor was doing, acknowledge steps already taken, and give a more targeted answer.

Session context covers the visitor's current session only. The lookback window isn't configurable.

Tip: Give your Pages and Features descriptive names and descriptions in Pendo. Your agent uses these names when it describes session activity, so clear labels like "Billing Settings Page" or "Export CSV Button" help it communicate precisely.

Before you begin

To set up session context, you need:

  • Subscription admin permissions to access Agent Toolkit.
  • A custom agent in Agent Toolkit with MCP connected. See Set up a custom agent in Agent Toolkit (beta).
  • A developer to update your agent's code and instructions.
  • The visitor's Pendo Visitor ID available to your agent. Your agent must be able to pass the same ID that Pendo uses for the visitor.
  • Semantic search turned on in Pendo Subscription settings > AI access. If this setting is off, your subscription may have opted out of Google AI features, and session context is unavailable.

Step 1. Turn on session context

  1. From the left-side menu in Pendo, open Agent Toolkit and select your agent.
  2. On the agent's overview page, find the Session context card and select Set up session context. The Session context tab opens.

Session context has no off switch in Pendo. To stop your agent using it, update your agent's code so it no longer calls the tool.

You can also turn on Collect all console and network errors to add error data to session context. See Collect all console and network errors.

Step 2. Call the tool from your agent

After session context is on, getSessionActivity appears in your agent's tool list. Your developer calls it with the visitor's Pendo Visitor ID.

Example request

curl -X POST "https://app.pendo.io/mcp/visitor/shttp"\
  -H "Content-Type: application/json"\
  -H "Authorization: Bearer {access_token}"\
  -d '{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "getSessionActivity", "arguments": {"visitorId": "visitor-1234"}}}'

Use the MCP server URL for your region. For the full list, see Set up a custom agent in Agent Toolkit (beta).

Step 3. Tell your agent when to use session context

Your agent decides when to call a tool based on its instructions. Add guidance to your agent's system prompt so it checks session activity when it's useful, for example at the start of a support conversation or when a visitor reports a problem.

Step 4. Verify the connection

  1. Call tools/list and confirm getSessionActivity is in the response.
  2. Call getSessionActivity with the Visitor ID of a visitor who is currently active in your app.
  3. Confirm the response includes the Pages and Features you expect.

Collect all console and network errors

Without this setting, Pendo captures console and network errors from your web apps only while a Session Replay recording is active. Turn on Collect all console and network errors to have the Pendo Web SDK send error-level console logs and failed network requests from your agent's apps at all times. This adds to the session context available to your agent. Turning it on here turns it on for every web app the agent can access. Network error response bodies are collected and redacted by default.

To use this setting, your apps must run web SDK version 2.338.0 or later.

Important: Console and network errors can contain sensitive data from visitor sessions. Check that collecting them aligns with your company's data policies before you turn this on.

  1. From the left-side menu in Pendo, open Agent Toolkit and select your agent.
  2. Open the Session context tab.
  3. Under Enable session context for your agent, turn on Collect all console and network errors.
  4. Review the data notice, enter I accept in the confirmation field, then select Enable.

Note: If your subscription includes Session Replay, the errors you collect with this setting also appear alongside your replays. For more information, see Use developer tools in Session Replay.

For subscriptions without Session Replay, the same setting is also available under Settings > Subscription settings > Applications > your app > Basic settings. Turning it on or off in either place changes the same setting.

To stop collecting, turn the setting off and select Disable. Pendo then captures console and network errors only while a Session Replay recording is active.

Troubleshoot session context

  • getSessionActivity is missing from tools/list. Check that session context is turned on for the agent, that the agent's MCP connection is in place, and that Semantic search is turned on in Subscription settings > AI access.
  • The tool returns no activity. Check that the ID your agent passes matches the Visitor ID in Pendo, and that the visitor has activity in their current session in one of the agent's accessible apps. Activity from earlier sessions and untagged activity aren't returned.
  • Requests are rejected as unauthenticated. Check that the access token hasn't expired and that the header uses Bearer, not bearer.
Was this article helpful?
0 out of 0 found this helpful