Wraith Browser
Knowledge graph

Entity Resolution

Build a knowledge graph of entities discovered across browsing sessions -- companies, people, technologies, and their relationships

What the Knowledge Graph Does

As an AI agent browses the web, it encounters entities: companies, people, technologies, products, and locations. The knowledge graph lets you capture these entities and their relationships so the agent builds up structured understanding over time.

Unlike the page cache (which stores raw content) or embeddings (which store vectors), the knowledge graph stores structured facts: "Stripe is a company," "Stripe uses Rust," "Patrick Collison is CEO of Stripe." These facts persist across browsing sessions and can be queried, visualized, and merged.


entity_add

Add an entity to the knowledge graph with a name, type, and optional attributes.

Parameters:

ParameterTypeRequiredDescription
namestringyesEntity name (e.g., "Stripe", "Rust")
entity_typestringyesOne of: "company", "person", "technology", "product", "location", "other"
attributesobjectnoKey-value pairs for additional metadata

Example request:

{
  "tool": "entity_add",
  "arguments": {
    "name": "Stripe",
    "entity_type": "company",
    "attributes": {
      "founded": "2010",
      "headquarters": "San Francisco",
      "industry": "payments",
      "url": "https://stripe.com"
    }
  }
}

Example response:

{
  "name": "Stripe",
  "entity_type": "company",
  "attributes": {
    "founded": "2010",
    "headquarters": "San Francisco",
    "industry": "payments",
    "url": "https://stripe.com"
  },
  "created": true
}

If an entity with the same name already exists, its attributes are merged (new keys are added, existing keys are updated).


entity_relate

Create a directed relationship between two entities. Both entities must already exist in the graph.

Parameters:

ParameterTypeRequiredDescription
fromstringyesSource entity name
tostringyesTarget entity name
relationshipstringyesRelationship label (e.g., "uses", "employs", "competes_with", "acquired")

Example request:

{
  "tool": "entity_relate",
  "arguments": {
    "from": "Stripe",
    "to": "Rust",
    "relationship": "uses"
  }
}

Example response:

{
  "from": "Stripe",
  "to": "Rust",
  "relationship": "uses",
  "created": true
}

Relationship conventions

Relationships are free-form strings. Some common patterns:

RelationshipMeaningExample
usesTechnology adoptionStripe uses Rust
employsEmploymentStripe employs Patrick Collison
competes_withMarket competitionStripe competes_with Square
acquiredAcquisitionStripe acquired Paystack
founded_byFounder relationshipStripe founded_by Patrick Collison
located_inGeographic locationStripe located_in San Francisco
depends_onTechnical dependencyTokio depends_on mio
part_ofContainmentasync-std part_of Rust ecosystem

entity_query

Query the knowledge graph with a natural language question. The system matches the question against entity names, types, attributes, and relationships to return relevant facts.

Parameters:

ParameterTypeRequiredDescription
questionstringyesNatural language question

Example request:

{
  "tool": "entity_query",
  "arguments": {
    "question": "what do we know about Stripe?"
  }
}

Example response:

{
  "entities": [
    {
      "name": "Stripe",
      "entity_type": "company",
      "attributes": {
        "founded": "2010",
        "headquarters": "San Francisco",
        "industry": "payments",
        "url": "https://stripe.com"
      },
      "relationships": [
        { "to": "Rust", "relationship": "uses" },
        { "to": "Paystack", "relationship": "acquired" },
        { "to": "Patrick Collison", "relationship": "employs" },
        { "to": "Square", "relationship": "competes_with" }
      ]
    }
  ],
  "answer": "Stripe is a payments company founded in 2010, headquartered in San Francisco. It uses Rust, acquired Paystack, and competes with Square."
}

entity_merge

Merge two entities when you discover they refer to the same thing. The second entity is merged into the first: all attributes and relationships from entity B are transferred to entity A, and entity B is deleted.

Parameters:

ParameterTypeRequiredDescription
name_astringyesPrimary entity (survives the merge)
name_bstringyesEntity to merge into the primary (deleted after merge)

Example request:

{
  "tool": "entity_merge",
  "arguments": {
    "name_a": "Stripe",
    "name_b": "Stripe, Inc."
  }
}

Example response:

{
  "merged_into": "Stripe",
  "removed": "Stripe, Inc.",
  "attributes_gained": 0,
  "relationships_gained": 2
}

This is essential for deduplication. During browsing, the same entity often appears under slightly different names ("Stripe" vs. "Stripe, Inc." vs. "Stripe Payments"). Merging consolidates all their facts into a single node.


Fuzzy search for entities by name. Useful when you are not sure of the exact entity name or want to find all entities matching a pattern.

Parameters:

ParameterTypeRequiredDescription
querystringyesSearch query (fuzzy name match)

Example request:

{
  "tool": "entity_search",
  "arguments": {
    "query": "stri"
  }
}

Example response:

{
  "results": [
    {
      "name": "Stripe",
      "entity_type": "company",
      "score": 0.95
    },
    {
      "name": "String (Rust type)",
      "entity_type": "technology",
      "score": 0.62
    }
  ]
}

Find all entities connected to a given entity through any relationship, in either direction.

Parameters:

ParameterTypeRequiredDescription
namestringyesEntity name to find connections for

Example request:

{
  "tool": "entity_find_related",
  "arguments": {
    "name": "Rust"
  }
}

Example response:

{
  "entity": "Rust",
  "related": [
    { "name": "Stripe", "relationship": "uses", "direction": "incoming" },
    { "name": "Cloudflare", "relationship": "uses", "direction": "incoming" },
    { "name": "Tokio", "relationship": "part_of", "direction": "incoming" },
    { "name": "Mozilla", "relationship": "created_by", "direction": "outgoing" },
    { "name": "LLVM", "relationship": "depends_on", "direction": "outgoing" }
  ]
}

The direction field indicates whether the given entity is the source (outgoing) or target (incoming) of the relationship.


entity_visualize

Generate a Mermaid diagram of the entire knowledge graph (or a subset, for large graphs). The output is valid Mermaid syntax that can be rendered in any Mermaid-compatible viewer.

Parameters: None.

Example request:

{
  "tool": "entity_visualize",
  "arguments": {}
}

Example response:

{
  "mermaid": "graph LR\n  Stripe[\"Stripe\\n(company)\"]\n  Rust[\"Rust\\n(technology)\"]\n  Tokio[\"Tokio\\n(technology)\"]\n  Mozilla[\"Mozilla\\n(company)\"]\n  Stripe -->|uses| Rust\n  Tokio -->|part_of| Rust\n  Rust -->|created_by| Mozilla"
}

Rendered, this produces:

graph LR
  Stripe["Stripe\n(company)"]
  Rust["Rust\n(technology)"]
  Tokio["Tokio\n(technology)"]
  Mozilla["Mozilla\n(company)"]
  Stripe -->|uses| Rust
  Tokio -->|part_of| Rust
  Rust -->|created_by| Mozilla

Building a knowledge graph during research

Here is a realistic workflow for building a knowledge graph while researching a topic.

Step 1: Browse a page and extract entities

{
  "tool": "browse_navigate",
  "arguments": { "url": "https://stripe.com/about" }
}

Read the page content and identify entities.

Step 2: Add discovered entities

{
  "tool": "entity_add",
  "arguments": {
    "name": "Stripe",
    "entity_type": "company",
    "attributes": { "founded": "2010", "industry": "payments" }
  }
}
{
  "tool": "entity_add",
  "arguments": {
    "name": "Patrick Collison",
    "entity_type": "person",
    "attributes": { "role": "CEO" }
  }
}

Step 3: Create relationships

{
  "tool": "entity_relate",
  "arguments": {
    "from": "Stripe",
    "to": "Patrick Collison",
    "relationship": "founded_by"
  }
}

Step 4: Continue browsing and enriching

As the agent visits more pages, it adds new entities and relationships. Over time, the graph grows into a connected web of facts.

Step 5: Query the accumulated knowledge

{
  "tool": "entity_query",
  "arguments": {
    "question": "which companies use Rust?"
  }
}

Step 6: Visualize the graph

{
  "tool": "entity_visualize",
  "arguments": {}
}

The graph is an in-memory structure that persists for the lifetime of the server process. It is designed for session-scoped research tasks where the agent needs to track relationships across dozens or hundreds of pages.

On this page