AI Agents35% of the exam

Agent API for headless agent integrations

When to reach an agent over the Agent API instead of a channel, SDK or flow action, and how an integration works: external client app with client credentials, sessions with a session key, sequence IDs, synchronous versus streaming replies, bypassUser, and the documented limits.

Official exam objective
Given a scenario, identify when it's appropriate to use Agent API.

~6 min read · 13 practice questions ·

What the exam expects

  • Decide when the Agent API is the right way to reach an agent and when a channel connection, the Agentforce Mobile SDK, Enhanced Chat v2 or the flow/Apex invocable action fits better.
  • List the setup for a headless integration: external client app, client credentials flow, Run As user, token minted against My Domain.
  • Explain sessions, session keys, sequence IDs, synchronous versus streaming responses and the streaming events a client must handle.
  • Recall the documented constraints: Agentforce (Default) unsupported, 120-second timeout, credit consumption, Government Cloud endpoint, bypassUser.
  • Key terms: Agent API (REST API to start sessions, send and receive messages, and end sessions with an agent); external client app (the OAuth app that issues the API's access token); session key (a random UUID you supply to trace the conversation); sequenceId (a number that must increase with each message in a session); bypassUser (start-session flag choosing the agent's user or the token's user).

Key facts

What the API does
Detail
Start sessions, send and receive messages, end sessions over REST
Prerequisite
Detail
Agentforce enabled with at least one active agent
Token source
Detail
External client app, JWT-based token; Run As user with at least API Only
Token URL
Detail
My Domain URL, not the lightning.force.com domain
Session key
Detail
Random UUID you supply; traces the conversation in event logs
sequenceId
Detail
Increase it for each subsequent message in a session
bypassUser true
Detail
Uses the agent's assigned user; false uses the token's user
Streaming
Detail
Accept: text/event-stream; ProgressIndicator, TextChunk, Inform, EndOfTurn
Timeout
Detail
120 seconds, then HTTP 500
Unsupported agent type
Detail
Agentforce (Default)
In-platform alternative
Detail
Invocable action to chat with an agent from a flow or Apex class
Sources for this section (4)
  • When is the invocable action a better choice than the Agent API?
  • Why must a client increase sequenceId on every send?
  • What happens when an Agent API call runs longer than 120 seconds?
  • Why would you choose the synchronous endpoint?

The questions are free to read. Answers with their sources and self-grading are included with the pack.

Keep reading with the Agentforce Specialist pack

  • Core concepts
  • Exam traps
  • Worked scenario

The pack includes:

  • All 26 lessons of the Agentforce Specialist guide, with reading progress
  • Interactive decision walks and step-by-step sequence steppers
  • Inline practice questions and one-click topic practice (13 questions for this lesson)
  • An official source cited for every claim
  • An AI tutor that answers from the guide
  • Unlimited timed practice exams

Practice for the Agentforce Specialist exam