from exa_py import Exa
exa = Exa()
run = exa.agent.runs.create(
query="Find wireless noise-cancelling headphones under $300 with pricing from multiple merchants.",
data_sources=[{"provider": "affiliate"}],
output_schema={
"type": "object",
"required": ["products"],
"properties": {
"products": {
"type": "array",
"maxItems": 10,
"items": {
"type": "object",
"required": ["name", "brand", "price", "merchant"],
"properties": {
"name": {"type": "string"},
"brand": {"type": "string"},
"price": {"type": "string", "description": "price with currency"},
"merchant": {"type": "string"},
},
},
}
},
},
)
run = exa.agent.runs.poll_until_finished(run.id)