Skip to content

Set up the agent

The agent is a chat assistant that lives in the Salesforce utility bar. The starter agent is called Lumen. Users ask it questions in plain language, and it uses the same tools to look things up and make changes in the org.

Here the AI model is called from Apex, so you need an API key from a model provider. These steps use OpenRouter, which comes preconfigured. To use OpenAI, Azure OpenAI or your company’s AI gateway instead, see Use a different provider.

Install ApexAgent before you start.

Create a key on OpenRouter’s API keys page and copy it.

In Setup, go to Named Credentials, open the External Credentials tab, and open OpenRouter Credential. Under Principals, open the Actions menu at the end of the Authorization row and choose Edit. Add an authentication parameter:

  • Name: Authorization
  • Value: your OpenRouter API key, just the key. Do not put Bearer in front of it; ApexAgent adds that.
The OpenRouter Credential external credential in Salesforce Setup, with a Principals section listing one principal named Authorization.
The Actions menu is at the right-hand end of the Authorization row, under Principals.

From the App Launcher, open the ApexAgent Setup Portal app. Lumen is in the utility bar at the bottom of the screen, and also has a full-page Lumen Agent tab.

The Lumen Agent panel open from the Salesforce utility bar, showing the Lumen logo, a greeting and a message box.
Select Lumen Agent in the utility bar, at the bottom right of the screen, to open the panel.

To put it in another Lightning app, edit that app in App Manager and add the lumenAgent component to its utility bar. For an agent of your own, see Customise an agent.

Setup creates two LLM records that both use your OpenRouter key:

LLM Model
Gemini 3.7 Flash google/gemini-3.7-flash
Free Model Router openrouter/free, which routes to models OpenRouter offers at no cost
The Lumen agent record, with its LLM field set to Gemini 3.7 Flash.
The LLM field on the agent record decides which model Lumen uses.

Lumen starts on Gemini 3.7 Flash. To change it, open the Agents tab in the Setup Portal, open Lumen and set its LLM field. Both options need your OpenRouter key, including the free one.

To use a model or provider that isn’t listed, see Use a different model.

Once the key is in place, ask Lumen something about your data.

Lumen answering a question about a customer's open cases, then creating a new case after asking for confirmation.
Lumen looks up a customer's open cases, then creates a new one after asking for confirmation.