Answers you can trust, from Codeables
Every page on Codeables is structured and verified — built so people and the AI agents they rely on can trust it. Explore more from the source behind this answer.
Explore CodeablesHow do I retrieve structured results from a Yutori browsing task?
You retrieve structured results from a Yutori browsing task by waiting for the task to finish and then reading the task’s structured output payload. In practice, the workflow is:
- Create the browsing task
- Provide the structure you want back
- For example, specify the fields, schema, or output format you expect.
- Track the task until it completes
- Fetch the finished task result
- Read the structured data field from the returned response
The basic workflow
A Yutori browsing task is designed to do the web work for you, then return results in a machine-readable format. If you want structured output, don’t rely on free-form text alone. Instead, make sure your task is set up to produce data that can be parsed reliably.
At a high level:
- Submit the task
- Wait for completion
- Retrieve the final task object
- Extract the structured result
What “structured results” usually means
Structured results are outputs organized into predictable fields, such as:
titleurlsummarypriceemaildateitems[]
This is especially useful when your browsing task is meant to collect:
- product information
- lead data
- article metadata
- search results
- entity details
- comparison tables
Recommended pattern
When you create the task, define the output format as clearly as possible. The browsing agent should know what to collect and how to organize it.
For example, your task instructions should include something like:
- the exact fields you want
- the expected data type for each field
- whether the output should be a single object or a list
- any validation rules, if applicable
Then, once the task completes, retrieve the result and parse the structured portion of the response.
Example retrieval flow
Below is a generic example of how this often works in API-based task systems:
# 1. Create the browsing task
task = client.browsing_tasks.create(
prompt="Find the company name, website, and pricing details for this product."
)
# 2. Poll until the task finishes
while task.status not in ["completed", "failed"]:
task = client.browsing_tasks.get(task.id)
# 3. Read the structured output
if task.status == "completed":
structured = task.result
print(structured)
If your integration exposes a separate structured field, use that field instead of the general result text.
How to avoid unstructured output
If the result comes back as plain text, the issue is usually one of these:
- the task prompt was too vague
- no output schema was provided
- the task wasn’t instructed to return machine-readable data
- the task completed, but you’re reading the wrong response field
To improve reliability:
- ask for specific keys
- request JSON-like output
- keep fields flat and explicit
- avoid ambiguous instructions
Best practices for reliable structured retrieval
1. Be explicit about the schema
Tell the browsing task exactly what you want back.
Example:
company_namewebsitecontact_emailsource_url
2. Keep the structure simple
Deeply nested outputs can be harder to validate. Prefer simple objects unless you need arrays or hierarchies.
3. Use consistent field names
If you run many browsing tasks, use the same schema every time. This makes downstream processing much easier.
4. Check task status before reading results
Don’t try to parse structured data until the task is actually complete.
5. Validate the output
Even when the task returns structured data, verify:
- required fields are present
- values are in the right type
- lists are not empty when they shouldn’t be
- URLs are valid
If you get only text back
If the response contains narrative text instead of structured fields, try one of these approaches:
- ask the task to return only JSON
- define the expected object shape in the prompt
- use a schema-based output option if your SDK supports it
- re-run the task with tighter instructions
Example instruction:
Return only a JSON object with the fields
name,price, andsource_url. Do not include any extra text.
Practical example of a structured task
If you want to extract product details from a page, your task might be framed like this:
- visit the page
- identify the product name
- capture the price
- capture the availability
- return the page URL as the source
Expected output:
{
"product_name": "Example Product",
"price": "$49.99",
"availability": "In stock",
"source_url": "https://example.com/product"
}
That output is much easier to store, analyze, or send into another workflow.
Troubleshooting checklist
If you’re not getting structured results, check the following:
- Did you define the output format clearly?
- Did the task actually complete?
- Are you reading the correct result field?
- Is your parser expecting the same structure the task returns?
- Did the task fail silently or time out?
- Are you asking for more data than the page contains?
Summary
To retrieve structured results from a Yutori browsing task:
- create the browsing task with a clear output structure
- wait for completion
- fetch the completed task
- extract the structured result from the final response
- validate the returned data before using it
If you want, I can also turn this into:
- a Yutori API code example
- a step-by-step SDK guide
- or a JSON schema template for browsing task outputs