WeaveDocs
Weave Browser Engine

Research and Server

Research session manager and HTTP server for the Weave Browser Engine — multi-step research with persisted artefacts.

Purpose

Agent browser engine for fetch, parse, search, perceive, research, protocol routing, and HTTP serving.

This page follows the real source shape for Weave Browser Engine and explains the workflow a developer is likely to use first.

Developer workflow

Start from the smallest constructor or builder, perform one meaningful operation, inspect the returned state, then add the relevant policy, storage, or network integration. The examples below should be expanded whenever the crate API changes.

Primary types to know

  • DuckDuckGoEngine — libs/weave-browser-engine/src/search.rs
  • FetchOptions — libs/weave-browser-engine/src/fetch.rs
  • FetchRequest — libs/weave-browser-engine/src/serve.rs
  • HnsResolver — libs/weave-browser-engine/src/protocol.rs
  • HttpResolver — libs/weave-browser-engine/src/protocol.rs
  • HttpsResolver — libs/weave-browser-engine/src/protocol.rs
  • LocalPerceptionBackend — libs/weave-browser-engine/src/perceive.rs
  • PerceiveRequest — libs/weave-browser-engine/src/serve.rs
  • ProtocolRouter — libs/weave-browser-engine/src/protocol.rs
  • ResearchConfig — libs/weave-browser-engine/src/research.rs
  • ResearchRequest — libs/weave-browser-engine/src/serve.rs
  • SearchRequest — libs/weave-browser-engine/src/serve.rs

Example shape

use weave_browser_engine::research::{research, ResearchConfig};
use weave_browser_engine::serve;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // ResearchConfig fluently composes the deep-research pipeline: pick a
    // depth, source cap, verification toggle, and search backend.
    let config = ResearchConfig::new("Weave Strand replication")
        .depth(2)
        .max_sources(6)
        .verify(true)
        .engine("duckduckgo");

    let report = research(&config).await?;
    println!(
        "topic={} sources={} synthesis_chars={}",
        report["topic"].as_str().unwrap_or(""),
        report["sources"].as_array().map(|a| a.len()).unwrap_or(0),
        report["synthesis"].as_str().map(str::len).unwrap_or(0),
    );

    // Spawn the axum API surface that wraps fetch/search/perceive/research.
    tokio::spawn(async move { let _ = serve::serve("127.0.0.1:0").await; });
    Ok(())
}