Connect an agent

The shortest path to an agent answering from curated context. Pick the path you already have the pieces for. Deploying carries the full setup detail for each.

Agentforce agents, MCP clients and your own Apex all reach ContextWorks through the same eight actions. Get Catalog comes first, so an agent discovers your real object and field names instead of guessing. Then Find Records for filtered sets and Get Records for records in depth.

Update Records and Create Records do nothing until an admin allows writes in Admin → Governance. See the actions.

Path A — Agentforce

  1. Enable Agentforce. Setup → Agentforce Agents. Requires Einstein generative AI in this org.
  2. Install the extension package. On Deploy → Agentforce, click Install in step 2. It registers the eight runtime actions and two ready-made topics — ContextWorks for runtime, ContextWorks Administration for the admin agent — each named exactly as the generated AgentScript expects.
  3. Add the topic to your agent in Agent Builder — or generate a complete agent from your live configuration. See Agentforce.
  4. Assign ContextWorks User to whoever the actions run as: every conversing user for an employee agent, the agent’s own user for a service agent.
  5. Ask it something. “What should I know about the Global Media account?” The agent should call Get Catalog, then Get Records, and answer from your curated fields and instructions.

Path B — MCP (Claude, or any MCP client)

Deploy → MCP walks you through it: an OAuth external client app, an MCP server in Setup → MCP Servers, the ContextWorks actions added to it as tools, and activation. Salesforce hosts the server; only the client connection lives outside the org. Point your client at the server’s endpoint and sign in.

Every tool call runs as the user who signed in, so context stays permission-correct per caller — a shared service account would throw that away. Assign ContextWorks User to each connecting user. Full steps: MCP.

Path C — Apex (Developer)

No agent needed. Call the engine directly from Flow, a Prompt Builder template, a scheduled job, or your own invocable. You can even run it straight from the Execute Anonymous window in the Developer Console:

// Paste into Developer Console → Debug → Open Execute Anonymous Window
Id accountId = [SELECT Id FROM Account LIMIT 1].Id;
String context = ctxl.Entity.load(accountId);
System.debug(context);

Whatever user the call runs as needs ContextWorks User. Set toolName on anything you build so Usage can tell your caller apart from the packaged actions. Full API: Apex API.

Verify it end to end

  1. Ask the agent something that needs a curated field — ideally one carrying an instruction.
  2. Check the answer reflects your curation, not generic Salesforce knowledge.
  3. Open Observe → Usage. A load should appear, with its Surface, Level, Format and token count.
  4. Open Observe → Issues. It should be empty. Any entry names the element or field that didn’t reach the payload.

If Usage shows nothing, the agent answered from something other than ContextWorks — usually the action was never reached, not that it failed.

What’s next

  • Building — the full configuration reference.
  • Deploying — the detail behind these paths.