Sub topic 1
What an Agentforce agent is made of
Prerequisites
This chapter assumes basic command-line use, familiarity with Salesforce orgs and sandboxes, and a Salesforce DX project containing sfdx-project.json. You should also understand that an org is the Salesforce environment where metadata and configuration are stored. Git knowledge helps because agent definitions should be reviewed as source-controlled files.
Agentforce's working model
An Agentforce agent is a conversational application that interprets a user's request and selects an appropriate response path. A topic groups requests with a shared purpose, such as checking a support case. Topic instructions describe the boundaries and behavior for that purpose. An action is an operation the agent can call, such as querying a record, invoking Apex, or running a Flow.
The agent's behavior depends on the connection between these parts:
Keep the boundaries clear. Topics decide which kind of work is relevant. Actions perform specific work. Instructions guide the agent but do not replace permission checks or business validation in the action itself.
Setting up the Salesforce CLI
The Salesforce CLI, available through the sf command, is the local entry point for this workflow. Check the executable and the agent commands before changing an org:
sf --version
sf plugins
sf agent --helpRun these commands from a Salesforce DX project when you will save generated specifications alongside source code. Use a current CLI installation and keep the CLI and its plugins consistent across developer machines and CI runners. A common setup error is having sf installed but using an old plugin that does not expose the required agent commands.
Authorizing an org and checking permissions
Authorize the development org with a stable alias:
sf org login web --alias my-dev-org
sf org display --target-org my-dev-orgThe authenticated user needs access to the relevant Agentforce metadata and permissions for the actions the agent will call. Confirm that the alias points to the intended sandbox or development org before creating metadata. An alias prevents repeated login details, but it does not prevent deploying to the wrong org.
Generating an agent spec
An agent spec is a YAML description of the agent's role and context. Generate one after authorization:
sf agent generate agent-spec \
--type customer \
--role "Answer questions about the status of customer support cases" \
--company-name "Acme Support" \
--company-description "Acme provides hardware and support plans" \
--output-file specs/caseAgentSpec.yaml \
--target-org my-dev-orgReview the generated file before creation. Treat the role and company description as inputs to agent design, not as a substitute for topic instructions, action permissions, or tests.
Exercise
Which part should contain the operation that retrieves a case status: the topic instruction or an action?
Show answer
The action. The topic provides context and guidance, while the action performs the retrieval.