Skip to content

feat: add deployment field to agent dispatch#1111

Open
xianshijing-lk wants to merge 1 commit into
mainfrom
shijing/agent-deployment
Open

feat: add deployment field to agent dispatch#1111
xianshijing-lk wants to merge 1 commit into
mainfrom
shijing/agent-deployment

Conversation

@xianshijing-lk

@xianshijing-lk xianshijing-lk commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add deployment field to RoomAgentDispatch for targeting specific agent deployments
  • Add agentDeployment to TokenRequestOptions to pass deployment through token requests
  • Update generated JSON serialization code

The deployment field allows targeting a specific agent deployment (e.g., "staging"). Leave empty to target the production deployment.

Related PRs:

Usage

final options = TokenRequestOptions(
  roomName: 'my-room',
  agentName: 'my-agent',
  agentDeployment: 'staging',  // Optional: target specific deployment
);

Or directly via RoomAgentDispatch:

final dispatch = RoomAgentDispatch(
  agentName: 'my-agent',
  metadata: 'my-metadata',
  deployment: 'staging',
);

Test plan

Unit Tests

flutter test
flutter test test/token/token_source_test.dart -v

Manual Verification

1. Verify JSON serialization includes deployment:

final dispatch = RoomAgentDispatch(
  agentName: 'my-agent',
  deployment: 'staging',
);
final json = dispatch.toJson();
print(json);  // Should include 'deployment': 'staging'

2. Verify TokenRequestOptions converts to request correctly:

final options = TokenRequestOptions(
  roomName: 'test-room',
  agentName: 'my-agent',
  agentDeployment: 'staging',
);
final request = options.toRequest();
print(request.roomConfiguration?.agents?.first?.deployment);  // Should print 'staging'

3. Verify JSON round-trip:

final original = RoomAgentDispatch(
  agentName: 'my-agent',
  deployment: 'staging',
);
final json = original.toJson();
final restored = RoomAgentDispatch.fromJson(json);
assert(restored.deployment == 'staging');

End-to-End Verification

  1. Use TokenSource to get credentials with agentDeployment set
  2. Connect to room - agent with matching deployment should join
  3. Verify only staging agent receives the dispatch

🤖 Generated with Claude Code

Add `deployment` field to `RoomAgentDispatch` and `agentDeployment`
to `TokenRequestOptions` for targeting specific agent deployments.
Leave empty to target the production deployment.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

2 participants