agentconfigupdate duplicates the same content as o...
# ask-ai
w
agentconfigupdate duplicates the same content as of system instructions in chat items
✅ 1
t
Thanks for reaching out, Test. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m sorry you’re seeing duplicated content. I’m here to help get this sorted. To investigate the “agentconfigupdate duplicates the same content as system instructions in chat items” issue I need a bit more detail. Could you please tell me: • Where exactly you see the duplication? (web app, mobile app, API logs, server-side chat history, or another place) • The exact sequence that leads to the duplicated content (step‑by‑step or a short repro). • A copy or screenshot of one example chat item showing the duplicate (redact any sensitive data). • The LiveKit product/version or SDK you’re using, and any recent changes to agent config code or deployments. • Whether this happens every time
agentconfigupdate
runs or only intermittently. • If you control the code that emits
agentconfigupdate
, paste the snippet that publishes the update (or describe how it’s triggered). With those details I can: • Reproduce the problem or narrow down whether it’s client-side rendering vs. duplicate messages being stored/posted. • Suggest targeted fixes (for example: de-dup logic, message-id checks, or avoiding echoing system instructions when applying config updates). • Provide step-by-step debugging commands or code recommendations. If you prefer, start by pasting one redacted chat item and the code path that triggers
agentconfigupdate
and I’ll review it and point out the most likely causes. , with interactive elements
w
the content of chat item is same
t
Thanks — I appreciate the follow-up. I hear you: the chat item content is identical (the system instructions are being duplicated when
agentconfigupdate
runs). I want to help you get this fixed quickly. To diagnose whether the duplication is coming from the client UI, the server emitting duplicate messages, or the storage layer, please provide any of the following you can share: • Where you observe the duplicate content (choose one): web app UI, mobile app UI, server logs, database/chat history, or API responses. • One redacted example of the chat item that shows the duplicate (or a screenshot). Redact any sensitive fields. • The exact sequence to reproduce (step-by-step). For example: 1) open room, 2) run
agentconfigupdate
, 3) observe chat item. • Whether the duplicate appears immediately or after a refresh/reconnect. • Whether this happens every time or only sometimes. • The SDK or product version you’re running (e.g., Web SDK vX, Server SDK vY) and any recent changes to agent config or message-handling code. • If your system code triggers
agentconfigupdate
, please paste the short snippet that emits the event or describe how it’s published (redact secrets). Relevant details: message id generation, whether you attach the same
id
or timestamp, and whether you call the same publish function twice. • Any server logs around the time of the event (timestamps help). What I’ll do once you share those: • Confirm whether duplicate messages are being produced server-side or duplicated by the client. • Suggest targeted fixes (for example: dedup using message IDs/timestamps, ensure single emission of
agentconfigupdate
, or preventing system instruction echo on clients). • Provide step-by-step debugging commands or a code example for dedup logic if you want. If it’s easiest, paste one redacted chat item and the code that triggers
agentconfigupdate
and I’ll review it and point out likely causes and quick fixes. , with interactive elements
w
when agent_config_update type item is added to chat items
t
Thanks — I appreciate the clear update. I’m with you: the duplicate appears when an
agent_config_update
chat item is added, and we need to determine whether the duplication originates from the server, the client, or during storage/serialization. To troubleshoot quickly, please provide any of the following you can share (each will help me pinpoint the cause): • Where you see the duplicate (pick one): web UI, mobile UI, API response, server logs, or database/chat history. • One redacted example of the chat item as JSON (or a screenshot). Redact any secrets or personal data. I’m specifically looking for fields like
type
,
content
,
role
,
id
, and timestamps. • The exact steps to reproduce (short sequence). Example: 1) join room, 2) call publish/update, 3) chat item appears duplicated. • Whether duplication is immediate or only after refresh/reconnect. • Whether it happens every time or intermittently. • SDK/product and version you’re using (e.g., Web SDK vX, Server SDK vY). • If you emit the
agent_config_update
event from your code: paste the minimal snippet that publishes it (redact secrets). Important details: how you set `id`/timestamp, whether you call the publish function more than once, and whether you attach system instruction text when publishing. • Any server logs or timestamps around the event (two entries with same timestamp would indicate duplicate emission). What I’ll do after you share this: • Confirm whether duplicate entries are produced server-side or duplicated by the client renderer. • Recommend a targeted fix (for example: dedupe by message
id
, ensure single emission of the update, or avoid echoing system instructions to chat items). • Provide a short code example or steps to implement deduplication if needed. If it’s easiest, paste one redacted chat item JSON and the code that triggers
agent_config_update
and I’ll review it immediately and point to the most likely cause. , with interactive elements
w
are agent_config_update item types sent to llm or they are filtred?
t
Thanks — good question. Regarding
agent_config_update
items: they are included in the conversation history and sent to the LLM (they are not automatically filtered out). These items (which contain fields like
instructions
,
tools_added
, and
tools_removed
) are added when you update an agent’s tools or instructions so the LLM can see configuration changes. If you need to keep those updates out of a copied/serialized history, you can explicitly exclude them by using
exclude_config_update=True
when calling
chat_ctx.copy()
. If you want, tell me whether you’d like: • guidance on preventing duplicate UI/chat entries for these updates, or • a short code example showing how to copy history without config updates (using
exclude_config_update=True
). Sources: Function tool definition | LiveKit Documentation, with interactive elements
w
should we exclude them or include
t
Good question — whether to include
agent_config_update
items depends on what you need the LLM to know and the tradeoffs you’re willing to accept. Here’s a short guide to help you decide, plus the practical option to exclude them when desirable. When to include
agent_config_update
• You want the LLM to be aware of runtime changes to an agent’s instructions or toolset (important in multi-agent workflows or when agent behavior must adapt). • You need full auditability of configuration changes in the conversation history. • You accept the extra tokens and possible longer context so the model has that configuration context. When to exclude
agent_config_update
• You want to reduce token usage / keep prompts concise. • The config updates are only relevant for system bookkeeping and not helpful for the model’s next response. • You’re seeing UI duplication or noise in stored/serialized chats and prefer to keep the user-visible history clean. How to exclude them • When copying or serializing the chat context, use
exclude_config_update=True
with
chat_ctx.copy()
to omit these items from the copied history. Recommendation (best practice) • Default: include
agent_config_update
when configuration changes affect the agent’s behavior that the LLM should consider (e.g., tool additions/removals, instruction updates in multi-agent flows). • If the updates are only operational metadata, or you are trying to limit tokens or avoid UI duplication, exclude them when generating model input or building user-facing transcripts. If you like, I can: • Show a short code example of copying context without config updates. • Help decide for your specific flow if you paste a typical
AgentConfigUpdate
example or describe how you use those updates., with interactive elements