Skip to content

Add AgentforceScorer function feature - #165

Draft
eyudashkin-cpu wants to merge 2 commits into
forcedotcom:mainfrom
eyudashkin-cpu:feat/agentforce-scorer-w-24740772
Draft

eyudashkin-cpu wants to merge 2 commits into
forcedotcom:mainfrom
eyudashkin-cpu:feat/agentforce-scorer-w-24740772

Conversation

@eyudashkin-cpu

Copy link
Copy Markdown

Draft. Do not merge or release yet. The deploy part only works once the Data Cloud platform accepts the AgentforceScorer invoke option and its feature gate is open. Until then, a deploy would be rejected. The types, template and local run work today. This PR is open now so the request/response contract can be reviewed early.

Summary

Adds AgentforceScorer, a new function feature for scoring a single Agentforce session. The scorer receives the session tracing detail view and returns open-ended scorer outputs.

datacustomcode init my_scorer --code-type function --use-in-feature AgentforceScorer
datacustomcode run my_scorer/payload/entrypoint.py --test-with my_scorer/payload/tests/test.json

Changes

  • Types: new function/feature_types/agentforce_scorer.py with AgentforceScorerV1Request / AgentforceScorerV1Response, following the chunking.py conventions (V1 names, Field(description=...), extra="ignore").
    • Request: python_scorer_input: AgentforceScorerV1SessionTracingDetailView, made up of sessionState, actors, metrics and runs. Each run has messages and an agentLoop.steps.
    • Response: outputs: List[AgentforceScorerV1Output], where each output has label, value and is_passed.
    • Field names stay in the wire format (camelCase). The free-text fields (message, step input/output/attributes) are capped at 100,000 characters.
  • Template: new templates/function/agentforce_scorer/ with a typed entrypoint.py, config.json and requirements.txt. test.json is generated from the request model.
  • constants.py: registers the template folder and maps both type names to AgentforceScorer for deploy-time inference. Also adds FUNCTION_INVOKE_OPTIONS_FEATURES and FUNCTION_USE_IN_FEATURE_DEFAULT.
  • init: unknown function features are now rejected. Before, a typo silently produced the chunking template.
  • deploy: AgentforceScorer is sent as invokeOptions: ["AgentforceScorer"], which routes to the v67.0 endpoint. The legacy functionInvokeOptions field only accepts UnstructuredChunking. SearchIndexChunking behaves as before.

Testing

  • New tests/test_agentforce_scorer.py (8 tests) covers:
    • parsing, defaults and serialization of the types
    • init scaffolding, test.json generation and feature inference
    • rejection of unknown features
    • running the template entrypoint
    • both deploy routes: invokeOptions for the scorer, functionInvokeOptions for chunking
  • Full suite on Python 3.11: 707 passed.
  • black and isort are clean on the changed files.
  • Manual check: init → run --test-with returns {"outputs": [{"label": "user_turns", "value": "1", "is_passed": true}]}.
  • Not tested: a real deploy against an org, which is blocked as described in the note above.

W-24740772

🤖 Generated with Claude Code

@salesforce-cla

salesforce-cla Bot commented Nov 4, 2026

Copy link
Copy Markdown

Thanks for the contribution! It looks like @eyudashkin-cpu is an internal user so signing the CLA is not required. However, we need to confirm this.

@eyudashkin-cpu
eyudashkin-cpu force-pushed the feat/agentforce-scorer-w-24740772 branch from d34872b to 9751bdb Compare November 4, 2026 10:44
@eyudashkin-cpu

Copy link
Copy Markdown
Author

@salesforce-cla recheck

Add AgentforceScorerV1Request/AgentforceScorerV1Response Pydantic types for
scoring an Agentforce session (session tracing detail view in, open-ended
scorer outputs out), and an agentforce_scorer function template, so
`datacustomcode init --code-type function --use-in-feature AgentforceScorer`
scaffolds a typed scorer entrypoint with a generated test.json.

init now rejects unknown function features instead of silently falling back
to the chunking template. deploy infers AgentforceScorer from the entrypoint
types and sends it via invokeOptions (v67.0), since the legacy
functionInvokeOptions field only accepts UnstructuredChunking.

W-24740772

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eyudashkin-cpu
eyudashkin-cpu force-pushed the feat/agentforce-scorer-w-24740772 branch from 9751bdb to eddbf8a Compare November 4, 2026 10:47
Matches the camelCase wire format used by the other scorer fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant