% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/postprocess__extract_agent_results.R
\name{extract_agent_results}
\alias{extract_agent_results}
\title{Extract Structured Data from Agent Traces}
\usage{
extract_agent_results(raw_output)
}
\arguments{
\item{raw_output}{Raw trace string from \code{asa_result$raw_output}, or a
structured JSON trace (asa_trace_v1) from \code{asa_result$trace_json}}
}
\value{
A list with components:
\itemize{
  \item search_snippets: Character vector of search result content
  \item search_urls: Character vector of URLs from search results
  \item wikipedia_snippets: Character vector of Wikipedia content
  \item json_data: Extracted JSON data (canonical by default; see option
    \code{asa.enable_trace_field_mining})
  \item json_data_canonical: Canonical terminal JSON extracted from trace
  \item json_data_inferred: Optional inferred JSON with trace-mining enabled
  \item search_tiers: Character vector of unique search tiers used
    (e.g., "primp", "selenium", "ddgs", "requests")
}
}
\description{
Parses raw agent output to extract search snippets, Wikipedia content,
URLs, JSON data, and search tier information. This is the main function
for post-processing agent traces.
}
\examples{
\dontrun{
result <- run_task("Who is the president of France?", agent = agent)
trace <- if (!is.null(result$trace_json) && nzchar(result$trace_json)) {
  result$trace_json
} else {
  result$raw_output
}
extracted <- extract_agent_results(trace)
print(extracted$search_snippets)
print(extracted$search_tiers)  # Shows which search tier was used
}

}
