Skip to main content

Modules

Nexus

Strategy engine — analyse a page and synthesise an extraction program

2 min read


Nexus analyses a page and synthesises an extraction program for it. Use it when you don't know which modules to use or the page has a complex structure. It works on HTML you pass in: fetch the page first (for example with evadr.fetch). Running a strategy through Nexus is not offered yet.

analyze

page = client.evadr.fetch("https://example.com")
if not page.success or not page.html:
    raise SystemExit(page.error or f"login page: discovery {page.discovery_id}")
result = client.nexus.analyze("https://example.com", html=page.html)
print(result.page_type, result.confidence, result.strategy)
const page = await client.evadr.fetch('https://example.com');
if (!page.success || page.html === null) throw new Error(page.error ?? 'no HTML (login page?)');
const result = await client.nexus.analyze('https://example.com', page.html);

Result fields: url, page_type, confidence, strategy, perception_id, reasoning_id, artifact_id. The raw API sends the artifact as an object, artifact: {artifact_id, type}; the SDKs flatten it to artifact_id.

synthesize

plan = client.nexus.synthesize(
    "https://example.com",
    html=page.html,
    goal="extract product names and prices",
)
print(plan.strategy_id, plan.strategy_name, plan.program)

Result fields: url, goal, strategy_id, strategy_name, strategy_type, program (the generated extraction program), steps, confidence, synthesis_time_ms.

verify

check = client.nexus.verify(plan.strategy_id)
print(check.verified, check.safety_score, check.violations)

The API response has strategy_id, verified, violations, safety_score, status (verified or unsafe), safety_checks (every check made: property, passed, details), risk_score, verification_result_id and duration_ms.

Long requests

analyze and synthesize can take a while. If one is still running after about 85 seconds the API answers 202 with a job_id and a poll_url (/api/v1/organizations/{org_id}/handoff/{job_id}); poll it until status is completed (the response is in result) or failed. See Long fetches.

Next steps

Was this page helpful?