How to

Dify x Brave Search: Supercharging AI Apps with Real-Time Search

Learn how to effortlessly integrate real-time search into your AI apps using the new Brave Search API plugin. Build intelligent agents, sophisticated workflows, and autonomous search capabilities—making your applications smarter and more responsive with Dify v1.0.0.

Leilei

Product Marketing

Written on

Mar 6, 2025

Share

Share to Twitter
Share to LinkedIn
Share to Hacker News

How to

·

Mar 6, 2025

Dify x Brave Search: Supercharging AI Apps with Real-Time Search

Learn how to effortlessly integrate real-time search into your AI apps using the new Brave Search API plugin. Build intelligent agents, sophisticated workflows, and autonomous search capabilities—making your applications smarter and more responsive with Dify v1.0.0.

Leilei

Product Marketing

Share to Twitter
Share to LinkedIn
Share to Hacker News

How to

Dify x Brave Search: Supercharging AI Apps with Real-Time Search

Learn how to effortlessly integrate real-time search into your AI apps using the new Brave Search API plugin. Build intelligent agents, sophisticated workflows, and autonomous search capabilities—making your applications smarter and more responsive with Dify v1.0.0.

Leilei

Product Marketing

Written on

Mar 6, 2025

Share

Share to Twitter
Share to LinkedIn
Share to Hacker News

How to

·

Mar 6, 2025

Dify x Brave Search: Supercharging AI Apps with Real-Time Search

Share to Twitter
Share to LinkedIn
Share to Hacker News

How to

·

Mar 6, 2025

Dify x Brave Search: Supercharging AI Apps with Real-Time Search

Share to Twitter
Share to LinkedIn
Share to Hacker News

Dify is an open-source platform designed to simplify AI application development. It offers an intuitive interface that brings together AI workflows, RAG pipelines, and agent capabilities, empowering developers to rapidly move from initial concept to production-ready applications.

With the introduction of Dify v1.0.0's robust plugin system, this guide will walk you through leveraging the Brave Search API plugin. Learn how to easily integrate real-time, accurate search functionality into your Dify AI applications, whether you're building Agents or Workflows.

Getting Started

  1. Get your Brave Search API key here.

  2. Choose your Dify setup:

Integrating Brave Search into your AI Apps

Locate the Brave Search API plugin within the Dify Marketplace, found under "Search Tools." Install and authorize the plugin to add search capabilities to your AI applications.

Creating a Search-Powered Agent

Building an agent empowered by search is quick and easy by combining Brave Search with a LLM. Here’s how:

  1. Navigate to Dify Studio: Go to the Dify Studio page and select "Create from Blank," then choose the "Agent" option.

  1. Define Agent Instructions: In the instructions field, clearly define your agent's role and, importantly, specify the scenarios in which it should use tools.

  2. Configure the Model: Install a model provider from the Marketplace and select your preferred LLM. For instance, Claude-3.5 Sonnet is a great choice.

  3. Add the Brave Search Tool: Select "Brave Search" to activate search functionality for your agent.

  4. (Optional) Integrate Context: To provide your agent with specific knowledge, you can upload your local knowledge base.  Refer to the guide for detailed instructions.

  5. Test Your Agent: Once configured, you can immediately test your search-powered agent as shown below:

Building Search Workflows

For more sophisticated AI applications, Dify Workflows provide a structured and modular framework. Let's create a research assistant workflow as a practical example:

  1. Create a new Workflow: Build your workflow by chaining together LLMs and tools to achieve your desired search objective.

  2. LLM1 (Query Refinement): Add an LLM node (e.g., Claude-3.5 Sonnet). Configure this first LLM to refine initial user queries into precise and targeted search queries.

  3. Brave Search Node: Incorporate the "Brave Search" tool as a node. Connect the output of LLM1 (the refined query) to serve as the input for the Brave Search node.

  4. LLM2 (Report Generation): Add a second LLM node. This LLM will process the search results received from the Brave Search node. Configure it to summarize the key findings and generate a concise, informative report.

Dify Workflows offer a clear, step-by-step method for developing complex AI applications. For tasks that demand both structure and adaptability, consider incorporating Agent Nodes within your workflows.

Agent Nodes for Autonomous Search

For maximum flexibility and autonomous operation, integrate Brave Search directly into Agent Nodes. Agent Nodes are powerful, versatile components comprised of:

  • LLM (The Brain): The core reasoning engine of the Agent Node. It decides when to utilize tools and orchestrates the overall strategy.

  • Tools (Expanding Capabilities): Modules that extend the LLM's abilities. This is where Brave Search comes in, alongside other tools like image generators, web crawlers, and even your own custom-build tools.

  • Strategies (Governing Behavior): The framework that dictates how the LLM employs its tools. Dify supports popular strategies like Function Calling (as used in this example) and ReAct. You also have the flexibility to implement custom strategies using frameworks like LlamaIndex or LangGraph.

In this example, the Agent Node itself is a component within a larger workflow. It receives a refined query from a preceding LLM1, conducts searches using both Brave Search and Arxiv Search, compiles a report, and then delivers that report to designated Discord channels.

Deploying Your AI App

Once your AI application is complete, simply click "Publish" to deploy it as a web application, integrate it via APIs, or embed it directly into your website.

Extend Brave Search with Custom Plugins

Developers have the power to further extend the Brave Search tool by creating custom plugins. For example, you could build a scheduling plugin to automate tasks directly within your workflows.

For comprehensive instructions on plugin development, please refer to our documentation.

    On this page

    Related articles

    The Innovation Engine for Generative AI Applications

    The Innovation Engine for Generative AI Applications

    The Innovation Engine for Generative AI Applications