Skip to content

Add instruction parts support#1500

Open
rosetta-livekit-bot[bot] wants to merge 1 commit into
claude/port-instruction-api-js-pNpnnfrom
unjustly-sciatic-cur
Open

Add instruction parts support#1500
rosetta-livekit-bot[bot] wants to merge 1 commit into
claude/port-instruction-api-js-pNpnnfrom
unjustly-sciatic-cur

Conversation

@rosetta-livekit-bot
Copy link
Copy Markdown
Contributor

Summary

  • Add modality-aware Instructions content and preserve it through chat context/provider formatting.
  • Export beta workflow InstructionParts for modular workflow prompt customization.
  • Preserve instruction content for realtime/remote/test formatting paths.

Verification

  • pnpm build:agents
  • pnpm build:plugins
  • pnpm format:check
  • pnpm lint (passes with existing warnings)

Notes

  • pnpm api:check currently fails on existing repo configuration issues (api-extractor.json missing in some plugin packages; agents API Extractor rejects existing export * as syntax).
  • No tests added, matching the source change.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 13, 2026

🦋 Changeset detected

Latest commit: 77af8b5

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

This PR includes changesets to release 31 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-cerebras Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-fishaudio Patch
@livekit/agents-plugin-google Patch
@livekit/agents-plugin-hedra Patch
@livekit/agents-plugin-hume Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-liveavatar Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-minimax Patch
@livekit/agents-plugin-mistral Patch
@livekit/agents-plugin-mistralai 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-runway 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 found 1 potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Reference equality (===) on Instructions objects prevents realtime session reuse

At agents/src/voice/agent_activity.ts:603, this.agent.instructions === newActivity.agent.instructions uses strict equality (===). Previously instructions was always a string, so === performed value comparison (e.g., "hello" === "hello" is true). Now that instructions can be an Instructions class instance, === performs reference equality for objects — two separate Instructions instances with identical content will compare as false. This causes reusable to be false when midSessionInstructionsUpdate is not supported, forcing an unnecessary realtime session teardown and recreation during agent transitions, even when the instructions haven't actually changed.

(Refers to line 603)

Prompt for agents
In agents/src/voice/agent_activity.ts at line 603, the comparison `this.agent.instructions === newActivity.agent.instructions` uses reference equality for Instructions objects, which breaks value-based comparison that previously worked for strings. The fix should compare Instructions objects by their string representation (e.g. using `.toString()`) when they are not the same reference. One approach is to replace the `===` with a helper that does `a === b || (a.toString() === b.toString())`, or add an `equals()` method to the Instructions class and use it here. The comparison needs to preserve the existing string-vs-string value equality behavior while also handling Instructions-vs-Instructions and mixed cases correctly.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@rosetta-livekit-bot rosetta-livekit-bot Bot force-pushed the unjustly-sciatic-cur branch from a831a0d to 77af8b5 Compare May 13, 2026 22:33
@rosetta-livekit-bot rosetta-livekit-bot Bot changed the base branch from main to claude/port-instruction-api-js-pNpnn May 13, 2026 22:33
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.

1 participant