Skip to content

Commit e84e131

Browse files
xianshijing-lkclaudeMaxHeimbrock
authored
Add deployment field to agent dispatch in TokenSource (#318)
* Add deployment field to agent dispatch in TokenSource Add support for targeting specific agent deployments when using TokenSource: - Add AgentDeployment property to TokenSourceFetchOptions - Add Deployment field to AgentDispatch class - Include deployment in BuildRequest when any agent field is set Leave deployment empty to target the production deployment. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add AgentDeployment also to the token config GUI --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Max Heimbrock <43608204+MaxHeimbrock@users.noreply.github.com>
1 parent fbebfd6 commit e84e131

5 files changed

Lines changed: 17 additions & 2 deletions

File tree

Editor/TokenSourceComponentConfigEditor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,6 @@ private void DrawConnectionOptions()
5959
EditorGUILayout.PropertyField(serializedObject.FindProperty("_participantAttributes"), true);
6060
EditorGUILayout.PropertyField(serializedObject.FindProperty("_agentName"));
6161
EditorGUILayout.PropertyField(serializedObject.FindProperty("_agentMetadata"));
62+
EditorGUILayout.PropertyField(serializedObject.FindProperty("_agentDeployment"));
6263
}
6364
}

Runtime/Scripts/TokenSource/TokenSource.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private static TokenSourceRequest BuildRequest(TokenSourceFetchOptions options)
140140
request.ParticipantAttributes = null;
141141
}
142142

143-
if (!string.IsNullOrEmpty(options.AgentName) || !string.IsNullOrEmpty(options.AgentMetadata))
143+
if (!string.IsNullOrEmpty(options.AgentName) || !string.IsNullOrEmpty(options.AgentMetadata) || !string.IsNullOrEmpty(options.AgentDeployment))
144144
{
145145
request.RoomConfig = new RoomConfig
146146
{
@@ -149,7 +149,8 @@ private static TokenSourceRequest BuildRequest(TokenSourceFetchOptions options)
149149
new AgentDispatch
150150
{
151151
AgentName = NullIfEmpty(options.AgentName),
152-
Metadata = NullIfEmpty(options.AgentMetadata)
152+
Metadata = NullIfEmpty(options.AgentMetadata),
153+
Deployment = NullIfEmpty(options.AgentDeployment)
153154
}
154155
}
155156
};

Runtime/Scripts/TokenSource/TokenSourceComponent.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ private static TokenSourceFetchOptions Coalesce(TokenSourceComponentConfig confi
107107
ParticipantAttributes = participantAttributes,
108108
AgentName = Coalesce(options?.AgentName, config.AgentName),
109109
AgentMetadata = Coalesce(options?.AgentMetadata, config.AgentMetadata),
110+
AgentDeployment = Coalesce(options?.AgentDeployment, config.AgentDeployment),
110111
};
111112
}
112113

Runtime/Scripts/TokenSource/TokenSourceComponentConfig.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public class TokenSourceComponentConfig : ScriptableObject
4242
[SerializeField] private List<StringPair> _participantAttributes;
4343
[SerializeField] private string _agentName;
4444
[SerializeField] private string _agentMetadata;
45+
[SerializeField] private string _agentDeployment;
4546

4647
public TokenSourceType TokenSourceType => _tokenSourceType;
4748

@@ -64,6 +65,7 @@ public class TokenSourceComponentConfig : ScriptableObject
6465
public List<StringPair> ParticipantAttributes => _participantAttributes;
6566
public string AgentName => _agentName;
6667
public string AgentMetadata => _agentMetadata;
68+
public string AgentDeployment => _agentDeployment;
6769

6870
public bool IsValid => _tokenSourceType switch
6971
{

Runtime/Scripts/TokenSource/TokenSourceData.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ public class TokenSourceFetchOptions
1515
public Dictionary<string, string> ParticipantAttributes { get; init; }
1616
public string AgentName { get; init; }
1717
public string AgentMetadata { get; init; }
18+
/// <summary>
19+
/// Optional deployment to target. Leave empty to target the production deployment.
20+
/// </summary>
21+
public string AgentDeployment { get; init; }
1822
}
1923

2024
class TokenSourceRequest
@@ -51,6 +55,12 @@ class AgentDispatch
5155

5256
[JsonProperty("metadata", NullValueHandling = NullValueHandling.Ignore)]
5357
public string Metadata;
58+
59+
/// <summary>
60+
/// Optional deployment to target. Leave empty to target the production deployment.
61+
/// </summary>
62+
[JsonProperty("deployment", NullValueHandling = NullValueHandling.Ignore)]
63+
public string Deployment;
5464
}
5565

5666
/// <summary>

0 commit comments

Comments
 (0)