Plasmate Plugin for Dify

April 11, 2026 ยท View on GitHub

Plasmate is an agent-native browser engine that converts HTML to Semantic Object Model (SOM) - a structured JSON representation that is 10-100x smaller than raw HTML while preserving semantic meaning.

This plugin integrates Plasmate with Dify, enabling your LLM applications to browse the web efficiently.

Features

  • fetch_page - Fetch any web page as structured semantic content (JSON, text, markdown, or links)
  • extract_text - Extract readable text content from a page (ideal for summarization)
  • extract_links - Extract all URLs from a page (perfect for crawling and research)

Why Plasmate?

Traditional web scraping returns raw HTML, which is:

  • Bloated with markup, styles, and scripts
  • Expensive to process with LLMs (high token count)
  • Difficult for models to parse accurately

Plasmate's Semantic Object Model (SOM) solves this by:

  • Reducing content size by 10-100x
  • Preserving semantic structure (navigation, main content, forms)
  • Providing element IDs for interaction
  • Optimizing output for LLM consumption

Installation

Option 1: Install from Dify Marketplace

  1. Go to Plugins in your Dify workspace
  2. Search for "Plasmate"
  3. Click Install

Option 2: Manual Installation

  1. Clone this repository:

    git clone https://github.com/plasmate-labs/dify-plasmate.git
    cd dify-plasmate
    
  2. Package the plugin:

    dify plugin package ./
    
  3. Upload to Dify:

    • Go to Plugins in your Dify workspace
    • Click Upload Plugin
    • Select the generated .difypkg file

Configuration

The plugin supports two modes of operation:

  1. Get an API key from plasmate.app/dashboard
  2. In Dify, go to Plugins > Plasmate > Settings
  3. Enter your API key

Mode 2: Local CLI

If you have Plasmate installed locally:

  1. Install Plasmate CLI:

    # macOS
    brew install plasmate-labs/tap/plasmate
    
    # Or download from https://plasmate.app
    
  2. Leave the API key field empty - the plugin will automatically use the local CLI

  3. (Optional) Specify a custom CLI path in settings if plasmate is not in your PATH

Usage

In Dify Workflows

  1. Add a Tool node to your workflow
  2. Select Plasmate > Fetch Page (or Extract Text / Extract Links)
  3. Configure the parameters:
    • URL: The web page to fetch
    • Format: json, text, markdown, or links
    • Selector: Optional filter (main, nav, #element-id)

Example: Research Agent

# Workflow: Research a topic
1. User Input: "Research the latest AI developments"
2. Tool (Plasmate Extract Text):
   - URL: https://news.ycombinator.com
   - Selector: main
3. LLM: Summarize the top stories
4. Output: Summary to user

Example: Web Crawler

# Workflow: Crawl documentation
1. User Input: "Index the Dify docs"
2. Tool (Plasmate Extract Links):
   - URL: https://docs.dify.ai
   - Selector: nav
3. Loop: For each link
   - Tool (Plasmate Fetch Page)
   - Store in knowledge base

Tool Reference

fetch_page

Fetch a web page and convert it to structured content.

ParameterTypeRequiredDescription
urlstringYesURL to fetch
formatselectNoOutput format: json (default), text, markdown, links
selectorstringNoFilter to region: main, nav, header, footer, #id
timeoutnumberNoTimeout in ms (default: 30000)

extract_text

Extract readable text from a web page.

ParameterTypeRequiredDescription
urlstringYesURL to fetch
selectorstringNoFilter to region: main, nav, header, footer, #id
timeoutnumberNoTimeout in ms (default: 30000)

Extract all links from a web page.

ParameterTypeRequiredDescription
urlstringYesURL to fetch
selectorstringNoFilter to region: main, nav, header, footer, #id
timeoutnumberNoTimeout in ms (default: 30000)

Semantic Selectors

Plasmate supports semantic region filtering:

SelectorDescription
mainMain content area
nav / navigationNavigation links
headerPage header
footerPage footer
asideSidebar content
formForm elements
dialogModal dialogs
#element-idSpecific HTML element by ID

Token Savings

Example token counts for common pages:

PageRaw HTMLPlasmate SOMSavings
News article~50,000~3,00094%
Documentation~30,000~2,00093%
E-commerce~80,000~5,00094%
Search results~40,000~2,50094%

Support

License

Apache 2.0 - see LICENSE