Circular structure to JSON when using Agent Builder

I’m a new user to the LiveKit platform and I’m attempting to use the Agent Builder UI. When attempting to add data collection fields or editing the call ending, I get “Something went wrong” with this trace in the console:

TypeError: Converting circular structure to JSON
--> starting at object with constructor 'N'
|     property 'fieldInfo' -> object with constructor 'Object'
|     property 'instructions' -> object with constructor 'Object'
|     ...
|     property 'options' -> object with constructor 'Object'
--- property 'form' closes the circle
at JSON.stringify ()
at 50fe1f748308c3a1.js?dpl=dpl_9USjcsKkwTiFt6XE9o83ewQwkmoh:1:4236
at av (bdb6c3a320e78e24.js?dpl=dpl_9USjcsKkwTiFt6XE9o83ewQwkmoh:1:63173)
at oG (bdb6c3a320e78e24.js?dpl=dpl_9USjcsKkwTiFt6XE9o83ewQwkmoh:1:83446)
at io (bdb6c3a320e78e24.js?dpl=dpl_9USjcsKkwTiFt6XE9o83ewQwkmoh:1:94878)
at sc (bdb6c3a320e78e24.js?dpl=dpl_9USjcsKkwTiFt6XE9o83ewQwkmoh:1:137899)
at bdb6c3a320e78e24.js?dpl=dpl_9USjcsKkwTiFt6XE9o83ewQwkmoh:1:137744
at ss (bdb6c3a320e78e24.js?dpl=dpl_9USjcsKkwTiFt6XE9o83ewQwkmoh:1:137752)
at u9 (bdb6c3a320e78e24.js?dpl=dpl_9USjcsKkwTiFt6XE9o83ewQwkmoh:1:133677)
at sH (bdb6c3a320e78e24.js?dpl=dpl_9USjcsKkwTiFt6XE9o83ewQwkmoh:1:159393)

I’ve attempted this in Chrome, Firefox and Edge with similar results. Is there something I’m doing wrong?

Welcome, @Steven_Bouldin. Nothing you’re doing wrong here. The trace shows JSON.stringify hitting a circular structure inside the Agent Builder’s own bundle when you add a data-collection field or edit the call ending, and it repros across Chrome/Firefox/Edge, so it’s a client-side bug in the Builder UI, not your input. The Builder is the in-browser prototyping tool [ docs.livekit.io/agents/start/builder ], so there’s nothing config-side for you to fix; best to report it to LiveKit Cloud support so they can patch the dashboard.

To keep moving meanwhile, both of those features exist in the Agents SDK in code, data collection via prebuilt tasks [ docs.livekit.io/agents/prebuilt/tasks/get-email ] and call ending via EndCallTool [ docs.livekit.io/agents/prebuilt/tools/end-call-tool ]:

from livekit.agents import Agent
from livekit.agents.beta.workflows import GetEmailTask
from livekit.agents.beta.tools import EndCallTool

# data collection, inside a @function_tool on your agent:
email = (await GetEmailTask(chat_ctx=self.chat_ctx)).email_address

# call ending:
end = EndCallTool()
agent = Agent(instructions="...", tools=end.tools)

As of this morning, we believe this is an issue with Agent Builder and a fix is in-flight. The fix is in a private repo, so I can’t share it here I’m afraid.

Apologies for the inconvenience.

Got it. I’m assuming when you say you can’t share it, the fix is waiting to be deployed from the private repo resolving the issue in the builder? Can’t share what the fix is / where it is?

He just meant the change has been made in our website code, which is not open source. I looked into the change, and it seems there was an issue with some animation-related code on the website.

I see the PR for that code has been merged. Are you still seeing the issue? I am not 100% sure if it has been deployed yet.

Makes completely sense about the source. I am still seeing the issue but I completely understand how deployment timing and rollouts go. I’ll keep an eye out for the fix!

Just saw in the other thread a fixed was rolled out. And it has been fixed for me as well. Thanks all!