fix: document publish-only type validation and empty traces on --api-name preview - #322
Open
james-enperso wants to merge 1 commit into
Open
Conversation
…name preview
Three findings from wiring an Agent Script service agent to an apex://
invocable (API v67.0, sf CLI 2.145.6):
1. `sf agent validate authoring-bundle` returns success:true for an action
param with the wrong numeric type. Only the server-side check during the
publish step catches it, so a green validate is not evidence the action
I/O types are correct.
2. Apex Integer and Apex Decimal do not behave the same. An Integer param
as bare `number` is rejected at publish; a Decimal output as bare
`number` publishes and runs correctly. The existing "bare number fails
at publish in action inputs/outputs" note reads as universal, which
sends authors hunting for a complex type a Decimal does not need.
3. Preview started with --api-name writes trace files containing only {}.
Only the --authoring-bundle path produces readable traces. This is not
academic: a service agent cannot always be previewed via
--authoring-bundle, leaving --api-name as the only option and making the
"read the trace after every utterance" rule unsatisfiable. Documented a
discriminating-value fallback for that case.
All additive; no existing guidance removed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three gaps in the
agentforce-generatereference docs, each hit while wiring an Agent Scriptservice agent to an
apex://invocable. All changes are additive — no existing guidance isremoved or contradicted without evidence.
Changes
references/complex-data-types.mdsf agent validate authoring-bundlereturnssuccess: truefor an action param withthe wrong numeric type — the check is server-side and only runs at publish. Includes the verbatim
400 message, which names the exact fix and is worth reading rather than guessing.
Integerfrom ApexDecimal.references/agent-validation-and-debugging.md--api-namewrites trace files containing only{}; only--authoring-bundleproduces readable traces.Motivation
1. A green validate is not evidence of correct types. The existing "fails at publish" note is
right, but in practice authors run
sf agent validate, seesuccess: true, and reasonably assumethe bundle is sound. Naming the validate/publish split explicitly saves a publish-fix-republish
cycle.
2.
IntegerandDecimaldiffer. The current "Key insight" reads as universal:Observed on API v67.0 /
sfCLI 2.145.6:Integer(input and output)numberlightning__integerTypeDecimal(output)numberThe
Decimalcase held across two separate agents. Taken literally, the current wording sendsauthors looking for a complex type a
Decimaldoes not need. The decision tree'slightning__doubleTypeentry has been left in place — this PR adds the observation alongside itrather than overriding it, since inputs and
flow://targets were not exercised here.3. The trace rule can be unsatisfiable.
agent-validation-and-debugging.mdis emphatic, andrightly so:
But
--api-namepreviews write{}. That is fine when--authoring-bundleis available — except aservice agent cannot always be previewed that way (on a restricted network that path was
unreachable while
--api-nameworked), which leaves the only usable preview path producing notrace. Without a documented fallback the honest options are to skip verification or to overstate
the evidence. The added technique closes that gap: test against records whose values an LLM could
not guess, ideally ones that exercise a distinctive code path in the action implementation.
Concrete example from this work — an invocable falls back to
Date.today().year()when a recordhas no transactions. The agent reported that fallback year for exactly such a record, which is not
something the model could have produced without executing the Apex.
Notes
sfCLI 2.145.6 against a single Enterprise Edition org. Happy tonarrow the wording if the
Decimalbehaviour is version- or org-shaped rather than general.skills/is edited.plugins/builder/salesforce-development/skills/holds an identicalcopy, but recent history shows it is produced by the release workflow rather than hand-edited, so
it is left alone — glad to mirror the change if maintainers prefer.
#trace-evaluationin the same file.