I'm having trouble getting an agent implementation...
# agents
g
I'm having trouble getting an agent implementation that just transcribes all participants in a room. right now, my code only runs for the first participant that joins, and the agent leaves when that user leaves. how can I make it transcribe any participant that joins? feels like im missing a configuration step
I generate a JWT when a user joins the room:
Copy code
def livekit_token(video_grant: nil, sip_grant: nil)
    token = LiveKit::AccessToken.new(api_key: Rails.application.credentials.livekit.api_key!, api_secret: Rails.application.credentials.livekit.api_secret!)

    token.identity = self.hashid
    token.name = self.full_name

    token.video_grant = video_grant if video_grant.present?
    token.sip_grant = sip_grant if sip_grant.present?
    token.room_config = {
      agents: [
        {
          agentName: "stenographer",
          metadata: { participant_identity: self.hashid }.to_json
        }
      ]
    }

    token.to_jwt
  end
that seems to only work for the first participant to join the room though.
Copy code
{
  "level": 30,
  "time": 1765911658165,
  "pid": 46,
  "hostname": "deployment-p-2kd2aqoisur-ca-mpywkbmbkopd-65b657f948-4g7s9",
  "version": "0.1.0",
  "job": {
    "id": "AJ_2uRxmUjAWeGt",
    "type": "JT_ROOM",
    "room": {
      "sid": "RM_Vmn2uipAdLxd",
      "name": "development/AdMtkd/mG0hO2",
      "emptyTimeout": 300,
      "maxParticipants": 0,
      "creationTime": "1765911658",
      "turnPassword": "",
      "enabledCodecs": [
        {
          "mime": "audio/red",
          "fmtpLine": ""
        },
        {
          "mime": "video/H264",
          "fmtpLine": ""
        },
        {
          "mime": "video/VP8",
          "fmtpLine": ""
        },
        {
          "mime": "video/VP9",
          "fmtpLine": ""
        },
        {
          "mime": "video/AV1",
          "fmtpLine": ""
        },
        {
          "mime": "audio/opus",
          "fmtpLine": ""
        },
        {
          "mime": "audio/PCMU",
          "fmtpLine": ""
        },
        {
          "mime": "audio/PCMA",
          "fmtpLine": ""
        }
      ],
      "metadata": "",
      "numParticipants": 0,
      "activeRecording": false,
      "numPublishers": 0,
      "version": {
        "unixMicro": "1765911658063802",
        "ticks": 0
      },
      "departureTimeout": 20,
      "creationTimeMs": "1765911658060"
    },
    "namespace": "",
    "metadata": "{\"participant_identity\":\"1DahXM\"}",
    "agentName": "stenographer",
    "state": {
      "status": "JS_RUNNING",
      "error": "",
      "startedAt": "1765911658162381313",
      "endedAt": "0",
      "updatedAt": "1765911658162381313",
      "participantIdentity": "agent_HLvZRVyNngaU",
      "workerId": "CAW_3DN4X8GAWxwq",
      "agentId": "CA_mPYwkBmBkoPD"
    },
    "dispatchId": "AD_AosVTz9gn65N",
    "enableRecording": true
  },
  "resuming": false,
  "agentName": "stenographer",
  "msg": "received job request"
}
the other participants dont create an agent
g
I had, I originally was doing an approach like this but it seemed like it wasn't exiting properly. I ended up getting it working with one-agent-per-participant, I missed I had to set the JT_PARTICIPANT flag