Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c06d638
fix: add agent preview start,send,end commands
WillieRuemmele Feb 5, 2026
4af0cf3
chore: snapshots and schemas
WillieRuemmele Feb 5, 2026
b6b86cc
chore: add cache to valid session/agent combo for send/end
WillieRuemmele Feb 5, 2026
08278c2
test: add UT/NUT
WillieRuemmele Feb 5, 2026
d4d876e
chore: refactor cache, src only
WillieRuemmele Feb 5, 2026
b1dbad7
test: fix UT
WillieRuemmele Feb 5, 2026
e4e2a30
chore: caching sessionid flag for send/end
WillieRuemmele Feb 6, 2026
085e742
chore: cache cleanup
WillieRuemmele Feb 6, 2026
8d3e807
feat: add 'agent preview sessions' to list sessions'
WillieRuemmele Feb 6, 2026
370f2e7
chore: fix end typing extra
WillieRuemmele Feb 6, 2026
fe7a3d5
chore: save api-name, not id
WillieRuemmele Feb 6, 2026
48cda5c
docs: update help/examples
WillieRuemmele Feb 6, 2026
8c2f894
chore: schemas and snapshots
WillieRuemmele Feb 6, 2026
2a2d74a
fix: teeny edit to existing "agent preview" messages file
jshackell-sfdc Feb 9, 2026
90c924e
fix: edit
jshackell-sfdc Feb 9, 2026
47040f0
Update agent preview send command documentation
jshackell-sfdc Feb 9, 2026
d5b27f5
Clarify agent preview sessions documentation
jshackell-sfdc Feb 9, 2026
5f929db
Revise agent preview session documentation
jshackell-sfdc Feb 9, 2026
c1e047f
Update agent preview sessions documentation
jshackell-sfdc Feb 9, 2026
7d23b41
chore: bump agents lib
EstebanRomero84 Feb 9, 2026
0d8f5b9
Clarify usage of session ID and API name flags
jshackell-sfdc Feb 9, 2026
e9f352b
Merge branch 'main' into wr/programmaticPreviewII
EstebanRomero84 Feb 9, 2026
a15af70
Clarify agent message sending command usage
jshackell-sfdc Feb 9, 2026
2a8866d
Fix wording for session ID usage in agent preview end
jshackell-sfdc Feb 9, 2026
8fffc2e
Enhance agent preview session instructions
jshackell-sfdc Feb 9, 2026
4dd5e0c
Clarify language in agent preview session instructions
jshackell-sfdc Feb 9, 2026
155b18e
Merge pull request #323 from salesforcecli/js/edit-messages
WillieRuemmele Feb 9, 2026
74145fd
test: rename NUT file
EstebanRomero84 Feb 10, 2026
a078908
chore: merge main, resolve conflicts
WillieRuemmele Feb 10, 2026
b2e9ef6
chore: switch live test target agent
WillieRuemmele Feb 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions command-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,47 @@
],
"plugin": "@salesforce/plugin-agent"
},
{
"alias": [],
"command": "agent:preview:end",
"flagAliases": [],
"flagChars": ["n", "o"],
"flags": ["api-name", "api-version", "authoring-bundle", "flags-dir", "json", "session-id", "target-org"],
"plugin": "@salesforce/plugin-agent"
},
{
"alias": [],
"command": "agent:preview:send",
"flagAliases": [],
"flagChars": ["n", "o", "u"],
"flags": [
"api-name",
"api-version",
"authoring-bundle",
"flags-dir",
"json",
"session-id",
"target-org",
"utterance"
],
"plugin": "@salesforce/plugin-agent"
},
{
"alias": [],
"command": "agent:preview:sessions",
"flagAliases": [],
"flagChars": [],
"flags": ["flags-dir", "json"],
"plugin": "@salesforce/plugin-agent"
},
{
"alias": [],
"command": "agent:preview:start",
"flagAliases": [],
"flagChars": ["n", "o"],
"flags": ["api-name", "api-version", "authoring-bundle", "flags-dir", "json", "target-org", "use-live-actions"],
"plugin": "@salesforce/plugin-agent"
},
{
"alias": [],
"command": "agent:publish:authoring-bundle",
Expand Down
47 changes: 47 additions & 0 deletions messages/agent.preview.end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# summary

End an existing programmatic agent preview session and get trace location.

# description

You must have previously started a programmatic agent preview session with the "agent preview start" command to then use this command to end it. This command also displays the local directory where the session trace files are stored.

The original "agent preview start" command outputs a session ID which you then use with the --session-id flag of this command to end the session. You don't have to specify the --session-id flag if an agent has only one active preview session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the "aiAuthoringBundles" metadata directory. Similarly, the published agent's API name is the same as its directory name under the "Bots" metadata directory.

# flags.session-id.summary

Session ID outputted by "agent preview start". Not required when the agent has exactly one active session. Run "agent preview sessions" to see the list of all sessions.

# flags.api-name.summary

API name of the activated published agent you want to preview.

# flags.authoring-bundle.summary

API name of the authoring bundle metadata component that contains the agent's Agent Script file.

# error.noSession

No agent preview session found. Run "sf agent preview start" to start a new agent preview session.

# error.multipleSessions

Multiple preview sessions found for this agent. Use the --session-id flag to identify a specific session. Sessions: %s

# output.tracesPath

Session traces: %s

# examples

- End a preview session of a published agent by specifying its session ID and API name ; use the default org:

<%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --api-name My_Published_Agent

- Similar to previous example, but don't specify a session ID; you get an error if the published agent has more than one active session. Use the org with alias "my-dev-org":

<%= config.bin %> <%= command.id %> --api-name My_Published_Agent --target-org my-dev-org

- End a preview session of an agent using its authoring bundle API name; you get an error if the agent has more than one active session.

<%= config.bin %> <%= command.id %> --authoring-bundle My_Local_Agent
2 changes: 1 addition & 1 deletion messages/agent.preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ When the session concludes, the command asks if you want to save the API respons

# flags.api-name.summary

API name of the published and active agent you want to interact with.
API name of the activated published agent you want to interact with.

# flags.authoring-bundle.summary

Expand Down
47 changes: 47 additions & 0 deletions messages/agent.preview.send.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# summary

Send a message to an existing agent preview session.

# description

You must have previously started a programmatic agent preview session with the "agent preview start" command to then use this command to send the agent a message (utterance). This command then displays the agent's response.

The original "agent preview start" command outputs a session ID which you then use with the --session-id flag of this command to send a message. You don't have to specify the --session-id flag if an agent has only one active preview session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the "aiAuthoringBundles" metadata directory. Similarly, the published agent's API name is the same as its directory name under the "Bots" metadata directory.

# flags.session-id.summary

Session ID outputted by "agent preview start". Not required when the agent has exactly one active session. Run "agent preview sessions" to see list of all sessions.

# flags.utterance.summary

Utterance to send to the agent, enclosed in double quotes.

# flags.api-name.summary

API name of the activated published agent you want to preview.

# flags.authoring-bundle.summary

API name of the authoring bundle metadata component that contains the agent's Agent Script file.

# error.noSession

No agent preview session found. Run "sf agent preview start" to start a new agent preview session.

# error.multipleSessions

Multiple preview sessions found for this agent. Use the --session-id flag to identify a specific session. Sessions: %s

# examples

- Send a message to an activated published agent using its API name and session ID; use the default org:

<%= config.bin %> <%= command.id %> --utterance "What can you help me with?" --api-name My_Published_Agent --session-id <SESSION_ID>

- Similar to previous example, but don't specify a session ID; you get an error if the agent has more than one active session. Use the org with alias "my-dev-org":

<%= config.bin %> <%= command.id %> --utterance "What can you help me with?" --api-name My_Published_Agent --target-org my-dev-org

- Send a message to an agent using its authoring bundle API name; you get an error if the agent has more than one active session:

<%= config.bin %> <%= command.id %> --utterance "what can you help me with?" --authoring-bundle My_Local_Agent
27 changes: 27 additions & 0 deletions messages/agent.preview.sessions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# summary

List all known programmatic agent preview sessions.

# description

This command lists the agent preview sessions that were started with the "agent preview start" command and are still in the local cache. Use this command to discover specific session IDs that you can pass to the "agent preview send" or "agent preview end" commands with the --session-id flag.

Programmatic agent preview sessions can be started for both published activated agents and by using an agent's local authoring bundle, which contains its Agent Script file. In this command's output table, the Agent column contains either the API name of the authoring bundle or the published agent, whichever was used when starting the session. In the table, if the same API name has multiple rows with different session IDs, then it means that you previously started multiple preview sessions with the associated agent.

# output.empty

No cached agent preview sessions found.

# output.tableHeader.agent

Agent (authoring bundle or API name)

# output.tableHeader.sessionId

Session ID

# examples

- List all cached agent preview sessions:

<%= config.bin %> <%= command.id %>
41 changes: 41 additions & 0 deletions messages/agent.preview.start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# summary

Start a programmatic agent preview session.

# description

This command outputs a session ID that you then use with the "agent preview send" command to send an utterance to the agent. Use the "agent preview sessions" command to list all active sessions and the "agent preview end" command to end a specific session.

Identify the agent you want to start previewing with either the --authoring-bundle flag to specify a local authoring bundle's API name or --api-name to specify an activated published agent's API name. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the "aiAuthoringBundles" metadata directory. Similarly, the published agent's API name is the same as its directory name under the "Bots" metadata directory.

When starting a preview session using the authoring bundle, which contains the agent's Agent Script file, the preview uses mocked actions by default. Specify --use-live-actions for live mode, which uses the real Apex classes, flows, etc, in the org for the actions.

# flags.api-name.summary

API name of the activated published agent you want to preview.

# flags.authoring-bundle.summary

API name of the authoring bundle metadata component that contains the agent's Agent Script file.

# flags.use-live-actions.summary

Use real actions in the org; if not specified, preview uses AI to simulate (mock) actions.

# output.sessionId

Session ID: %s

# examples

- Start a programmatic agent preview session by specifying an authoring bundle; uses mocked actions by default. Use the org with alias "my-dev-org":

<%= config.bin %> <%= command.id %> --authoring-bundle My_Agent_Bundle --target-org my-dev-org

- Similar to previous example but use live actions and the default org:

<%= config.bin %> <%= command.id %> --authoring-bundle My_Agent_Bundle --use-live-actions

- Start a preview session with an activated published agent:

<%= config.bin %> <%= command.id %> --api-name My_Published_Agent
19 changes: 19 additions & 0 deletions schemas/agent-preview-end.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/AgentPreviewEndResult",
"definitions": {
"AgentPreviewEndResult": {
"type": "object",
"properties": {
"sessionId": {
"type": "string"
},
"tracesPath": {
"type": "string"
}
},
"required": ["sessionId", "tracesPath"],
"additionalProperties": false
}
}
}
28 changes: 28 additions & 0 deletions schemas/agent-preview-send.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/AgentPreviewSendResult",
"definitions": {
"AgentPreviewSendResult": {
"type": "object",
"properties": {
"messages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"role": {
"type": "string"
}
},
"additionalProperties": false
}
}
},
"required": ["messages"],
"additionalProperties": false
}
}
}
25 changes: 25 additions & 0 deletions schemas/agent-preview-sessions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/AgentPreviewSessionsResult",
"definitions": {
"AgentPreviewSessionsResult": {
"type": "array",
"items": {
"type": "object",
"properties": {
"agentId": {
"type": "string"
},
"displayName": {
"type": "string"
},
"sessionId": {
"type": "string"
}
},
"required": ["agentId", "sessionId"],
"additionalProperties": false
}
}
}
}
16 changes: 16 additions & 0 deletions schemas/agent-preview-start.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/AgentPreviewStartResult",
"definitions": {
"AgentPreviewStartResult": {
"type": "object",
"properties": {
"sessionId": {
"type": "string"
}
},
"required": ["sessionId"],
"additionalProperties": false
}
}
}
Loading
Loading