Skip to content

feat: add UserData generic to JobProcess#1250

Merged
u9g merged 5 commits intomainfrom
jl/job-process-userdata-generic
Apr 14, 2026
Merged

feat: add UserData generic to JobProcess#1250
u9g merged 5 commits intomainfrom
jl/job-process-userdata-generic

Conversation

@u9g
Copy link
Copy Markdown
Contributor

@u9g u9g commented Apr 14, 2026

Allows users to define typed process-level userData instead of relying on unchecked index access and type assertions.

Description

Adds a UserData generic type parameter to JobProcess, JobContext, Agent, and defineAgent. Defaults to Record<string, unknown> so all existing code continues to work unchanged.

Changes Made

  • JobProcess<UserData>userData property is now typed as UserData instead of { [id: string]: unknown }
  • JobContext<ProcUserData> — threads the generic through proc, participant entrypoints, etc.
  • getJobContext<ProcUserData>() — accepts an optional generic to narrow the return type
  • Agent<ProcUserData> and defineAgent<ProcUserData>() — generic flows through entry and prewarm callbacks

Pre-Review Checklist

  • Build passes: All builds (lint, typecheck, tests) pass locally
  • AI-generated code reviewed: Removed unnecessary comments and ensured code quality
  • Changes explained: All changes are properly documented and justified above
  • Scope appropriate: All changes relate to the PR title, or explanations provided for why they're included
  • Video demo: A small video demo showing changes works as expected and did not break any existing functionality using Agent Playground (if applicable)

Testing

  • All 628 existing tests pass
  • Type tests in tool_context.type.test.ts pass
  • pnpm build:agents succeeds (including tsc declaration emit)
  • Make sure both restaurant_agent.ts and realtime_agent.ts work properly (for major changes)

Additional Notes

N/A


Note to reviewers: Please ensure the pre-review checklist is completed before starting your review.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 14, 2026

CLA assistant check
All committers have signed the CLA.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 14, 2026

🦋 Changeset detected

Latest commit: dc56a3f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 24 packages
Name Type
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-assemblyai Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-google Patch
@livekit/agents-plugin-hedra Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-mistral Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-phonic Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-sarvam Patch
@livekit/agents-plugin-silero Patch
@livekit/agents-plugins-test Patch
@livekit/agents-plugin-trugen Patch
@livekit/agents-plugin-xai Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@u9g u9g force-pushed the jl/job-process-userdata-generic branch 3 times, most recently from 8b71ff6 to de3e378 Compare April 14, 2026 13:51
u9g added 2 commits April 14, 2026 09:53
Allows users to define typed process-level userData instead of relying
on unchecked index access and type assertions.
@u9g u9g force-pushed the jl/job-process-userdata-generic branch from de3e378 to 125361a Compare April 14, 2026 13:53
@theomonnom theomonnom requested a review from toubatbrian April 14, 2026 14:43
Comment thread .changeset/job-process-userdata-generic.md Outdated
Comment thread agents/src/job.ts Outdated
Copy link
Copy Markdown
Contributor

@toubatbrian toubatbrian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG! Feel free to merge

@u9g u9g merged commit 49f6e27 into main Apr 14, 2026
9 checks passed
@u9g u9g deleted the jl/job-process-userdata-generic branch April 14, 2026 21:43
@github-actions github-actions Bot mentioned this pull request Apr 14, 2026
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.

4 participants