Skip to content

Add experimentScoreMiddleware() that adds step.score()#1451

Draft
jpwilliams wants to merge 1 commit intomainfrom
step-score-experiment
Draft

Add experimentScoreMiddleware() that adds step.score()#1451
jpwilliams wants to merge 1 commit intomainfrom
step-score-experiment

Conversation

@jpwilliams
Copy link
Copy Markdown
Member

@jpwilliams jpwilliams commented Apr 9, 2026

Summary

Adds experimentalScoreMiddleware() which gives access to step.score(), allowing us to start testing scoring with experimentation dashboards.

import { experimentScoreMiddleware, Inngest } from "inngest";

const inngest = new Inngest({
  id: "test",
  middleware: [experimentScoreMiddleware()],
});

inngest.createFunction(
  { id: "test-fn", triggers: [{ event: "test/event" }] },
  async ({ step }) => {
    await step.score("accuracy", 0.9);

    await step.score("performance", async () => {
      // some expensive scoring logic

      return 52352;
    });
  },
);

Temporal scoring can be dogfooded using some grim code:

const scoreP = (async () => {
  const gotAThing = await step.waitForEvent();
  return step.score("got-it", Boolean(gotAThing)); 
})();

// ... rest of the fn ...

await scoreP;

Checklist

  • Added a docs PR that references this PR N/A Experiment
  • Added unit/integration tests N/A Experiment
  • Added changesets if applicable

@jpwilliams jpwilliams self-assigned this Apr 9, 2026
@jpwilliams jpwilliams added ✨ new New features, integrations, or exports prerelease/inngest Create snapshot releases for a PR for the "inngest" package. 🧪 experimental The addition of a new experimental API, feature, or fix. labels Apr 9, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 9, 2026

⚠️ No Changeset found

Latest commit: 4fdafe0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@inngest-release-bot inngest-release-bot added the 📦 inngest Affects the `inngest` package label Apr 9, 2026
@inngest-release-bot
Copy link
Copy Markdown
Collaborator

A user has added the prerelease/inngest label, so this PR will be published to npm with the tag pr-1451. It will be updated with the latest changes as you push commits to this PR.

You can install this prerelease version with:

npm install inngest@pr-1451

The last release was built and published from 4fdafe0.

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

Labels

🧪 experimental The addition of a new experimental API, feature, or fix. 📦 inngest Affects the `inngest` package ✨ new New features, integrations, or exports prerelease/inngest Create snapshot releases for a PR for the "inngest" package.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants