From 43a135e9ddc9b60c808340e30a963b316d6e4954 Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Mon, 23 Feb 2026 18:04:23 +0100 Subject: [PATCH] add gents section to current version --- .../version-0.25.0/tutorials/agents.mdx | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/versioned_docs/version-0.25.0/tutorials/agents.mdx b/versioned_docs/version-0.25.0/tutorials/agents.mdx index 03a5ba3e..dfd1b7e0 100644 --- a/versioned_docs/version-0.25.0/tutorials/agents.mdx +++ b/versioned_docs/version-0.25.0/tutorials/agents.mdx @@ -126,6 +126,66 @@ However, it's likely that in your scenario you'll want to use the [Selective Sub +### Multiple Agents in a Room + +You can create multiple agents inside a single room by creating agents with the same room ID multiple times. +Each agent operates independently, with its own set of tracks and callbacks. + + + + + ```ts + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + const fishjamId = ''; + const managementToken = ''; + const fishjamClient = new FishjamClient({ fishjamId, managementToken }); + const room = await fishjamClient.createRoom(); + + import type { AgentCallbacks, PeerOptions } from '@fishjam-cloud/js-server-sdk'; + + const agentOptions = { + subscribeMode: 'auto', + output: { audioFormat: 'pcm16', audioSampleRate: 16000 } + } satisfies PeerOptions; + + const agentCallbacks = { + onError: console.error, + onClose: (code, reason) => console.log('Agent closed', code, reason) + } satisfies AgentCallbacks; + + // ---cut--- + const agentCallbacks1 = { + onError: console.error, + onClose: (code, reason) => console.log('Agent 1 closed', code, reason) + } satisfies AgentCallbacks; + + const agentCallbacks2 = { + onError: console.error, + onClose: (code, reason) => console.log('Agent 2 closed', code, reason) + } satisfies AgentCallbacks; + + const { agent: agent1 } = await fishjamClient.createAgent(room.id, agentOptions, agentCallbacks1); + const { agent: agent2 } = await fishjamClient.createAgent(room.id, agentOptions, agentCallbacks2); + ``` + + + + + + ```python + from fishjam import FishjamClient + + fishjam_client = FishjamClient(fishjam_id, management_token) + + agent1 = fishjam_client.create_agent(room_id) + agent2 = fishjam_client.create_agent(room_id) + ``` + + + + + ### Making the Agent speak Apart from just listening, agents can also send audio data to peers.