diff --git a/.changeset/agent-deployment-docs.md b/.changeset/agent-deployment-docs.md new file mode 100644 index 000000000..929df7e14 --- /dev/null +++ b/.changeset/agent-deployment-docs.md @@ -0,0 +1,5 @@ +--- +"livekit-api": patch +--- + +Add deployment field documentation for agent dispatch diff --git a/examples/agent_dispatch/src/main.rs b/examples/agent_dispatch/src/main.rs index 96bf8c368..c22b48fdf 100644 --- a/examples/agent_dispatch/src/main.rs +++ b/examples/agent_dispatch/src/main.rs @@ -25,6 +25,10 @@ struct Args { /// Registered agent name to dispatch #[arg(long, default_value = "my-agent")] agent_name: String, + + /// Optional deployment to target. Leave empty to target production deployment. + #[arg(long, default_value = "")] + deployment: String, } #[tokio::main] @@ -36,10 +40,13 @@ async fn main() { // Instantiate the AgentDispatch service client let client = AgentDispatchClient::with_api_key(&host, &args.api_key, &args.api_secret); - // Create a dispatch for the given agent into the room + // Create a dispatch for the given agent into the room. + // The `deployment` field can be used to target a specific agent deployment. + // Leave empty to target the production deployment. let req = proto::CreateAgentDispatchRequest { agent_name: args.agent_name, room: args.room_name, + deployment: args.deployment, ..Default::default() }; diff --git a/livekit-api/src/services/agent_dispatch.rs b/livekit-api/src/services/agent_dispatch.rs index 902cee627..a2a0bd45d 100644 --- a/livekit-api/src/services/agent_dispatch.rs +++ b/livekit-api/src/services/agent_dispatch.rs @@ -46,7 +46,9 @@ impl AgentDispatchClient { /// To use explicit dispatch, your agent must be registered with an `agent_name`. /// /// # Arguments - /// * `req` - Request containing dispatch creation parameters + /// * `req` - Request containing dispatch creation parameters. The request can include + /// an optional `deployment` field to target a specific agent deployment. + /// Leave empty to target the production deployment. /// /// # Returns /// The created agent dispatch object