From 59b8a108ac67c5a7f02c7aafb15cdbed815dca33 Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Fri, 20 Feb 2026 14:22:20 +0100 Subject: [PATCH 1/3] add multiple agents docs --- docs/tutorials/agents.mdx | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/docs/tutorials/agents.mdx b/docs/tutorials/agents.mdx index 1668f5d..bcd39b7 100644 --- a/docs/tutorials/agents.mdx +++ b/docs/tutorials/agents.mdx @@ -126,6 +126,56 @@ 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 calling `createAgent` multiple times with the same room ID. +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 { agent: agent1 } = await fishjamClient.createAgent(room.id, agentOptions, agentCallbacks); + const { agent: agent2 } = await fishjamClient.createAgent(room.id, agentOptions, agentCallbacks); + ``` + + + + + + ```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. From 63533a8a14d41d4f3646141a401922aead433036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Filimowski?= Date: Fri, 20 Feb 2026 14:29:40 +0100 Subject: [PATCH 2/3] Update docs/tutorials/agents.mdx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docs/tutorials/agents.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/agents.mdx b/docs/tutorials/agents.mdx index bcd39b7..c658c27 100644 --- a/docs/tutorials/agents.mdx +++ b/docs/tutorials/agents.mdx @@ -128,7 +128,7 @@ 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 calling `createAgent` multiple times with the same room ID. +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. From 843a0b48dd0b35ccd8895e0809375e031b1cd3a8 Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Mon, 23 Feb 2026 10:42:01 +0100 Subject: [PATCH 3/3] add review suggestion --- docs/tutorials/agents.mdx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/tutorials/agents.mdx b/docs/tutorials/agents.mdx index c658c27..6ddde34 100644 --- a/docs/tutorials/agents.mdx +++ b/docs/tutorials/agents.mdx @@ -155,8 +155,18 @@ Each agent operates independently, with its own set of tracks and callbacks. } satisfies AgentCallbacks; // ---cut--- - const { agent: agent1 } = await fishjamClient.createAgent(room.id, agentOptions, agentCallbacks); - const { agent: agent2 } = await fishjamClient.createAgent(room.id, agentOptions, agentCallbacks); + 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); ```