POST and records the response as feedback on that call. Use a remote scorer when your scoring logic can’t run in Weave, such as a policy check against internal data or a model you host yourself.
This page covers remote scorers for calls traced with @weave.op. To score agent turns in the Agents view, see Score agent turns with a remote scorer. You configure remote scorers with the Python SDK or the Weave UI. The TypeScript SDK doesn’t include RemoteScorer.
How remote scoring works
A call is scored in the following sequence:- A call to a monitored op ends.
- The scoring worker finds the active monitors whose operations include that op, then applies each monitor’s filter and sampling rate.
- For each
RemoteScoreron a matching monitor, the worker builds aschema_version: 1request that contains the call, resolves the scorer’s credentials, checks the endpoint URL against the allowed hosts, and sends thePOST. - The worker validates the response and writes the result as feedback on the call. It also records the scoring attempt as a call, whether or not the attempt succeeded.
weave.Evaluation and call.apply_scorer() don’t invoke it, and calling RemoteScorer.score() in your code raises NotImplementedError. Each selected call produces one request, sent once. If the request times out or gets no response, Weave doesn’t retry it. The default timeout is 30 seconds.
Enable remote scoring
Remote scoring is off until it’s enabled for your organization or deployment, and the scoring worker calls a scorer endpoint only if its host is on an allowlist. How you enable it depends on your deployment type. Multi-tenant Cloud An organization admin or billing admin enables remote scoring for the organization:- Open
https://wandb.ai/account-settings/[ORG]/settings, replacing[ORG]with the organization that owns your project. - Select the Remote scoring tab.
- Turn on Enable remote scoring.
- Under Allowed hosts, click Add host and enter each host that remote scorers may call. Leave the port blank to allow any port on that host. Saving with remote scoring enabled requires at least one host.
- Click Save settings.
weave_workers.remoteScoring. The chart renders them as environment variables on each worker that can call a remote scorer: the online evaluation worker, the call scoring worker, and the agent scoring worker.
Allowed host rules
The scoring worker checks every scorer endpoint URL, and separately the OAuth token endpoint URL when a scorer uses OAuth, against these rules:
- An entry matches an exact host, with an optional port. An entry without a port allows any port on that host.
- An entry that starts with
*.matches subdomains at any depth, but not the apex domain.*.corp.example.commatchesa.corp.example.comanda.b.corp.example.com, notcorp.example.com. The suffix after*.must contain at least two labels, so*.comis rejected. A wildcard can’t be combined with an IP address. - When both an operator allowlist and an organization allowlist exist, the URL must satisfy both. An empty operator allowlist adds no restriction. When no allowlist exists at all, the worker rejects every host.
- Loopback, private, internal, and cloud metadata addresses are rejected.
- HTTPS is required unless the deployment permits insecure HTTP.
- Redirects aren’t followed.
Build the scorer endpoint
Your endpoint accepts a JSONPOST from Weave and returns a JSON score.
Request
Weave sends one HTTPPOST per scored target to the scorer’s endpoint URL, with these headers:
Weave might deliver the same scoring attempt more than once. If your endpoint has side effects, use
Idempotency-Key to deduplicate. The key is stable for one request version, so a V1 and a V2 request for the same call carry different keys.
Every request body has these top-level fields:
Weave omits an optional field with no value rather than sending it as
null. Weave might add optional fields to a version without changing its number, so ignore fields you don’t recognize.
Request and response bodies are limited to 1 MiB each and contain JSON text only, never images, audio, or video. A target that exceeds these limits isn’t sent, so it isn’t scored. Each request carries one target.
For a call, schema_version is 1 and the scored call is at the top level under original_call:
Response
Return HTTP200 with a JSON object that has two fields:
schema_version: Integer equal to the request’sschema_version.result: One score object, a list of score objects, or an object of the form{"scores": [...]}.
Weave treats any non-
200 response as a scorer failure and records no feedback for that attempt. Weave doesn’t follow redirects, so a redirect is also a failure. Weave doesn’t parse the body of an error response. Return 4xx for requests your endpoint never accepts and 5xx for temporary problems.
For a call request, the response’s schema_version is 1. This response returns one rating and one tag:
Authenticate requests from Weave
Weave authenticates to your endpoint with a bearer token. The request carries no W&B credential. The token proves to your endpoint that the request came from Weave, not the reverse. EachRemoteScorer uses one of two modes:
Store the client secret or bearer token in the secret store of the team that owns the project before you register the scorer. The
RemoteScorer configuration holds only the secret name. The scoring worker resolves the value at scoring time.
The Weave UI also offers Deployment default, which stores no authentication configuration for the scorer and relies on a fallback credential set by the deployment operator. Multi-tenant Cloud sets no fallback credential. Use one of the two explicit modes.
Register a remote scorer
A remote scorer is aRemoteScorer object attached to a monitor. Create it with the Python SDK or in the Weave UI.
Python SDK
Publish aRemoteScorer, then activate a Monitor that lists it in scorers and names the ops to score in op_names. endpoint_url is required. config and auth_config are optional.
monitor.activate() publishes the monitor as active and expands bare op names into full op refs for the current project.
Weave UI
Create the remote scorer as part of a new monitor:- In the Weave project sidebar, click Monitors, then + New Monitor.
- Configure the monitor’s name, operations, filter, and sampling rate. For the fields, see Set up custom monitors.
- Under Scorer, select New remote scorer.
- Under Remote scorer configuration, configure the following fields:
- Scorer Name: Must start with a letter or number. Can contain letters, numbers, hyphens, and underscores.
- Scoring endpoint URL: The URL Weave sends the
POSTto. - Authentication: Static bearer or OAuth client credentials. Then enter the secret name and, for OAuth, the Token endpoint URL, Client ID, and optional Scope. Secret fields take team secret names, not values.
- Config (JSON, optional): A JSON object passed to your endpoint as
scorer.config.
- Click Create monitor.
Test the scorer
Trigger a scored call and confirm the result:- Call the monitored op at least once.
- Confirm that your endpoint received a request. Scoring is asynchronous, so the request arrives after the call ends.
- In the Traces tab, open the call and check its feedback.
original_call, and Weave records the result as feedback on that call.
Troubleshooting
Sample code
Theexamples/remote_scorer directory in the weave repository is the reference implementation of this contract and the source of truth for the sample code. It’s deployment independent: the Python service shows the contract, not a hosting recommendation. The sample includes the following files:
remote_scorer_app.py: A FastAPI app withGET /healthandPOST /scorethat accepts V1 and V2 requests.scoring_logic.py: Framework-independent request parsing and scoring, written to be copied into your own service.auth.py: A development-only bearer token check against theREMOTE_SCORER_DEV_BEARER_TOKENenvironment variable.register_remote_scorer.py: Publishes aRemoteScorerand activates aMonitorfor an op, or for agent turns with--agent-turn.trigger_test_trace.pyandtrigger_test_agent_turn.py: Create a traced call or an agent turn that a monitor can select.sample_request.json,sample_request_v2_call.json, andsample_request_v2_agent_turn.json: Example request bodies.
0.53.0 or later. A local run verifies only the contract. The Weave scoring worker rejects loopback addresses, and hosted deployments don’t permit insecure HTTP. To test with Weave, deploy the endpoint at an HTTPS URL on the allowed hosts and register it as described in Register a remote scorer.