01Chapter 1: What the Agent API is and when to use itThe Agent API is an HTTP interface that lets software outside Salesforce hold a conversation with an Agentforce agent. Your application authenticates, opens a session, exchanges messages, and closes the session. The agent runs its topics, actions, and instructions as it would in any other channel.5 min read
02Chapter 2: Preparing the agent: activate it and find its IDThis chapter covers the first practical step of any Agent API integration: making sure the agent can accept calls, and getting the identifier you will put in every session request. It assumes you know basic REST and HTTP, can read short Python or curl examples, and have a Salesforce org with Agentfo6 min read
03Chapter 3: Creating an External Client App with the right scopesThis chapter assumes you can read short curl and Python examples and know what an OAuth 2.0 access token is. It also assumes you have a Salesforce org with Agentforce enabled and an agent you can activate. By the end you will have an External Client App (ECA) that an outside system can use to reques6 min read
04Chapter 4: How the client credentials flow and run-as user workThis chapter assumes you know what an OAuth 2.0 access token is and can read short Python and curl examples. It also assumes you have an External Client App with OAuth enabled, from the previous chapter. Here you will learn what happens when your external system asks Salesforce for a token. You will5 min read
05Chapter 5: Requesting an access token from your My DomainThis chapter covers the single HTTP call that turns your External Client App credentials into a bearer token. It also covers what that call depends on and how it fails.5 min read
06Chapter 6: Understanding the session lifecycleThis chapter assumes you can already get an access token from your My Domain, as covered in the previous chapters. You should also know the agent ID of an activated agent and be comfortable reading short Python and HTTP examples. Here you will learn what a session is, how it moves through its states5 min read
07Chapter 7: Creating a sessionA session is the conversation container that every later call refers to. In this chapter you will build the HTTP request that creates one, learn what each field in the body does, and read the response. Sending messages and ending the session are covered in later chapters.5 min read
08Chapter 8: Sending a message and getting a replyThis chapter covers the synchronous message call: you send one message to an open session and wait for the agent's full reply in a single HTTP response. It assumes you can already get an access token and create a session, as covered in earlier chapters. You should also be comfortable with REST calls5 min read
09Chapter 9: Reading the response and message typesThis chapter assumes you can already create a session and send a synchronous message, as covered in the previous chapters. You should also be comfortable with Python dictionaries and JSON. Here you will learn what the reply body contains, how to tell the message types apart, and how to write a parse5 min read
10Chapter 10: Ending the sessionThis chapter assumes you can already obtain an access token, create a session, and send a message, as covered in the earlier chapters. It focuses on closing the session you opened, and on what can go wrong when you don't.6 min read
11Chapter 11: Streaming replies as they are generatedThis chapter assumes you can already get an access token, create a session, and send a synchronous message, as covered in earlier chapters. You should also be comfortable reading short Python and curl examples.5 min read
12Chapter 12: Passing variables and context to the agentAn agent often needs facts that the user never typed: the customer's account ID, the language of the app, or the page they are on. This chapter shows how to send those facts with the Agent API, and what to expect when you do.5 min read
13Chapter 13: Handling expired tokens, errors and retriesThis chapter assumes you can already request an access token, create a session, send a message and end the session. It covers what happens when those calls fail, and how to retry safely without sending duplicate messages or leaking sessions.5 min read
14Chapter 14: Protecting secrets and limiting accessThis chapter covers how to keep the credentials for your Agent API integration safe, and how to limit the damage if something goes wrong. It assumes you have already built the earlier pieces: an External Client App, a client credentials token request, and a session that sends messages. You should al6 min read
15Chapter 15: Testing and troubleshooting the integrationYou have now built every piece of the integration: token request, session creation, messaging, streaming, and cleanup. This chapter covers how to verify that these pieces work together and how to find the cause when they don't.5 min read