Skip to content

W-22203672: add hidden --agent-json flag to agent preview start#405

Open
andresrivas-sf wants to merge 3 commits intomainfrom
ar/W-22203672/agent-json-flag-preview-start
Open

W-22203672: add hidden --agent-json flag to agent preview start#405
andresrivas-sf wants to merge 3 commits intomainfrom
ar/W-22203672/agent-json-flag-preview-start

Conversation

@andresrivas-sf
Copy link
Copy Markdown
Contributor

Summary

@W-22203672@

  • Add hidden --agent-json flag to sf agent preview start accepting a file path to a pre-compiled AgentJSON
  • When provided, passes the parsed JSON to ScriptAgent via ScriptAgentOptions, skipping the compile step
  • Adds loadAgentJson() helper to keep run() complexity within lint limits
  • Add 2 new unit tests: happy path (parsed JSON passed to Agent.init) and error path (invalid JSON throws AgentJsonReadError)

Dependencies

Depends on forcedotcom/agents#271@salesforce/agents must be bumped after that merges.

Test plan

  • yarn test:only passes (244 tests)
  • Manually run sf agent preview start --authoring-bundle MyAgent --simulate-actions --agent-json /path/to/compiled.json --target-org myOrg and confirm session starts without a compile request

🤖 Generated with Claude Code

W-22203672

Adds a hidden --agent-json flag that accepts a file path to a
pre-compiled AgentJSON, bypassing the compile step in ScriptAgent.
Intended for internal developer testing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@andresrivas-sf andresrivas-sf requested a review from a team as a code owner April 28, 2026 17:22
Comment thread messages/agent.preview.start.md Outdated
Copy link
Copy Markdown
Contributor

@jshackell-sfdc jshackell-sfdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my small suggestion.

Co-authored-by: Juliet Shackell <63259011+jshackell-sfdc@users.noreply.github.com>
@EstebanRomero84
Copy link
Copy Markdown
Contributor

@andresrivas-sf few comments:

  • agentJSON is used only used when --authoring-bundle flag is used so can you add a dependsOn attribute i the new flag?
  • Should the new feature be also available in agent preview command?
  • Please add a NUT.

throw new SfError(
`Failed to read or parse --agent-json file '${filePath}': ${SfError.wrap(error).message}`,
'AgentJsonReadError'
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add telemetry logging similar to line 120?

W-22203672

- Apply jshackell's wording suggestion for flag summary
- Add dependsOn authoring-bundle to --agent-json flag
- Add telemetry for AgentJsonReadError
- Add --agent-json flag to interactive agent preview command
- Add NUT tests for --agent-json flag

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants