feat: add support for agent tags#423
Conversation
WalkthroughAdded optional tags?: string[] to AgentLiveSchema. Introduced unit tests verifying client.configure accepts and transmits tags in settings. Updated example package.json to include cross-fetch as a devDependency. No other functional changes. Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant Client
participant Connection
App->>Client: configure({ tags: ["a","b"], ... })
Client->>Connection: send(JSON.stringify({ type: "Settings", ... , tags: ["a","b"] }))
Connection-->>Client: ack/continue
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #423 +/- ##
=======================================
Coverage 75.17% 75.17%
=======================================
Files 26 26
Lines 1152 1152
Branches 292 292
=======================================
Hits 866 866
Misses 286 286 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bf7a2fd to
bf7c88b
Compare
|
I validated the approach in JS and it was correct so this is ready for review @lukeocodes |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
examples/node-agent-live/index.js (1)
75-122: LGTM! Well-structured audio streaming with good lifecycle management.The implementation properly handles stream lifecycle, includes appropriate timeouts, and provides good error handling. The demonstration effectively showcases the tags feature integration.
Consider these minor improvements for production robustness:
- Make the stream duration configurable
- Add fallback audio sources in case the BBC stream is unavailable
- Add retry logic for network failures
+const STREAM_DURATION = process.env.STREAM_DURATION || 15000; +const AUDIO_SOURCES = [ + "http://stream.live.vc.bbcmedia.co.uk/bbc_world_service", + "https://example.com/fallback-stream" // Add fallback sources +];
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
examples/node-agent-live/index.js(1 hunks)examples/node-agent-live/package.json(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- examples/node-agent-live/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test Browser Builds
🔇 Additional comments (5)
examples/node-agent-live/index.js (5)
8-16: LGTM! Excellent defensive programming.The explicit API key validation with helpful error messages and usage instructions is a great improvement for the example. Early validation prevents confusing runtime errors later.
40-46: LGTM! Good error handling approach.The specific handling of timeout errors with appropriate fallback for other error types provides a better user experience and debugging information.
52-73: LGTM! Excellent demonstration of the new tags feature.The configuration correctly implements the new
tagsproperty at the root level as specified in the API. The example tags and comprehensive agent configuration provide a clear demonstration of the feature usage.
124-143: LGTM! Comprehensive event handling with great UX.The event handlers provide excellent visibility into the agent conversation lifecycle. The descriptive logging with emoji makes the example output clear and engaging for developers.
5-5: LGTM! Appropriate dependency for Node.js compatibility.Adding
cross-fetchensures compatibility across different Node.js versions where native fetch might not be available.
|
I fixed the agent example it runs successfully now and tags are sent correctly |
lukeocodes
left a comment
There was a problem hiding this comment.
remove the change to the example and then this is good
013d7d2 to
a55a3c9
Compare
|
@lukeocodes I updated the example from main, back to you. |
|
Closing as we'll opt to generate this feature from the API Spec in the next major release of this SDK. |
PR Summary: Add
tagsSupport to Agent SettingsTL;DR
Added
tagsfield toAgentLiveSchemato support request tagging for filtered searching. The field accepts an array of strings at the root level of agent configuration settings.Changes Made
Schema Updates
src/lib/types/AgentLiveSchema.tstags?: string[]field at root level ofAgentLiveSchemainterfaceagentobject) per API specificationTest Coverage
tests/unit/live-client-message-handling.test.tsAPI Usage
Implementation Details
Schema Structure
Validation
tags?:)string[])tags: [])Testing Results
What types of changes does your code introduce to the community JavaScript SDK?
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
Summary by CodeRabbit