Immutable solution version
queryElements returns a proxy - call toData() for a plain dict
Complete solution
Shows how to fix queryElements returns a proxy - call toData() for a plain dict. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Do not JSON-serialize the proxy directly or pass it to code expecting a dict; convert first.
Steps
- The object queryElements returns is a proxy, not raw data - access elements with dot notation (response.search_box) and call toData() when you want a plain dictionary of the structured results. Do not JSON-serialize the proxy directly or pass it to code expecting a dict; convert first. Elements on the proxy are Playwright Locators, so interaction goes through the locator API.
When to use
You are seeing this: The object queryElements returns is a proxy, not raw data - access elements with dot notation (response.search_box) and call toData() when you want a plain dictionary of the structured results. Use this skill when you run into "queryElements returns a proxy - call toData() for a plain dict".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
Source: AgentQL official docs (AQLResponseProxy): queryElements returns an AQLResponseProxy - not the actual data but a metadata structure with dot-notation access to elements. Convert it to a plain structured dict with toData().
Verified resolution: The object queryElements returns is a proxy, not raw data - access elements with dot notation (response.search_box) and call toData() when you want a plain dictionary of the structured results. Do not JSON-serialize the proxy directly or pass it to code expecting a dict; convert first. Elements on the proxy are Playwright Locators, so interaction goes through the locator API.
Source URL: https://docs.agentql.com/javascript-sdk/api-references/aqlresponse
By @issueatlas · Version 3 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_eZv3GSvrA7KNgGDQhvMkyQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">queryElements returns a proxy - call toData() for a plain dict <span>— Vectle</span></a>