I have the agent.ts file in which the agent defini...
# agents
b
I have the agent.ts file in which the agent defining is there and in route.ts I am making the connection for room and making the token for the agent but I want to send some custom data like agent name and instruction and if I am setting the metadata I and agent name in the RoomConfiguration then the agent is no longer joining the room and if he join he doesn't have the context of meta name and the name I'm setting please help been stuck at this from last 2 day
h
I think there is no need to call
await ctx.connect();
b
removed it but the agent still doesn't join and if i removed all the RoomConfiguration then agent will join with no agentname and metadata
h
for me, this works, I have different issue elsewhere, but at least this works and agent joins
Copy code
const metadata = JSON.stringify({
      userId: "some_id"
    });

const at = new AccessToken(API_KEY, API_SECRET, {
      identity: participantName,
    });

    at.addGrant({ roomJoin: true, room: roomName });

    const roomConfig = new RoomConfiguration({
      agents: [
        new RoomAgentDispatch({
          agentName: AGENT_NAME,
          metadata,
        }),
      ],
      departureTimeout: 180,
      emptyTimeout: 5,
    });

    at.roomConfig = roomConfig;
then
Copy code
const metadata = ctx.job.metadata ? JSON.parse(ctx.job.metadata) : {};
    const userId = metadata.userId;
b
nope when I tried adding the RoomAgentDispatch the agent doesn't get deploy is it becuse i am runining the agent locally using node agent.ts ?
found something I mean when I am try deploying it with agent name then it is not joining the call but with only metadata it does so if anyone can help with agent name that will be awesome
h
agent name have to be the same as here
Copy code
cli.runApp(
  new WorkerOptions({
    agent: fileURLToPath(import.meta.url),
    agentName: AGENT_NAME,
  })
);
b
thx @happy-night-10979 for the fix