Build Your Own Perplexity
#Build your own Perplexity | Cerebras and Exa
Learn how to build a Perplexity-style deep research assistant that can automatically search the web, analyzes multiple sources, and provide structured insights in under 60 seconds.
Try out the full deep research chat here.
For this workshop, you'll need:
- Cerebras API: the fastest inference provider, get started for free here
- Exa API: The search engine for AI, get started for free here
If you have any questions, please reach out on the Cerebras Discord
Step #1: Environment Setup
First, let's install all the necessary libraries, import everything we need, and configure our API credentials.
Collecting exa-py Downloading exa_py-1.14.12-py3-none-any.whl.metadata (3.7 kB) Collecting cerebras-cloud-sdk Downloading cerebras_cloud_sdk-1.35.0-py3-none-any.whl.metadata (18 kB) Requirement already satisfied: requests>=2.32.3 in /usr/local/lib/python3.11/dist-packages (from exa-py) (2.32.3) Requirement already satisfied: typing-extensions>=4.12.2 in /usr/local/lib/python3.11/dist-packages (from exa-py) (4.14.0) Requirement already satisfied: openai>=1.48 in /usr/local/lib/python3.11/dist-packages (from exa-py) (1.87.0) Requirement already satisfied: pydantic>=2.10.6 in /usr/local/lib/python3.11/dist-packages (from exa-py) (2.11.7) Requirement already satisfied: httpx>=0.28.1 in /usr/local/lib/python3.11/dist-packages (from exa-py) (0.28.1) Requirement already satisfied: anyio<5,>=3.5.0 in /usr/local/lib/python3.11/dist-packages (from cerebras-cloud-sdk) (4.9.0) Requirement already satisfied: distro<2,>=1.7.0 in /usr/local/lib/python3.11/dist-packages (from cerebras-cloud-sdk) (1.9.0) Requirement already satisfied: sniffio in /usr/local/lib/python3.11/dist-packages (from cerebras-cloud-sdk) (1.3.1) Requirement already satisfied: idna>=2.8 in /usr/local/lib/python3.11/dist-packages (from anyio<5,>=3.5.0->cerebras-cloud-sdk) (3.10) Requirement already satisfied: certifi in /usr/local/lib/python3.11/dist-packages (from httpx>=0.28.1->exa-py) (2025.6.15) Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.11/dist-packages (from httpx>=0.28.1->exa-py) (1.0.9) Requirement already satisfied: h11>=0.16 in /usr/local/lib/python3.11/dist-packages (from httpcore==1.*->httpx>=0.28.1->exa-py) (0.16.0) Requirement already satisfied: jiter<1,>=0.4.0 in /usr/local/lib/python3.11/dist-packages (from openai>=1.48->exa-py) (0.10.0) Requirement already satisfied: tqdm>4 in /usr/local/lib/python3.11/dist-packages (from openai>=1.48->exa-py) (4.67.1) Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.11/dist-packages (from pydantic>=2.10.6->exa-py) (0.7.0) Requirement already satisfied: pydantic-core==2.33.2 in /usr/local/lib/python3.11/dist-packages (from pydantic>=2.10.6->exa-py) (2.33.2) Requirement already satisfied: typing-inspection>=0.4.0 in /usr/local/lib/python3.11/dist-packages (from pydantic>=2.10.6->exa-py) (0.4.1) Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.11/dist-packages (from requests>=2.32.3->exa-py) (3.4.2) Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.11/dist-packages (from requests>=2.32.3->exa-py) (2.4.0) Downloading exa_py-1.14.12-py3-none-any.whl (41 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.7/41.7 kB 2.1 MB/s eta 0:00:00 Downloading cerebras_cloud_sdk-1.35.0-py3-none-any.whl (89 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.5/89.5 kB 5.6 MB/s eta 0:00:00 Installing collected packages: cerebras-cloud-sdk, exa-py Successfully installed cerebras-cloud-sdk-1.35.0 exa-py-1.14.12 ✅ Setup complete
Step #2: Web Search Function
Our first core function handles web searching using Exa's auto search. This is advantageous because it uses a blend of keyword and neural search to find both exact matches and semantic similarities. It also returns the content of each scraped URL.
✅ Search function ready
Step #3: AI Analysis Function
This function leverages Cerebras fast inference to analyze content and generate insights. We'll use it both for structured JSON responses and regular text analysis throughout our research process.
✅ AI function ready
#Step #4: Research Function
Now we'll build our research methodology. The first part of the below cell performs the initial search and gathers our first batch of sources, just like when you first query Perplexity.
Then, the AI is queried to generate a conclusion based on the source data.
✅ Research function ready
#Step #5: Add Research Depth
Now let's make our research intelligent instead of just searching once and hoping for the best.
Here's the problem with basic search: You ask "What are the latest AI breakthroughs?" and get random articles. But what if those articles all focus on ChatGPT and miss robotics? You'd never know what you're missing.
Here is a more advanced research flow.
You ask: "What's driving the new wave of AI agents?"
↓
Layer 1: Broad search finds 6 sources about agent frameworks like AutoGPT, LangChain, and OpenAI’s GPT-4o
↓
AI reads them and thinks: “These all focus on software… but what’s enabling real-time speed?”
↓
Layer 2: Targeted search for "AI hardware for real-time agents" and "fast inference for LLMs"
↓
Final synthesis: Combines insights on agent software + breakthroughs in inference speed (Cerebras, NVIDIA, etc) =
A complete picture of what powers real-time AI agents today
✅ Enhanced research function ready
🔍 Researching: climate change solutions 2025
Layer 1: Found 6 sources
Layer 2: Investigating 'What are the top 3 climate change solutions proposed for 2025 by MIT Solve, UNDP, and UNFCCC?'
Total sources: 10
==================================================
ENHANCED RESEARCH RESULTS
==================================================
Query: climate change solutions 2025
Sources analyzed: 10
**SUMMARY**
The research query on climate change solutions for 2025 revealed various initiatives and proposals from prominent organizations. MIT Solve, UNDP, and UNFCCC are actively seeking and promoting innovative solutions to address climate change. The top 3 climate change solutions proposed for 2025 by these organizations focus on creating a zero-carbon world, adapting to a warming climate, and reducing greenhouse gas emissions. These solutions include leveraging technology, such as AI and graphene, to capture carbon and promote sustainable development.
**INSIGHTS**
* **MIT Solve's 2025 Global Climate Challenge**: The challenge focuses on creating a zero-carbon world and adapting to a warming climate, with a solution deadline of April 17, 2025.
* **UNDP's Climate Promise 2025**: This initiative aims to support countries in achieving their Nationally Determined Contributions (NDCs) and promoting sustainable development.
* **UNFCCC's Climate Week 2025**: The first Climate Week of 2025 concluded in Panama City, with progress made and real-world solutions shared across vital areas of work, including reducing greenhouse gas emissions.
* **Technological innovations**: New research suggests that AI could reduce global emissions by 3.2 to 5.4 billion tonnes of carbon-dioxide-equivalent annually by 2035, while scalable graphene membranes and new techniques for turning ordinary rocks into carbon-capturing machines are being explored.
**DEPTH GAINED**
The follow-up search enhanced understanding by providing specific details on the top 3 climate change solutions proposed by MIT Solve, UNDP, and UNFCCC, highlighting the focus areas and initiatives of these organizations in addressing climate change in 2025.
==================================================
Try these:
deeper_research_topic('quantum computing advances')
deeper_research_topic('space exploration news')
Step #6 (Optional): Anthropic Multi-Agent Research
What makes Anthropic's approach special?
It uses intelligent orchestration with specialized agents working in parallel.
Usually, one AI does everything sequentially
- Search → analyze → search → analyze (slow, limited)
Anthropic's approach is to allow a lead agent delegate to specialized subagents
- Lead agent breaks down "AI safety research" into:
- Subagent 1: Current AI safety techniques
- Subagent 2: Recent regulatory developments
- Subagent 3: Industry implementation challenges
- All agents work simultaneously = 3x faster, better coverage
The result is parallel intelligence that scales to complex research tasks.
✅ Anthropic multi-agent system ready!
🤖 Anthropic Multi-Agent Research: current climate change solutions
--------------------------------------------------
👨💼 LEAD AGENT: Planning and delegating...
✓ Subtasks defined and delegated
🔍 SUBAGENTS: Working in parallel...
🤖 Subagent 1: Researching current climate change solutions fundamentals principles
🤖 Subagent 2: Researching current climate change solutions latest developments
🤖 Subagent 3: Researching current climate change solutions applications real world
📊 Combined: 6 sources from 3 agents
👨💼 LEAD AGENT: Synthesizing parallel findings...
==================================================
🎯 MULTI-AGENT RESEARCH COMPLETE
==================================================
**EXECUTIVE SUMMARY:**
The current climate change solutions landscape is rapidly evolving, with a focus on scaling up efforts to drive out fossil fuels and achieve net-zero emissions. Recent developments in solar-powered carbon capture and conversion technologies, as well as breakthroughs in electrochemical devices, are promising steps towards a low-carbon future. Real-world applications, such as direct air capture and coastal carbon capture, are also being implemented to address climate change.
**INTEGRATED FINDINGS:**
• **Foundational Principles**: The Exponential Roadmap Initiative and Nature Communications emphasize the need for clear definitions and principles to qualify climate solutions and climate solutions companies. Natural climate solutions, such as those involving plants, have been understood for over a century, but their implementation and scaling up are crucial.
• **Recent Developments**: Researchers have made significant progress in developing solar-powered devices that can capture carbon dioxide from the air and convert it into sustainable fuel. Additionally, a breakthrough at Rice University has improved the stability of electrochemical devices that convert carbon dioxide into useful fuels and chemicals.
• **Real-World Applications**: Companies like Carbon Engineering and Vesta are working on direct air capture and coastal carbon capture technologies, respectively. These solutions aim to pull carbon dioxide directly out of the atmosphere and create a low-carbon future.
• **Cross-Cutting Insight**: A common thread across these findings is the importance of scaling up climate solutions, improving their efficiency, and making them more sustainable. This requires continued innovation, investment, and collaboration across sectors and industries.
**RESEARCH QUALITY:**
* Sources analyzed: 6 across 3 specialized agents
* Coverage: The subtasks provided a comprehensive coverage of the topic, spanning foundational principles, recent developments, and real-world applications. The sources were diverse and included academic papers, research institutions, and company websites, providing a well-rounded view of current climate change solutions.
🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖
ANTHROPIC MULTI-AGENT DEMO
🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖
Query: current climate change solutions
Subagents deployed: 3
Total sources: 6
💡 Key Innovation: Parallel specialized agents + intelligent orchestration
🎯 Try other complex topics:
anthropic_multiagent_research('quantum computing commercial applications')
anthropic_multiagent_research('artificial intelligence safety frameworks')
anthropic_multiagent_research('renewable energy policy implementation')