Agent with User Authentication

This guide explains how to create an agent that requires user authentication when using tools or MCP connectors.

Currently, this feature is only supported for tools/MCPs integrated via GL Connectors that enabled within your organization.

For connector configuration, see: https://gdplabs.gitbook.io/sdk/gl-ai-agent-package/guides/agents#gl-connectors-tokenarrow-up-right


Configuration

To enable user authentication, set user_authentication: true in the tool or MCP configuration.

agents.yaml
tool_configs:
  <tool-id>:
    user_authentication: 'true'
    
mcp_configs:
  <mcp-id>:
    user_authentication: 'true'

When enabled, the agent will require the user to authorize the connector before executing the tool.


How It Works

  1. The agent detects which connectors require authentication.

  2. If a connector is not authorized, the agent will request authorization.

  3. The agent waits until all required connectors are authenticated.

  4. After authorization is completed, click Retry to run the query again.

The agent will then execute the task using the user's authenticated account.


Example

Example: Email Assistant Agent using Gmail

1

User request

User asks the agent:

2

Connector detection

The agent detects that Gmail authorization is required. Click the Connectors button, it will redirect you to the list of connectors.

3

Prompt user

The user is prompted to authorize the Gmail connector. Click Connect in the required connector and do the authorization.

4

Retry

After authorization, close the Connectors window and click Retry in conversation window.

5

Execute

The agent sends the email using the user's Gmail account.


circle-info

Notes

  • Authentication is required once per connector unless the token expires or is revoked.

  • If multiple connectors require authentication, all must be authorized before the agent runs.

Last updated