Skip to content

fix: update topic->subagent @W-21951412@ - #393

Merged
shetzel merged 3 commits into
mainfrom
wr/renameTopicToSubagent
Apr 20, 2026
Merged

shetzel merged 3 commits into
mainfrom
wr/renameTopicToSubagent

Conversation

@WillieRuemmele

@WillieRuemmele WillieRuemmele commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

updates tests only, surprisingly, to use updated agentscript

Org support coming 4/12

What issues does this PR fix or reference?

@W-21951412@

should be merged in tandem with: forcedotcom/agents#253

@shetzel shetzel left a comment

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.

NUTs are known to fail due to a server side issue.

@shetzel
shetzel merged commit 10f024d into main Apr 20, 2026
13 of 15 checks passed
@shetzel
shetzel deleted the wr/renameTopicToSubagent branch April 20, 2026 21:29
nico-pappagianis pushed a commit that referenced this pull request Nov 16, 2026
## What
Adds the command `sf agent mcp asset afscript -i <0Le server id> --tool
<name> [--asset-id <1XO id>]`. The command resolves the tool names and
asset ids on the MCP server, calls `McpAgentScript.generateActions`, and
prints the action blocks and reasoning entries. The text output is
indented for the `.agent` file (8 and 12 spaces). `--json` returns the
blocks without indentation. The help text says that the API also assigns
MCP runtime permissions.

## Why
The output is the same text that Agentforce Builder writes. A headless
`.agent` file gets the same key, `source` and `target` as Builder. On a
264 development org, all non-blank lines matched the Builder output.

## How tested
- `yarn build`, `yarn lint`, `yarn test`: exit 0, including the JSON
schema check.
- `test/commands/agent/mcp/mcp.test.ts`: 34 passing.
- Live run against the Core API on a 264 development org.
- Runtime check: an agent built from the output called the MCP tool in
Builder preview. The reasoner logged `MCP tool call success`.

## Dependency
This PR needs forcedotcom/agents#395 (same
change as #393) (adds `McpAgentScript.generateActions`). Before merge,
release `@salesforce/agents` and bump it in `package.json` (`^2.4.0` on
main today). This branch does not change `package.json` yet, so CI is
expected to fail until the bump.

## Notes
- The output lists all `--tool` values first, then all `--asset-id`
values.
- An org below API 68.0 gets a clear not-found message.
- Input errors exit with code 1. API errors exit with code 4.

🤖 Generated with [Claude Code](https://claude.com/claude-code)



Work item: @W-24729191@

Same change as #515. This copy comes from the fork of the internal
account `adharsh-salesforce`, to check the CLA.

## Update an authoring bundle (--authoring-bundle, --subagent)

From review feedback: instead of printing the blocks for someone to
paste, the command can now add them to a local authoring bundle.

`sf agent mcp asset afscript -o myOrg -i <0Le server id> --tool
hello_world --authoring-bundle My_Agent --subagent order_status
--subagent returns`

- The two flags need each other. Without them the command prints the
blocks as before.
- For each subagent (or the start agent), it adds each action block
under `actions:` (8 spaces) and each reasoning action under `reasoning:`
> `actions:` (12 spaces), the places Agentforce Builder uses. It creates
a missing `actions:`, `reasoning:` or reasoning `actions:` section.
- It skips an action key that the subagent already has, so a second run
changes nothing. The output lists what it added and skipped for each
subagent; `--json` adds a `bundle` field with the same data.
- It finds the bundle with `findAuthoringBundle` from
`@salesforce/agents` and writes the `.agent` file. It does not compile
it: compiling is a separate API, so run `sf agent validate
authoring-bundle` after it. (An earlier version compiled the bundle;
that blocked every run where the compile API is not reachable, such as
dev workspace orgs, and every agent that already had unrelated compile
errors.)
- The org comes from `--target-org`, like the other commands that work
on a bundle.

Tests: new `test/commands/agent/mcp/afscriptBundle.test.ts`: 7 tests for
the insert (existing sections, missing sections, idempotent second run,
other subagents unchanged, unknown subagent, start agent, CRLF) and 2
command tests (writes the file and does not call `Agent.init`; a second
run changes nothing). The 36 existing mcp tests still pass. I also ran
the insert on a real `.agent` file from an end-to-end test (it skipped
the action the subagent already had and added only the new one), and
live against a dev org on a workspace. `command-snapshot.json` and
`schemas/agent-mcp-asset-afscript.json` are updated for the new flags
and the `bundle` field.

All commits on this branch are signed now.

## End-to-end test (2026-11-16)

On a dev org with the Core API from 264.13, a headless Claude with the
agentforce-generate skill (updated in project-codey #4572) got "add the
MCP tool calculate_quote from the MCP server ComplexESTypeFinal to the
router of the agent P0Mcp_SkillTest, then validate and deploy it".

- It ran `sf agent mcp asset afscript -i <server> --tool calculate_quote
--authoring-bundle P0Mcp_SkillTest --subagent agent_router --json` and
made no hand edit to the `.agent` file. The command reported `added:
[<key>]`, `skipped: []`.
- The diff is +59 -0 lines, all inside `start_agent agent_router`. The
action block and the reasoning entry are byte-equal to the `--json`
output, and the key equals the tool's GenAiFunctionDefinition
DeveloperName.
- Deploy: Succeeded. In Builder Simulate the agent answered a quote
request; the reasoner logged `filtered 0 inaccessible actions` and `MCP
tool call success: <key>`.

Merge order: forcedotcom/agents#395 and its release, then this PR with
the `@salesforce/agents` bump, then the skill in project-codey #4572.
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.

2 participants