AI agents
AI agents are specialized OAuth 2.0 identities that securely perform tasks on behalf of end users through a delegated token exchange process, ensuring distinct accountability and granular access control.
You can use AI agents to securely build digital assistants that operate on behalf of end users, such as a chatbot on a retail website helping a user navigate products, or an internal workforce assistant acting on behalf of an employee to access enterprise tools like Salesforce.
How to use an AI agent
To use an AI agent, you must first complete these steps:
-
Register the agent in one of the following ways:
Once registered, you can use the AI agent in delegation use cases. For example:
Enable AI agents
In AM, AI agents are switched off by default.
To enable AI agents:
-
In the AM admin UI, set the advanced property
org.forgerock.am.oauth2.aiagents.enabledtotrue.How do I configure advanced server properties?
-
In the AM admin UI:
-
To configure properties for all instances of the AM environment, go to Configure > Server Defaults > Advanced.
-
To configure properties for a particular instance, go to Deployment > Servers > server name > Advanced.
-
-
Configure the properties:
-
To add a property, scroll to the end of the page and enter a property name and value in the text fields. Click add ().
-
To edit an existing property, find the property and click the pencil () button. When you are finished, click the tick () button.
-
-
Save your changes.
-
-
Enable AI agents in the OAuth 2.0 provider.
-
Go to Realms > realm name > Services.
-
Create an OAuth 2.0 provider service if one doesn’t exist already.
-
On the OAuth 2.0 provider page, select the AI Agents tab, and select Enable AI Agents.
-
Save your changes.
-
Refresh the UI for the changes to apply.
-
-
Go to Applications > OAuth 2.0 and verify that AI Agents appears as the last item in the menu.
Register an AI agent in the UI
Use the AI agents UI to onboard an AI agent, configure its standard OAuth 2.0 properties as a specialized OAuth 2.0 client, update, or delete an agent.
To create an AI agent:
-
Go to Applications > OAuth 2.0 > AI Agents and click + Add AI Agent.
-
Provide values for Client ID, Client secret, Redirection URIs, Scope(s), and Default Scope(s), and click Create.
The new AI agent is created with standard OAuth 2.0 client properties, with both the
Client CredentialsandToken Exchangegrant types enabled by default. -
Configure the AI agent properties to suit your use case and save your changes.
Find out more about OAuth 2.0 client properties in Client application registration.
Create group settings
You can optionally configure shared settings for AI agents by adding them to an AI agent group. They work in the same way as OAuth 2.0 client groups.
Learn about creating groups and inheriting group settings in Shared application settings.
Register an AI agent dynamically
Use dynamic client registration (DCR) when you want to use automation or agents to onboard themselves.
-
Enable DCR in the provider:
-
In the AM admin UI, go to Realms > realm name > Services > OAuth2 Provider.
-
On the Client Dynamic Registration tab, enable Allow Open Dynamic Client Registration and save your changes.
-
On the Advanced tab, add the scopes the agent can register in the Client Registration Scope Allowlist, for example
read write. -
Save your changes.
-
-
Optional. If you require RFC 8414 compliance, configure your webserver to map the DCR endpoint to appear under the authorization server metadata.
For example, for an Apache Tomcat deployment:
-
Edit the
server.xmlto add the mapping:<Valve className="org.apache.catalina.valves.rewrite.RewriteValve" />to/Server/Service/Engine/Host -
Create a file called
rewrite.configand place it underCATALINA_HOME/conf/Catalina/localhost/. -
Add the following mapping to
rewrite.config:RewriteRule ^/\.well-known/oauth-authorization-server$ /am/oauth2/realms/root/.well-known/oauth-authorization-server/aiagent [L] -
Save your changes.
-
Restart Tomcat.
-
-
Optional. You can verify the AI agent registration URL by calling the well-known authorization server endpoint and reading the
registration_endpointvalue.- Example URLs
-
If the rewrite rule was added:
$ curl https://am.example.com:8443/.well-known/oauth-authorization-server { "…": "…", "registration_endpoint": "https://am.example.com:8443/am/oauth2/aiagent/register", "…": "…" }Without the rewrite rule:
$ curl https://am.example.com:8443/am/oauth2/realms/root/.well-known/oauth-authorization-server/aiagent { "…": "…", "registration_endpoint": "https://am.example.com:8443/am/oauth2/aiagent/register", "…": "…" }
-
To register an agent, you can now post a DCR request to the AI agent endpoint.
Specify the same parameters as for the DCR
/registerendpoint, for example:$ curl \ --request POST \ --header "Content-Type: application/json" \ --data '{ "grant_types": ["client_credentials", "urn:ietf:params:oauth:grant-type:token-exchange"], "client_name": "DCR AI agent", "response_types": ["token"], "redirect_uris": ["'"https://www.example.com:443/callback"'"], "scopes": ["read", "write", "delete"] }' \ "https://am.example.com:8443/am/oauth2/realms/root/realms/alpha/aiagent/register"By default, only the
authorization_codegrant type is set for DCR clients, so you must includeurn:ietf:params:oauth:grant-type:token-exchangeif you want the agent to be able to exchange tokens.You can use DCR scripting to run extra checks and processes after you create, update, or delete an agent.
For example, for IDM integrations, verify attribute values or patch the underlying PingIDM object with custom AI agent identity attributes.