Spaces:
Sleeping
Sleeping
Commit Β·
77df06c
1
Parent(s): 54d422c
Initial commit of Research Agent app
Browse files- .python-version +1 -0
- README.md +0 -0
- app.py +71 -0
- cookbook-examples-gemini-3-product-comparison-agent.md +124 -0
- cookbook-examples-gemini-3-product-comparison-agent.py +42 -0
- cookbook-examples-gemini-3-product-comparison-agent.txt +0 -0
- cookbook-examples-gemini-3-research-agent.md +125 -0
- db.py +4 -0
- deployment_guide.md +49 -0
- main.py +6 -0
- notes-2.txt +82 -0
- notes-st.txt +7 -0
- notes.txt +89 -0
- pyproject.toml +13 -0
- requiements.txt +2 -0
- requirements.txt +74 -0
- research_notes/20251210-171628-what-are-the-latest-breakthroughs-in.md +42 -0
- run.sh +14 -0
- run.txt +6 -0
- streamlit_app.py +233 -0
- uv.lock +0 -0
- walkthrough.md +28 -0
.python-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
3.13
|
README.md
ADDED
|
File without changes
|
app.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from textwrap import dedent
|
| 3 |
+
from agno.agent import Agent
|
| 4 |
+
from agno.models.google import Gemini
|
| 5 |
+
from db import demo_db
|
| 6 |
+
from dotenv import load_dotenv
|
| 7 |
+
|
| 8 |
+
load_dotenv()
|
| 9 |
+
|
| 10 |
+
st.set_page_config(page_title="Research Agent", page_icon="π", layout="wide")
|
| 11 |
+
|
| 12 |
+
st.title("π Research Agent")
|
| 13 |
+
st.markdown("Ask me anything! I can search the web and provide well-researched responses.")
|
| 14 |
+
|
| 15 |
+
@st.cache_resource
|
| 16 |
+
def get_research_agent():
|
| 17 |
+
return Agent(
|
| 18 |
+
name="Research Agent",
|
| 19 |
+
model=Gemini(
|
| 20 |
+
id="gemini-3-pro-preview",
|
| 21 |
+
search=True,
|
| 22 |
+
),
|
| 23 |
+
description="You are a research agent with access to the web. You can search the web and provide well-researched responses.",
|
| 24 |
+
instructions=dedent("""\
|
| 25 |
+
1. Search the web and provide well-researched responses.
|
| 26 |
+
|
| 27 |
+
2. With every response, you must:
|
| 28 |
+
- Include source citations with URLs when available.
|
| 29 |
+
- Distinguish facts from opinions.
|
| 30 |
+
- Note if information may be outdated.
|
| 31 |
+
|
| 32 |
+
3. Start with a concise answer, then provide supporting details.
|
| 33 |
+
|
| 34 |
+
4. Keep responses focused and scannable with clear headings.
|
| 35 |
+
"""),
|
| 36 |
+
db=demo_db,
|
| 37 |
+
add_datetime_to_context=True,
|
| 38 |
+
add_history_to_context=True,
|
| 39 |
+
num_history_runs=3,
|
| 40 |
+
markdown=True,
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
research_agent = get_research_agent()
|
| 44 |
+
|
| 45 |
+
if "messages" not in st.session_state:
|
| 46 |
+
st.session_state.messages = []
|
| 47 |
+
|
| 48 |
+
for message in st.session_state.messages:
|
| 49 |
+
with st.chat_message(message["role"]):
|
| 50 |
+
st.markdown(message["content"])
|
| 51 |
+
|
| 52 |
+
if prompt := st.chat_input("What would you like to research?"):
|
| 53 |
+
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 54 |
+
with st.chat_message("user"):
|
| 55 |
+
st.markdown(prompt)
|
| 56 |
+
|
| 57 |
+
with st.chat_message("assistant"):
|
| 58 |
+
response_placeholder = st.empty()
|
| 59 |
+
full_response = ""
|
| 60 |
+
|
| 61 |
+
# Create a generator for the response
|
| 62 |
+
response_generator = research_agent.run(prompt, stream=True)
|
| 63 |
+
|
| 64 |
+
for chunk in response_generator:
|
| 65 |
+
if chunk.content:
|
| 66 |
+
full_response += chunk.content
|
| 67 |
+
response_placeholder.markdown(full_response + "β")
|
| 68 |
+
|
| 69 |
+
response_placeholder.markdown(full_response)
|
| 70 |
+
|
| 71 |
+
st.session_state.messages.append({"role": "assistant", "content": full_response})
|
cookbook-examples-gemini-3-product-comparison-agent.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Building an AI Product Comparison Agent
|
| 2 |
+
|
| 3 |
+
This guide provides a walkthrough for creating a sophisticated AI agent that can compare products by analyzing web pages and searching for reviews. This project is an excellent portfolio piece for developers looking to showcase their skills in building practical, tool-using AI applications.
|
| 4 |
+
|
| 5 |
+
## Project Overview
|
| 6 |
+
|
| 7 |
+
The project's goal is to build an AI agent that takes product names (or URLs) and generates a detailed, structured comparison. This "Product Comparison Agent" uses the web to gather information, ensuring its comparisons are based on current data, and then presents the findings in a clear, easy-to-digest format.
|
| 8 |
+
|
| 9 |
+
## Why This Project Belongs in Your Portfolio
|
| 10 |
+
|
| 11 |
+
* **Advanced Tool Use:** This agent doesn't just search the web; it can also be given specific URLs to analyze. This demonstrates your ability to build AI that integrates multiple tools (`search` and `url_context`).
|
| 12 |
+
* **Structured Output:** You're programming the agent to follow a strict output format (verdict, table, pros/cons). This is a key skill in making AI outputs reliable and useful for downstream applications.
|
| 13 |
+
* **Real-World Utility:** A product comparison tool is immediately recognizable and useful, making it a compelling demonstration of your ability to apply AI to solve common problems.
|
| 14 |
+
* **Focus on Prompt Engineering:** The detailed `instructions` highlight your skills in prompt engineering, which is crucial for controlling and directing the behavior of LLMs.
|
| 15 |
+
|
| 16 |
+
## Technical Deep Dive: Code Walkthrough
|
| 17 |
+
|
| 18 |
+
Let's dissect the `cookbook-examples-gemini-3-product-comparison-agent.py` script.
|
| 19 |
+
|
| 20 |
+
```python
|
| 21 |
+
from dotenv import load_dotenv
|
| 22 |
+
load_dotenv()
|
| 23 |
+
from textwrap import dedent
|
| 24 |
+
|
| 25 |
+
from agno.agent import Agent
|
| 26 |
+
from agno.models.google import Gemini
|
| 27 |
+
from db import demo_db
|
| 28 |
+
|
| 29 |
+
product_comparison_agent = Agent(
|
| 30 |
+
name="Product Comparison Agent",
|
| 31 |
+
model=Gemini(
|
| 32 |
+
id="gemini-3-pro-preview",
|
| 33 |
+
url_context=True,
|
| 34 |
+
search=True,
|
| 35 |
+
),
|
| 36 |
+
description="You are a product comparison agent that analyzes URLs and searches for reviews to provide comprehensive comparisons.",
|
| 37 |
+
instructions=dedent("""
|
| 38 |
+
1. Analyze URLs and search for reviews to provide comprehensive comparisons.
|
| 39 |
+
|
| 40 |
+
2. Your output format must be:
|
| 41 |
+
- **Quick Verdict** - One sentence recommendation
|
| 42 |
+
- **Comparison Table** - Key specs side by side
|
| 43 |
+
- **Pros & Cons** - For each option
|
| 44 |
+
- **Best For** - Who should choose which option
|
| 45 |
+
|
| 46 |
+
3. Be decisive and provide a coherent chain of thought for your recommendations.
|
| 47 |
+
|
| 48 |
+
4. Keep your responses concise and to the point.
|
| 49 |
+
"""),
|
| 50 |
+
db=demo_db,
|
| 51 |
+
add_datetime_to_context=True,
|
| 52 |
+
add_history_to_context=True,
|
| 53 |
+
num_history_runs=3,
|
| 54 |
+
markdown=True,
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
if __name__ == "__main__":
|
| 59 |
+
product_comparison_agent.print_response(
|
| 60 |
+
"Compare the Iphone 15 and Samsung Galaxy S25",
|
| 61 |
+
stream=True,
|
| 62 |
+
)
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
### 1. Imports and Setup
|
| 66 |
+
|
| 67 |
+
The script begins by importing necessary libraries: `Agent` and `Gemini` from the `agno` framework, and `load_dotenv` for managing API keys from a `.env` file.
|
| 68 |
+
|
| 69 |
+
### 2. The `Agent` Configuration
|
| 70 |
+
|
| 71 |
+
The `Agent` is configured with a specific persona and toolset:
|
| 72 |
+
|
| 73 |
+
* `name`: "Product Comparison Agent".
|
| 74 |
+
* `model`: We are again using the `Gemini` model, but with a different configuration.
|
| 75 |
+
* `id="gemini-3-pro-preview"`: Selects the powerful Gemini Pro model.
|
| 76 |
+
* `url_context=True`: This is a key feature. It gives the agent the ability to read and analyze the content of URLs provided in the prompt.
|
| 77 |
+
* `search=True`: This enables the agent's general web search capability, allowing it to find reviews, articles, and product pages on its own.
|
| 78 |
+
* `description`: A concise summary of the agent's function.
|
| 79 |
+
* `instructions`: This is a masterclass in prompt engineering for structured output. The instructions are very explicit, telling the agent *exactly* how to format its response. This includes:
|
| 80 |
+
* A **Quick Verdict**.
|
| 81 |
+
* A **Comparison Table**.
|
| 82 |
+
* A **Pros & Cons** list.
|
| 83 |
+
* A recommendation for who each product is **Best For**.
|
| 84 |
+
This level of instruction is vital for creating reliable and predictable AI agents.
|
| 85 |
+
* `db`, `add_datetime_to_context`, `add_history_to_context`: These parameters provide the agent with memory and temporal awareness, just like in the research agent.
|
| 86 |
+
* `markdown=True`: Ensures the output is formatted with Markdown, which is perfect for rendering tables and lists.
|
| 87 |
+
|
| 88 |
+
### 3. Running the Agent
|
| 89 |
+
|
| 90 |
+
The `if __name__ == "__main__":` block demonstrates how to use the agent.
|
| 91 |
+
* `product_comparison_agent.print_response(...)`: The prompt "Compare the Iphone 15 and Samsung Galaxy S25" is sent to the agent. Because `search=True`, the agent will go online to find information about these two phones to formulate its comparison.
|
| 92 |
+
* `stream=True`: The response is streamed to the console for a real-time feel.
|
| 93 |
+
|
| 94 |
+
## How to Run the Project
|
| 95 |
+
|
| 96 |
+
1. **Install Dependencies:**
|
| 97 |
+
If you haven't already, set up a Python virtual environment and install the necessary packages.
|
| 98 |
+
|
| 99 |
+
```bash
|
| 100 |
+
pip install "agno>=2.3.8" "google-genai>=1.54.0" "python-dotenv"
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
2. **Set Up Your API Key:**
|
| 104 |
+
* Ensure you have a `.env` file in your project directory.
|
| 105 |
+
* Add your Google API key to this file:
|
| 106 |
+
```
|
| 107 |
+
GOOGLE_API_KEY="YOUR_API_KEY_HERE"
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
3. **Run the script:**
|
| 111 |
+
```bash
|
| 112 |
+
python cookbook-examples-gemini-3-product-comparison-agent.py
|
| 113 |
+
```
|
| 114 |
+
The agent will now perform a web search and stream back a detailed comparison of the two smartphones.
|
| 115 |
+
|
| 116 |
+
## Customization and Extension Ideas
|
| 117 |
+
|
| 118 |
+
* **URL-based Comparison:** Modify the main script to pass URLs to the `print_response` method. For example: `agent.print_response("Compare the products at these URLs: [URL1] and [URL2]")`.
|
| 119 |
+
* **Interactive CLI:** Create a command-line interface (CLI) that prompts the user for products to compare, allowing for an interactive session.
|
| 120 |
+
* **Price Tracking:** Add a tool that allows the agent to check for the latest prices from specific e-commerce sites.
|
| 121 |
+
* **Sentiment Analysis:** Extend the agent to perform sentiment analysis on the reviews it finds to provide a summary of public opinion.
|
| 122 |
+
* **Web Frontend:** Build a simple Flask or FastAPI web application that allows users to enter products or URLs and see the formatted comparison in their browser.
|
| 123 |
+
|
| 124 |
+
```
|
cookbook-examples-gemini-3-product-comparison-agent.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from dotenv import load_dotenv
|
| 2 |
+
load_dotenv()
|
| 3 |
+
from textwrap import dedent
|
| 4 |
+
|
| 5 |
+
from agno.agent import Agent
|
| 6 |
+
from agno.models.google import Gemini
|
| 7 |
+
from db import demo_db
|
| 8 |
+
|
| 9 |
+
product_comparison_agent = Agent(
|
| 10 |
+
name="Product Comparison Agent",
|
| 11 |
+
model=Gemini(
|
| 12 |
+
id="gemini-3-pro-preview",
|
| 13 |
+
url_context=True,
|
| 14 |
+
search=True,
|
| 15 |
+
),
|
| 16 |
+
description="You are a product comparison agent that analyzes URLs and searches for reviews to provide comprehensive comparisons.",
|
| 17 |
+
instructions=dedent("""\
|
| 18 |
+
1. Analyze URLs and search for reviews to provide comprehensive comparisons.
|
| 19 |
+
|
| 20 |
+
2. Your output format must be:
|
| 21 |
+
- **Quick Verdict** - One sentence recommendation
|
| 22 |
+
- **Comparison Table** - Key specs side by side
|
| 23 |
+
- **Pros & Cons** - For each option
|
| 24 |
+
- **Best For** - Who should choose which option
|
| 25 |
+
|
| 26 |
+
3. Be decisive and provide a coherent chain of thought for your recommendations.
|
| 27 |
+
|
| 28 |
+
4. Keep your responses concise and to the point.
|
| 29 |
+
"""),
|
| 30 |
+
db=demo_db,
|
| 31 |
+
add_datetime_to_context=True,
|
| 32 |
+
add_history_to_context=True,
|
| 33 |
+
num_history_runs=3,
|
| 34 |
+
markdown=True,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
if __name__ == "__main__":
|
| 39 |
+
product_comparison_agent.print_response(
|
| 40 |
+
"Compare the Iphone 15 and Samsung Galaxy S25",
|
| 41 |
+
stream=True,
|
| 42 |
+
)
|
cookbook-examples-gemini-3-product-comparison-agent.txt
ADDED
|
File without changes
|
cookbook-examples-gemini-3-research-agent.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Building a Web-Powered AI Research Agent
|
| 2 |
+
|
| 3 |
+
This walkthrough will guide you through the process of building a powerful, web-enabled AI research agent using Python. This project is a fantastic addition to a portfolio for any developer interested in AI, as it demonstrates a practical application of large language models (LLMs) and agent-based systems.
|
| 4 |
+
|
| 5 |
+
## Project Overview
|
| 6 |
+
|
| 7 |
+
The goal of this project is to create an AI agent that can answer complex questions by actively searching the web for the most current information. Unlike a standard chatbot, this "Research Agent" is designed to provide well-researched, factual responses, complete with source citations. It's a perfect example of how to augment an LLM's knowledge with real-time data from the internet.
|
| 8 |
+
|
| 9 |
+
## Why This Project Belongs in Your Portfolio
|
| 10 |
+
|
| 11 |
+
* **Demonstrates Modern AI Skills:** You'll be working with Google's Gemini Pro model, showcasing your ability to integrate cutting-edge AI into applications.
|
| 12 |
+
* **Highlights Agentic AI Concepts:** This project moves beyond simple Q&A bots. You're building an "agent" that has a specific role, instructions, and tools (in this case, web search).
|
| 13 |
+
* **Practical Application:** A research agent is a genuinely useful tool, demonstrating that you can build AI solutions that solve real-world problems.
|
| 14 |
+
* **Shows Best Practices:** The use of a structured agent framework (`agno`), environment variables for API keys (`dotenv`), and clear, instructive prompting are all hallmarks of a well-engineered AI application.
|
| 15 |
+
|
| 16 |
+
## Technical Deep Dive: Code Walkthrough
|
| 17 |
+
|
| 18 |
+
Let's break down the `cookbook-examples-gemini-3-research-agent.py` script step by step.
|
| 19 |
+
|
| 20 |
+
```python
|
| 21 |
+
from textwrap import dedent
|
| 22 |
+
|
| 23 |
+
from agno.agent import Agent
|
| 24 |
+
from agno.models.google import Gemini
|
| 25 |
+
from db import demo_db
|
| 26 |
+
|
| 27 |
+
from dotenv import load_dotenv
|
| 28 |
+
load_dotenv()
|
| 29 |
+
|
| 30 |
+
research_agent = Agent(
|
| 31 |
+
name="Research Agent",
|
| 32 |
+
model=Gemini(
|
| 33 |
+
id="gemini-3-pro-preview",
|
| 34 |
+
search=True,
|
| 35 |
+
),
|
| 36 |
+
description="You are a research agent with access to the web. You can search the web and provide well-researched responses.",
|
| 37 |
+
instructions=dedent("""
|
| 38 |
+
1. Search the web and provide well-researched responses.
|
| 39 |
+
|
| 40 |
+
2. With every response, you must:
|
| 41 |
+
- Include source citations with URLs when available.
|
| 42 |
+
- Distinguish facts from opinions.
|
| 43 |
+
- Note if information may be outdated.
|
| 44 |
+
|
| 45 |
+
3. Start with a concise answer, then provide supporting details.
|
| 46 |
+
|
| 47 |
+
4. Keep responses focused and scannable with clear headings.
|
| 48 |
+
"""),
|
| 49 |
+
db=demo_db,
|
| 50 |
+
add_datetime_to_context=True,
|
| 51 |
+
add_history_to_context=True,
|
| 52 |
+
num_history_runs=3,
|
| 53 |
+
markdown=True,
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
if __name__ == "__main__":
|
| 58 |
+
research_agent.print_response(
|
| 59 |
+
"What are the latest breakthroughs in quantum computing this year?",
|
| 60 |
+
stream=True,
|
| 61 |
+
)
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
### 1. Imports and Setup
|
| 65 |
+
|
| 66 |
+
* `from agno.agent import Agent`: This imports the core `Agent` class from the `agno` library, which provides a framework for creating AI agents.
|
| 67 |
+
* `from agno.models.google import Gemini`: This imports the `Gemini` model wrapper from `agno`, allowing for easy integration with Google's Gemini models.
|
| 68 |
+
* `from dotenv import load_dotenv`: This is a standard practice for managing sensitive information like API keys. It loads variables from a `.env` file into the environment.
|
| 69 |
+
|
| 70 |
+
### 2. The `Agent` Configuration
|
| 71 |
+
|
| 72 |
+
The `Agent` class is the heart of our application. We instantiate it with several key parameters:
|
| 73 |
+
|
| 74 |
+
* `name`: A simple, descriptive name for our agent.
|
| 75 |
+
* `model`: Here, we specify the `Gemini` model.
|
| 76 |
+
* `id="gemini-3-pro-preview"`: This selects the specific version of the Gemini model we want to use.
|
| 77 |
+
* `search=True`: This is the magic ingredient! By setting this to `True`, we are enabling the model's built-in web search capability.
|
| 78 |
+
* `description`: A high-level description of the agent's purpose.
|
| 79 |
+
* `instructions`: This is the detailed prompt that governs the agent's behavior. It's a multi-step set of rules that forces the agent to:
|
| 80 |
+
* Cite its sources.
|
| 81 |
+
* Distinguish between facts and opinions.
|
| 82 |
+
* Flag potentially outdated information.
|
| 83 |
+
* Structure its responses for clarity (concise answer first, then details).
|
| 84 |
+
* `db=demo_db`: The agent is configured to use a database to persist conversation history. This allows it to remember past interactions.
|
| 85 |
+
* `add_datetime_to_context`: This injects the current date and time into the model's context, which is useful for time-sensitive questions.
|
| 86 |
+
* `add_history_to_context` & `num_history_runs`: These parameters control the conversation history feature, allowing the agent to have contextually aware follow-up conversations.
|
| 87 |
+
* `markdown=True`: This tells the agent to format its output using Markdown for better readability.
|
| 88 |
+
|
| 89 |
+
### 3. Running the Agent
|
| 90 |
+
|
| 91 |
+
The `if __name__ == "__main__":` block is the entry point of the script.
|
| 92 |
+
* `research_agent.print_response(...)`: This is the method that sends a prompt to the agent and prints its response.
|
| 93 |
+
* `stream=True`: This streams the response as it's being generated, providing a more interactive and real-time experience for the user.
|
| 94 |
+
|
| 95 |
+
## How to Run the Project
|
| 96 |
+
|
| 97 |
+
1. **Install Dependencies:**
|
| 98 |
+
Make sure you have Python installed. Then, create a virtual environment and install the required packages:
|
| 99 |
+
|
| 100 |
+
```bash
|
| 101 |
+
pip install "agno>=2.3.8" "google-genai>=1.54.0" "python-dotenv"
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
2. **Set Up Your API Key:**
|
| 105 |
+
* Create a file named `.env` in the same directory as the script.
|
| 106 |
+
* Add your Google API key to this file:
|
| 107 |
+
```
|
| 108 |
+
GOOGLE_API_KEY="YOUR_API_KEY_HERE"
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
3. **Run the script:**
|
| 112 |
+
```bash
|
| 113 |
+
python cookbook-examples-gemini-3-research-agent.py
|
| 114 |
+
```
|
| 115 |
+
You should see the agent start to stream a well-researched answer to the question about quantum computing.
|
| 116 |
+
|
| 117 |
+
## Customization and Extension Ideas
|
| 118 |
+
|
| 119 |
+
This agent is a great starting point. Here are some ideas to make it your own:
|
| 120 |
+
|
| 121 |
+
* **Build a Web Interface:** Wrap the agent in a simple web framework like Flask or FastAPI to create a web-based research tool.
|
| 122 |
+
* **Add More Tools:** The `agno` framework allows for adding custom tools. You could give the agent the ability to run code, access databases, or interact with other APIs.
|
| 123 |
+
* **Specialize the Agent:** Change the `instructions` to create agents for different roles, such as a "Financial Analyst Agent" or a "Creative Writing Assistant."
|
| 124 |
+
* **Persistent Memory:** The `demo_db` is likely an in-memory database. Swap it out for a persistent database like SQLite or PostgreSQL to give your agent a long-term memory.
|
| 125 |
+
* **Interactive Chat:** Modify the `if __name__ == "__main__":` block to create a loop that allows you to have an interactive chat session with the agent.
|
db.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from agno.db.sqlite import SqliteDb
|
| 2 |
+
|
| 3 |
+
db_file = "tmp/gemini-3.db"
|
| 4 |
+
demo_db = SqliteDb(id="gemini-3-db", db_file=db_file)
|
deployment_guide.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Deploying to Streamlit Community Cloud
|
| 2 |
+
|
| 3 |
+
Follow these steps to publish your Research Agent app to the internet.
|
| 4 |
+
|
| 5 |
+
## 1. Prepare your Repository
|
| 6 |
+
|
| 7 |
+
Streamlit Cloud deploys directly from your GitHub repository.
|
| 8 |
+
|
| 9 |
+
1. **Commit your changes**:
|
| 10 |
+
```bash
|
| 11 |
+
git add .
|
| 12 |
+
git commit -m "Initial commit of Research Agent app"
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
2. **Push to GitHub**:
|
| 16 |
+
- Create a new repository on GitHub.
|
| 17 |
+
- Follow the instructions to push your local repository to GitHub.
|
| 18 |
+
```bash
|
| 19 |
+
git remote add origin <your-repo-url>
|
| 20 |
+
git branch -M main
|
| 21 |
+
git push -u origin main
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
## 2. Deploy on Streamlit Cloud
|
| 25 |
+
|
| 26 |
+
1. Go to [share.streamlit.io](https://share.streamlit.io/).
|
| 27 |
+
2. Sign in with your GitHub account.
|
| 28 |
+
3. Click **"New app"**.
|
| 29 |
+
4. Select your repository, branch (`main`), and the main file path (`app.py`).
|
| 30 |
+
5. Click **"Deploy!"**.
|
| 31 |
+
|
| 32 |
+
## 3. Configure Secrets
|
| 33 |
+
|
| 34 |
+
Your app needs API keys to work. You must set these in the Streamlit Cloud dashboard.
|
| 35 |
+
|
| 36 |
+
1. On your app's dashboard, click **"Manage app"** (bottom right) or the three dots menu -> **"Settings"**.
|
| 37 |
+
2. Go to the **"Secrets"** tab.
|
| 38 |
+
3. Paste your secrets in the TOML format:
|
| 39 |
+
|
| 40 |
+
```toml
|
| 41 |
+
GOOGLE_API_KEY = "your-google-api-key-here"
|
| 42 |
+
```
|
| 43 |
+
*(Copy the value from your local `.env` file, but do not include the `export` keyword if present).*
|
| 44 |
+
|
| 45 |
+
4. Click **"Save"**.
|
| 46 |
+
|
| 47 |
+
## 4. Verify
|
| 48 |
+
|
| 49 |
+
Once deployed and secrets are saved, your app should automatically refresh and be ready to use!
|
main.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def main():
|
| 2 |
+
print("Hello from new!")
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
main()
|
notes-2.txt
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Sreeprakashs-MacBook-Pro-3:new sree$ uv run python cookbook-examples-gemini-3-product-comparison-agent.py
|
| 2 |
+
INFO Google Search enabled.
|
| 3 |
+
INFO URL context enabled.
|
| 4 |
+
Both GOOGLE_API_KEY and GEMINI_API_KEY are set. Using GOOGLE_API_KEY.
|
| 5 |
+
ββ Message βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 6 |
+
β β
|
| 7 |
+
β Compare the Iphone 15 and Samsung Galaxy S25 β
|
| 8 |
+
β β
|
| 9 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 10 |
+
ββ Response (36.3s) ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 11 |
+
β β
|
| 12 |
+
β Quick Verdict β
|
| 13 |
+
β β
|
| 14 |
+
β The Samsung Galaxy S25 is the superior choice for most users in 2025, offering a smoother 120Hz display, a dedicated telephoto lens, and β
|
| 15 |
+
β full AI capabilities that the base iPhone 15 lacks. Choose the iPhone 15 only if you are deeply locked into the Apple ecosystem or need β
|
| 16 |
+
β to save money, as it misses out on critical modern features like Apple Intelligence. β
|
| 17 |
+
β β
|
| 18 |
+
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 19 |
+
β Comparison Table β
|
| 20 |
+
β β
|
| 21 |
+
β β
|
| 22 |
+
β Feature Samsung Galaxy S25 Apple iPhone 15 β
|
| 23 |
+
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 24 |
+
β Release Date Feb 2025 Sept 2023 β
|
| 25 |
+
β Display 6.2" Dynamic AMOLED 2X, 120Hz 6.1" OLED, 60Hz β
|
| 26 |
+
β Processor Snapdragon 8 Elite for Galaxy A16 Bionic β
|
| 27 |
+
β RAM 12GB 6GB β
|
| 28 |
+
β AI Support Full Galaxy AI Support No Apple Intelligence Support β
|
| 29 |
+
β Rear Cameras 50MP Main, 12MP Ultra-wide, 10MP 3x Telephoto 48MP Main, 12MP Ultra-wide β
|
| 30 |
+
β Battery 4,000 mAh (Faster Charging) 3,349 mAh β
|
| 31 |
+
β Software Support 7 Years (until ~2032) ~5-6 Years (from 2023 launch) β
|
| 32 |
+
β Biometrics Ultrasonic In-Display Fingerprint Face ID β
|
| 33 |
+
β β
|
| 34 |
+
β β
|
| 35 |
+
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 36 |
+
β Pros & Cons β
|
| 37 |
+
β β
|
| 38 |
+
β Samsung Galaxy S25 β
|
| 39 |
+
β β
|
| 40 |
+
β β
Pros: β
|
| 41 |
+
β β
|
| 42 |
+
β β’ Superior Display: The 120Hz refresh rate makes scrolling and animations feel significantly smoother than the iPhone's 60Hz. β
|
| 43 |
+
β β’ Future-Proof AI: Comes with full support for Galaxy AI features (Live Translate, Circle to Search, etc.). β
|
| 44 |
+
β β’ Versatile Camera: Includes a dedicated 3x optical telephoto lens for better zoom shots. β
|
| 45 |
+
β β’ Longer Support Life: Released in 2025 with 7 years of guaranteed OS updates. β
|
| 46 |
+
β β
|
| 47 |
+
β β Cons: β
|
| 48 |
+
β β
|
| 49 |
+
β β’ Resale Value: Generally depreciates faster than iPhones. β
|
| 50 |
+
β β’ Bloatware: Pre-installed apps from Samsung and carriers can be cluttered compared to iOS. β
|
| 51 |
+
β β
|
| 52 |
+
β Apple iPhone 15 β
|
| 53 |
+
β β
|
| 54 |
+
β β
Pros: β
|
| 55 |
+
β β
|
| 56 |
+
β β’ Video Quality: Remains the gold standard for video recording with excellent stabilization and consistency. β
|
| 57 |
+
β β’ Ecosystem Integration: Seamlessly works with AirPods, Apple Watch, and Mac. β
|
| 58 |
+
β β’ Refined Design: The "Dynamic Island" adds useful utility, and the build quality is premium. β
|
| 59 |
+
β β’ Simplicity: iOS is incredibly user-friendly and reliable. β
|
| 60 |
+
β β
|
| 61 |
+
β β Cons: β
|
| 62 |
+
β β
|
| 63 |
+
β β’ Dated Display: The 60Hz screen feels sluggish compared to virtually any modern Android phone. β
|
| 64 |
+
β β’ No AI: Does not support Apple Intelligence (this feature requires iPhone 15 Pro or newer). β
|
| 65 |
+
β β’ Slow Charging: Charging speeds are significantly slower than the S25. β
|
| 66 |
+
β β
|
| 67 |
+
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 68 |
+
β Best For β
|
| 69 |
+
β β
|
| 70 |
+
β β’ Choose the Samsung Galaxy S25 if: You want the latest technology, value a high-refresh-rate screen, use zoom photography often, or β
|
| 71 |
+
β want access to modern AI features. It is a true 2025 flagship. β
|
| 72 |
+
β β’ Choose the iPhone 15 if: You are on a stricter budget, already own other Apple devices (Mac/iPad), and prioritize video recording β
|
| 73 |
+
β quality over photography zoom or screen smoothness. β
|
| 74 |
+
β β
|
| 75 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 76 |
+
ββ Citations βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 77 |
+
β β
|
| 78 |
+
β β
|
| 79 |
+
β 1 phonearena.com β
|
| 80 |
+
β β
|
| 81 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 82 |
+
|
notes-st.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
uv run streamlit run app.py
|
| 3 |
+
|
| 4 |
+
http://localhost:8501/
|
| 5 |
+
|
| 6 |
+
Easy to do streamlit projects for a techie intern wanting to start AI career
|
| 7 |
+
|
notes.txt
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Sreeprakashs-MacBook-Pro-3:new sree$ uv run python cookbook-examples-gemini-3-research-agent.py
|
| 2 |
+
INFO Google Search enabled.
|
| 3 |
+
Both GOOGLE_API_KEY and GEMINI_API_KEY are set. Using GOOGLE_API_KEY.
|
| 4 |
+
ββ Message βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 5 |
+
β β
|
| 6 |
+
β What are the latest breakthroughs in quantum computing this year? β
|
| 7 |
+
β β
|
| 8 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 9 |
+
ββ Response (40.3s) ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 10 |
+
β β
|
| 11 |
+
β 2025 has been a pivotal year for quantum computing, characterized by a shift from experimental noise to verified stability. The most β
|
| 12 |
+
β significant trend this year is the industry-wide transition from "noisy" physical qubits to reliable logical qubits, bringing β
|
| 13 |
+
β fault-tolerant quantum computing closer to reality. β
|
| 14 |
+
β β
|
| 15 |
+
β The following is a summary of the major breakthroughs in quantum computing for 2025: β
|
| 16 |
+
β β
|
| 17 |
+
β 1. Major Hardware Releases β
|
| 18 |
+
β β
|
| 19 |
+
β β’ Google's "Willow" Chip: In late 2025, Google unveiled its 105-qubit Willow processor. Its defining achievement is "exponential error β
|
| 20 |
+
β suppression," meaning that as more qubits were added, the error rate actually decreasedβa behavior necessary for scaling that had β
|
| 21 |
+
β long eluded researchers. Google claims Willow performed a benchmark calculation in under 5 minutes that would take a supercomputer β
|
| 22 |
+
β septillions of years. β
|
| 23 |
+
β β’ Microsoft's "Majorana 1": Early in the year, Microsoft announced the Majorana 1, the first quantum processor built around topological β
|
| 24 |
+
β qubits. These qubits are inherently more stable against environmental noise than standard methods, potentially reducing the massive β
|
| 25 |
+
β overhead needed for error correction. β
|
| 26 |
+
β β’ IBM's "Heron" & "Nighthawk": IBM continued its aggressive roadmap. Early in 2025, it demonstrated the Heron chip capable of β
|
| 27 |
+
β simulating RNA structures (up to 60 nucleotides), a massive leap for computational biology. By late 2025, IBM was preparing to debut β
|
| 28 |
+
β its Nighthawk processor, designed to further scale computational capacity for utility-scale problems. β
|
| 29 |
+
β β
|
| 30 |
+
β 2. The Era of Logical Qubits (Error Correction) β
|
| 31 |
+
β β
|
| 32 |
+
β β’ Microsoft & Quantinuum Collaboration: In a landmark achievement in April, Microsoft and Quantinuum successfully demonstrated 12 β
|
| 33 |
+
β highly reliable logical qubits. By combining Microsoftβs qubit-virtualization software with Quantinuumβs H2 ion-trap hardware, they β
|
| 34 |
+
β achieved error rates 800 times lower than physical error rates, marking a definitive move into "Level 2 Resilient" quantum computing. β
|
| 35 |
+
β β’ Alice & Bob's "Cat Qubits": The French startup reported a breakthrough where their "cat qubits" resisted bit-flip errors for over one β
|
| 36 |
+
β hour. This stability is orders of magnitude longer than typical millisecond coherence times, suggesting a more efficient path to β
|
| 37 |
+
β fault tolerance that requires fewer physical qubits. β
|
| 38 |
+
β β
|
| 39 |
+
β 3. Academic & Physics Breakthroughs β
|
| 40 |
+
β β
|
| 41 |
+
β β’ Room-Temperature Quantum Device (Stanford): In December, Stanford University researchers published work on a device using "twisted β
|
| 42 |
+
β light" to entangle photons and electrons at room temperature. While still experimental, this challenges the long-held constraint that β
|
| 43 |
+
β quantum hardware requires near-absolute-zero cooling, potentially opening the door to cheaper, more accessible quantum tech in the β
|
| 44 |
+
β far future. β
|
| 45 |
+
β β’ Quantum Internet Range Extension: Researchers at the University of Chicago demonstrated a new nanofabrication technique that could β
|
| 46 |
+
β theoretically extend the range of quantum networks to 2,000 km (up from just a few kilometers), a critical step toward a viable β
|
| 47 |
+
β "quantum internet." β
|
| 48 |
+
β β
|
| 49 |
+
β 4. Practical Applications & Simulation β
|
| 50 |
+
β β
|
| 51 |
+
β β’ Biological Simulation: Beyond IBM's RNA work, IonQ and Kapu Quantum successfully modeled protein folding involving 12 amino acids. β
|
| 52 |
+
β These simulations are the first tangible proof that quantum computers can handle the complex chains required for drug discovery. β
|
| 53 |
+
β β’ Cosmological Simulation: D-Wave used its annealing quantum computer to simulate "false vacuum decay," a theoretical event regarding β
|
| 54 |
+
β the stability of the universe. This demonstrated the technology's utility in high-energy physics, solving equations that are β
|
| 55 |
+
β exponentially difficult for classical supercomputers. β
|
| 56 |
+
β β
|
| 57 |
+
β 5. Summary of Key Players (2025 Snapshot) β
|
| 58 |
+
β β
|
| 59 |
+
β β
|
| 60 |
+
β Company/Inst. Key 2025 Breakthrough Significance β
|
| 61 |
+
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 62 |
+
β Google Willow Chip Proved errors decrease as system scales (below threshold). β
|
| 63 |
+
β Microsoft Majorana 1 Chip First topological processor; high inherent stability. β
|
| 64 |
+
β Quantinuum 12 Logical Qubits 800x error reduction; verified "reliable" logical qubits. β
|
| 65 |
+
β IBM Heron/Nighthawk Practical RNA simulation; utility-scale hardware. β
|
| 66 |
+
β Stanford Room-Temp Device Entanglement without extreme cryogenic cooling. β
|
| 67 |
+
β β
|
| 68 |
+
β β
|
| 69 |
+
β Note on Timeline: The information above reflects the "current" status of the industry as of December 2025. Many of these announcements β
|
| 70 |
+
β (like the Majorana 1 and Willow) are specific to the 2025 calendar year. β
|
| 71 |
+
β β
|
| 72 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 73 |
+
ββ Citations βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 74 |
+
β β
|
| 75 |
+
β β
|
| 76 |
+
β 1 techi.com β
|
| 77 |
+
β 2 forbes.com β
|
| 78 |
+
β 3 time.com β
|
| 79 |
+
β 4 quantinuum.com β
|
| 80 |
+
β 5 forbes.com β
|
| 81 |
+
β 6 hoodline.com β
|
| 82 |
+
β 7 uchicago.edu β
|
| 83 |
+
β 8 youtube.com β
|
| 84 |
+
β 9 computing.co.uk β
|
| 85 |
+
β 10 constellationr.com β
|
| 86 |
+
β 11 thequantuminsider.com β
|
| 87 |
+
β β
|
| 88 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 89 |
+
|
pyproject.toml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[project]
|
| 2 |
+
name = "new"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
description = "Add your description here"
|
| 5 |
+
readme = "README.md"
|
| 6 |
+
requires-python = ">=3.13"
|
| 7 |
+
dependencies = [
|
| 8 |
+
"agno>=2.3.8",
|
| 9 |
+
"google>=3.0.0",
|
| 10 |
+
"google-genai>=1.54.0",
|
| 11 |
+
"sqlalchemy>=2.0.44",
|
| 12 |
+
"streamlit>=1.32.0",
|
| 13 |
+
]
|
requiements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
agno
|
| 2 |
+
streamlit
|
requirements.txt
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file was autogenerated by uv via the following command:
|
| 2 |
+
# uv export --no-hashes --format requirements-txt
|
| 3 |
+
agno==2.3.8
|
| 4 |
+
altair==6.0.0
|
| 5 |
+
annotated-types==0.7.0
|
| 6 |
+
anyio==4.12.0
|
| 7 |
+
attrs==25.4.0
|
| 8 |
+
beautifulsoup4==4.14.3
|
| 9 |
+
blinker==1.9.0
|
| 10 |
+
cachetools==6.2.2
|
| 11 |
+
certifi==2025.11.12
|
| 12 |
+
charset-normalizer==3.4.4
|
| 13 |
+
click==8.3.1
|
| 14 |
+
colorama==0.4.6 ; sys_platform == 'win32'
|
| 15 |
+
docstring-parser==0.17.0
|
| 16 |
+
gitdb==4.0.12
|
| 17 |
+
gitpython==3.1.45
|
| 18 |
+
google==3.0.0
|
| 19 |
+
google-auth==2.43.0
|
| 20 |
+
google-genai==1.54.0
|
| 21 |
+
greenlet==3.3.0 ; platform_machine == 'AMD64' or platform_machine == 'WIN32' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'ppc64le' or platform_machine == 'win32' or platform_machine == 'x86_64'
|
| 22 |
+
h11==0.16.0
|
| 23 |
+
h2==4.3.0
|
| 24 |
+
hpack==4.1.0
|
| 25 |
+
httpcore==1.0.9
|
| 26 |
+
httpx==0.28.1
|
| 27 |
+
hyperframe==6.1.0
|
| 28 |
+
idna==3.11
|
| 29 |
+
jinja2==3.1.6
|
| 30 |
+
jsonschema==4.25.1
|
| 31 |
+
jsonschema-specifications==2025.9.1
|
| 32 |
+
markdown-it-py==4.0.0
|
| 33 |
+
markupsafe==3.0.3
|
| 34 |
+
mdurl==0.1.2
|
| 35 |
+
narwhals==2.13.0
|
| 36 |
+
numpy==2.3.5
|
| 37 |
+
packaging==25.0
|
| 38 |
+
pandas==2.3.3
|
| 39 |
+
pillow==12.0.0
|
| 40 |
+
protobuf==6.33.2
|
| 41 |
+
pyarrow==22.0.0
|
| 42 |
+
pyasn1==0.6.1
|
| 43 |
+
pyasn1-modules==0.4.2
|
| 44 |
+
pydantic==2.12.5
|
| 45 |
+
pydantic-core==2.41.5
|
| 46 |
+
pydantic-settings==2.12.0
|
| 47 |
+
pydeck==0.9.1
|
| 48 |
+
pygments==2.19.2
|
| 49 |
+
python-dateutil==2.9.0.post0
|
| 50 |
+
python-dotenv==1.2.1
|
| 51 |
+
python-multipart==0.0.20
|
| 52 |
+
pytz==2025.2
|
| 53 |
+
pyyaml==6.0.3
|
| 54 |
+
referencing==0.37.0
|
| 55 |
+
requests==2.32.5
|
| 56 |
+
rich==14.2.0
|
| 57 |
+
rpds-py==0.30.0
|
| 58 |
+
rsa==4.9.1
|
| 59 |
+
shellingham==1.5.4
|
| 60 |
+
six==1.17.0
|
| 61 |
+
smmap==5.0.2
|
| 62 |
+
soupsieve==2.8
|
| 63 |
+
sqlalchemy==2.0.44
|
| 64 |
+
streamlit==1.52.1
|
| 65 |
+
tenacity==9.1.2
|
| 66 |
+
toml==0.10.2
|
| 67 |
+
tornado==6.5.2
|
| 68 |
+
typer==0.20.0
|
| 69 |
+
typing-extensions==4.15.0
|
| 70 |
+
typing-inspection==0.4.2
|
| 71 |
+
tzdata==2025.2
|
| 72 |
+
urllib3==2.6.1
|
| 73 |
+
watchdog==6.0.0 ; sys_platform != 'darwin'
|
| 74 |
+
websockets==15.0.1
|
research_notes/20251210-171628-what-are-the-latest-breakthroughs-in.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Research Note: What are the latest breakthroughs in quantum computing this year?
|
| 2 |
+
|
| 3 |
+
- **Saved at:** 2025-12-10T17:16:28
|
| 4 |
+
- **File:** 20251210-171628-what-are-the-latest-breakthroughs-in.md
|
| 5 |
+
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
As of December 2025, the quantum computing landscape has shifted from raw qubit counts to the era of **logical qubits** and **error correction**. Major players like Google, Microsoft, and QuEra have moved beyond "noisy" intermediate-scale quantum (NISQ) devices toward systems that can detect and fix their own errors.
|
| 9 |
+
|
| 10 |
+
The following are the most significant breakthroughs of 2025.
|
| 11 |
+
|
| 12 |
+
### 1. The Rise of "Logical" Qubits & Error Correction
|
| 13 |
+
The biggest theme of 2025 has been the successful creation of reliable *logical* qubitsβvirtual qubits formed by grouping many physical qubits together to correct errors.
|
| 14 |
+
* **Microsoft & Quantinuum (Reliability Record):** In a major collaborative milestone, Microsoft and Quantinuum demonstrated **12 logical qubits** on Quantinuumβs H2 ion-trap processor. They achieved an error rate **800 times lower** than physical qubits, marking a transition from "physical" to "reliable" quantum computing. Later in the year, they scaled this to **24 entangled logical qubits** in partnership with Atom Computing.
|
| 15 |
+
* **Google Quantum AI (Willow Chip):** Google unveiled its **"Willow" processor** (105 qubits), which successfully demonstrated quantum error correction below the "surface code threshold." This means that adding more qubits to the system now *reduces* the overall error rate rather than increasing itβa critical "tipping point" for building large-scale machines.
|
| 16 |
+
|
| 17 |
+
### 2. Hardware Scaling & New Architectures
|
| 18 |
+
Different hardware approachesβsuperconducting circuits, neutral atoms, and topological qubitsβsaw competitive leaps this year.
|
| 19 |
+
* **Neutral Atom Breakthroughs (QuEra):** 2025 was a breakout year for neutral atom technology. QuEra demonstrated a massive **3,000-qubit array** operating continuously for over two hours. More importantly, they executed algorithms with up to **96 logical qubits**, validating a path to mass scalability that is difficult for superconducting chips to match.
|
| 20 |
+
* **Topological Qubits (Microsoft Majorana 1):** Early in 2025, Microsoft announced the **Majorana 1** chip. It is designed around topological qubits, which are theoretically far more stable than standard qubits because they are "protected" by the laws of physics at the hardware level. While verification is ongoing, this represents a potential "fast lane" to stable quantum computing if the technology matures.
|
| 21 |
+
* **IBM's Modular Roadmap:** IBM continued its roadmap with the release of the **"Nighthawk" processor** (120 qubits) and preparations for **"Starling,"** a fault-tolerant system planned for 2029. IBM's 2025 focus has been on "quantum-centric supercomputing," integrating quantum processors more tightly with classical supercomputers to run hybrid algorithms.
|
| 22 |
+
|
| 23 |
+
### 3. Demonstrating "Quantum Advantage"
|
| 24 |
+
Researchers are beginning to perform tasks that are practically impossible for classical supercomputers, moving beyond theoretical benchmarks to scientific utility.
|
| 25 |
+
* **Google's "Quantum Echoes":** Google used its quantum processor to run a specific physics simulation (measuring "Quantum Echoes") **13,000 times faster** than the Frontier supercomputer (the world's fastest classical machine). This is one of the first demonstrations of advantage in a scientifically relevant calculation rather than a random number generation task.
|
| 26 |
+
* **D-Wave's Physics Simulations:** D-Wave used its annealing quantum computer to simulate **false vacuum decay** and magnetic material dynamics. These simulations provided insights into fundamental physics and material science that are computationally prohibitive for classical systems.
|
| 27 |
+
|
| 28 |
+
### 4. Breakthroughs in Quantum Interconnects
|
| 29 |
+
Scaling quantum computers requires linking multiple chips together, a challenge known as the "interconnect bottleneck."
|
| 30 |
+
* **Oxford University:** Researchers successfully linked two separate ion-trap quantum modules using light, "teleporting" a quantum gate between them with **86% fidelity**.
|
| 31 |
+
* **University of Chicago:** A new nanofabrication technique was announced that could theoretically extend the range of quantum networks to **2,000 km** (approx. 1,200 miles), a massive leap from the previous limit of a few kilometers. This brings a future "Quantum Internet" significantly closer.
|
| 32 |
+
|
| 33 |
+
### Summary of Key Players (2025 Status)
|
| 34 |
+
| Company | Key 2025 Milestone | Primary Technology |
|
| 35 |
+
| :--- | :--- | :--- |
|
| 36 |
+
| **Google** | **Willow Chip**: Error correction reduces errors as scale increases. | Superconducting |
|
| 37 |
+
| **Microsoft** | **Majorana 1**: First topological chip; Logical qubit records with partners. | Topological / Hybrid |
|
| 38 |
+
| **QuEra** | **3,000 Qubit Array**: Massive scale with neutral atoms; 96 logical qubits. | Neutral Atoms |
|
| 39 |
+
| **Quantinuum** | **Reliability**: 800x lower error rates in logical qubits (w/ Microsoft). | Trapped Ions |
|
| 40 |
+
| **IBM** | **Nighthawk Processor**: Modular scaling & hybrid supercomputing tools. | Superconducting |
|
| 41 |
+
|
| 42 |
+
> **Note:** While "Quantum Advantage" has been claimed for specific scientific problems this year, general-purpose commercial quantum computers that can break encryption or solve broad business problems are still estimated to be several years away (late 2020s to 2030s).
|
run.sh
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
[ $# -ne 1 ] && echo Need Python Script && exit
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
python -m venv venv
|
| 7 |
+
source venv/bin/activate
|
| 8 |
+
pip install -r requirements.txt
|
| 9 |
+
|
| 10 |
+
echo "======= STARTING ======" >> run.txt
|
| 11 |
+
echo $0 $@ >> run.txt
|
| 12 |
+
pwd >> run.txt
|
| 13 |
+
python $@ | tee -a run.txt
|
| 14 |
+
|
run.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
======= STARTING ======
|
| 2 |
+
run.sh cookbook-examples-gemini-3-research-agent.py
|
| 3 |
+
/Users/sree/Downloads/AI/untracked/new
|
| 4 |
+
======= STARTING ======
|
| 5 |
+
run.sh cookbook-examples-gemini-3-product-comparison-agent.py
|
| 6 |
+
/Users/sree/Downloads/AI/untracked/new
|
streamlit_app.py
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# streamlit_app.py
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
import re
|
| 5 |
+
from datetime import datetime
|
| 6 |
+
from textwrap import dedent
|
| 7 |
+
|
| 8 |
+
import streamlit as st
|
| 9 |
+
from dotenv import load_dotenv
|
| 10 |
+
|
| 11 |
+
from agno.agent import Agent
|
| 12 |
+
from agno.models.google import Gemini
|
| 13 |
+
from db import demo_db
|
| 14 |
+
|
| 15 |
+
# -------------------------------------------------------------------
|
| 16 |
+
# ENV + CONSTANTS
|
| 17 |
+
# -------------------------------------------------------------------
|
| 18 |
+
load_dotenv()
|
| 19 |
+
|
| 20 |
+
LOG_DIR = "research_notes"
|
| 21 |
+
os.makedirs(LOG_DIR, exist_ok=True)
|
| 22 |
+
|
| 23 |
+
# -------------------------------------------------------------------
|
| 24 |
+
# HELPER FUNCTIONS FOR SAVING / LISTING NOTES
|
| 25 |
+
# -------------------------------------------------------------------
|
| 26 |
+
def slugify(text: str, max_words: int = 6) -> str:
|
| 27 |
+
"""Create a short, meaningful slug from the first few words of a question."""
|
| 28 |
+
text = " ".join(text.strip().split())
|
| 29 |
+
words = text.split(" ")[:max_words]
|
| 30 |
+
short = " ".join(words)
|
| 31 |
+
slug = re.sub(r"[^a-z0-9]+", "-", short.lower()).strip("-")
|
| 32 |
+
return slug or "research-note"
|
| 33 |
+
|
| 34 |
+
def save_markdown_note(question: str, answer_md: str) -> str:
|
| 35 |
+
"""Save research result as a Markdown file and return the filepath."""
|
| 36 |
+
ts = datetime.now().strftime("%Y%m%d-%H%M%S")
|
| 37 |
+
slug = slugify(question)
|
| 38 |
+
filename = f"{ts}-{slug}.md"
|
| 39 |
+
path = os.path.join(LOG_DIR, filename)
|
| 40 |
+
|
| 41 |
+
content = f"""# Research Note: {question}
|
| 42 |
+
|
| 43 |
+
- **Saved at:** {datetime.now().isoformat(timespec='seconds')}
|
| 44 |
+
- **File:** {filename}
|
| 45 |
+
|
| 46 |
+
---
|
| 47 |
+
|
| 48 |
+
{answer_md}
|
| 49 |
+
"""
|
| 50 |
+
with open(path, "w", encoding="utf-8") as f:
|
| 51 |
+
f.write(content)
|
| 52 |
+
return path
|
| 53 |
+
|
| 54 |
+
def list_markdown_notes():
|
| 55 |
+
"""Return list of (label, path) for saved notes, most recent first."""
|
| 56 |
+
files = sorted(
|
| 57 |
+
[os.path.join(LOG_DIR, f) for f in os.listdir(LOG_DIR) if f.endswith(".md")],
|
| 58 |
+
reverse=True,
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
notes = []
|
| 62 |
+
for fpath in files:
|
| 63 |
+
fname = os.path.basename(fpath)
|
| 64 |
+
# remove timestamp and extension for label
|
| 65 |
+
if "-" in fname:
|
| 66 |
+
_, rest = fname.split("-", 1)
|
| 67 |
+
else:
|
| 68 |
+
rest = fname
|
| 69 |
+
label = rest.replace(".md", "").replace("-", " ").title()
|
| 70 |
+
notes.append((label, fpath))
|
| 71 |
+
return notes
|
| 72 |
+
|
| 73 |
+
# -------------------------------------------------------------------
|
| 74 |
+
# AGENT CONFIG (same logic as CLI)
|
| 75 |
+
# -------------------------------------------------------------------
|
| 76 |
+
research_agent = Agent(
|
| 77 |
+
name="Research Agent",
|
| 78 |
+
model=Gemini(
|
| 79 |
+
id="gemini-3-pro-preview",
|
| 80 |
+
search=True, # Enable web search
|
| 81 |
+
),
|
| 82 |
+
description=(
|
| 83 |
+
"You are a research agent with access to the web. "
|
| 84 |
+
"You can search the web and provide well-researched responses."
|
| 85 |
+
),
|
| 86 |
+
instructions=dedent(
|
| 87 |
+
"""
|
| 88 |
+
1. Search the web and provide well-researched responses.
|
| 89 |
+
|
| 90 |
+
2. With every response, you must:
|
| 91 |
+
- Include source citations with URLs when available.
|
| 92 |
+
- Distinguish facts from opinions.
|
| 93 |
+
- Note if information may be outdated.
|
| 94 |
+
|
| 95 |
+
3. Start with a concise answer, then provide supporting details.
|
| 96 |
+
|
| 97 |
+
4. Keep responses focused and scannable with clear headings.
|
| 98 |
+
"""
|
| 99 |
+
),
|
| 100 |
+
db=demo_db,
|
| 101 |
+
add_datetime_to_context=True,
|
| 102 |
+
add_history_to_context=True,
|
| 103 |
+
num_history_runs=3,
|
| 104 |
+
markdown=True,
|
| 105 |
+
)
|
| 106 |
+
|
| 107 |
+
# -------------------------------------------------------------------
|
| 108 |
+
# STREAMLIT UI
|
| 109 |
+
# -------------------------------------------------------------------
|
| 110 |
+
st.set_page_config(
|
| 111 |
+
page_title="Web-Powered AI Research Agent",
|
| 112 |
+
page_icon="π§ ",
|
| 113 |
+
layout="wide",
|
| 114 |
+
)
|
| 115 |
+
|
| 116 |
+
st.title("π§ Web-Powered AI Research Agent")
|
| 117 |
+
|
| 118 |
+
st.markdown(
|
| 119 |
+
"""
|
| 120 |
+
This app uses **Gemini 3 Pro + Agno** to build a real-time **Research Agent**.
|
| 121 |
+
|
| 122 |
+
- π Searches the web
|
| 123 |
+
- π Gives citation-backed answers
|
| 124 |
+
- π§ Separates facts vs opinions
|
| 125 |
+
- π° Notes outdated or uncertain info
|
| 126 |
+
|
| 127 |
+
This is a **100% FREE project** using a **free Gemini API key**, and we run it using **uv** instead of pip.
|
| 128 |
+
"""
|
| 129 |
+
)
|
| 130 |
+
|
| 131 |
+
# -------------------------------------------------------
|
| 132 |
+
# SIDEBAR: Saved Research Notes
|
| 133 |
+
# -------------------------------------------------------
|
| 134 |
+
with st.sidebar:
|
| 135 |
+
st.header("π Saved Research Notes")
|
| 136 |
+
|
| 137 |
+
notes = list_markdown_notes()
|
| 138 |
+
if notes:
|
| 139 |
+
labels = [lbl for (lbl, _) in notes]
|
| 140 |
+
selected_label = st.selectbox(
|
| 141 |
+
"Open a previous research note:", labels, index=0
|
| 142 |
+
)
|
| 143 |
+
load_btn = st.button("π Load Selected Note")
|
| 144 |
+
|
| 145 |
+
if load_btn:
|
| 146 |
+
path_map = {lbl: p for lbl, p in notes}
|
| 147 |
+
selected_path = path_map[selected_label]
|
| 148 |
+
with open(selected_path, "r", encoding="utf-8") as f:
|
| 149 |
+
content = f.read()
|
| 150 |
+
st.session_state["loaded_note_md"] = content
|
| 151 |
+
st.session_state["show_loaded_note"] = True
|
| 152 |
+
else:
|
| 153 |
+
st.caption("No notes yet. Run research to create your first note.")
|
| 154 |
+
|
| 155 |
+
st.markdown("---")
|
| 156 |
+
st.subheader("Run with uv")
|
| 157 |
+
st.code("uv run streamlit run streamlit_app.py", language="bash")
|
| 158 |
+
|
| 159 |
+
# -------------------------------------------------------
|
| 160 |
+
# MAIN INPUT AREA
|
| 161 |
+
# -------------------------------------------------------
|
| 162 |
+
st.markdown("### β Ask your research question")
|
| 163 |
+
|
| 164 |
+
question = st.text_area(
|
| 165 |
+
"Enter your query:",
|
| 166 |
+
value="What are the latest breakthroughs in quantum computing this year?",
|
| 167 |
+
height=120,
|
| 168 |
+
)
|
| 169 |
+
|
| 170 |
+
col1, col2 = st.columns([1, 4])
|
| 171 |
+
with col1:
|
| 172 |
+
run_button = st.button("π Run Research", type="primary")
|
| 173 |
+
with col2:
|
| 174 |
+
clear_button = st.button("π§Ή Clear")
|
| 175 |
+
|
| 176 |
+
if clear_button:
|
| 177 |
+
st.session_state.pop("loaded_note_md", None)
|
| 178 |
+
st.session_state.pop("show_loaded_note", None)
|
| 179 |
+
st.rerun()
|
| 180 |
+
|
| 181 |
+
response_container = st.container()
|
| 182 |
+
|
| 183 |
+
# -------------------------------------------------------
|
| 184 |
+
# RUN AGENT & SAVE RESULT AS MD
|
| 185 |
+
# -------------------------------------------------------
|
| 186 |
+
if run_button:
|
| 187 |
+
st.session_state["show_loaded_note"] = False # we are showing fresh result now
|
| 188 |
+
if not question.strip():
|
| 189 |
+
st.warning("Please enter a question.")
|
| 190 |
+
else:
|
| 191 |
+
with st.spinner("Researching the webβ¦"):
|
| 192 |
+
try:
|
| 193 |
+
result = research_agent.run(question)
|
| 194 |
+
except Exception as e:
|
| 195 |
+
st.error(f"β Error while running agent: {e}")
|
| 196 |
+
result = None
|
| 197 |
+
|
| 198 |
+
if result:
|
| 199 |
+
# Extract markdown content
|
| 200 |
+
if hasattr(result, "content") and result.content:
|
| 201 |
+
answer_md = result.content
|
| 202 |
+
else:
|
| 203 |
+
answer_md = str(result)
|
| 204 |
+
|
| 205 |
+
# Show on screen
|
| 206 |
+
with response_container:
|
| 207 |
+
st.markdown("### β
Answer")
|
| 208 |
+
st.markdown(answer_md)
|
| 209 |
+
|
| 210 |
+
# Save as markdown file
|
| 211 |
+
filepath = save_markdown_note(question, answer_md)
|
| 212 |
+
st.success(f"Saved this research as: `{os.path.basename(filepath)}`")
|
| 213 |
+
|
| 214 |
+
# -------------------------------------------------------
|
| 215 |
+
# SHOW LOADED NOTE (IF ANY)
|
| 216 |
+
# -------------------------------------------------------
|
| 217 |
+
if st.session_state.get("show_loaded_note") and st.session_state.get("loaded_note_md"):
|
| 218 |
+
st.markdown("### π Loaded Research Note")
|
| 219 |
+
st.markdown(st.session_state["loaded_note_md"])
|
| 220 |
+
|
| 221 |
+
# -------------------------------------------------------
|
| 222 |
+
# SAMPLE TERMINAL OUTPUT (NO WRAP)
|
| 223 |
+
# -------------------------------------------------------
|
| 224 |
+
with st.expander("π Sample Terminal Output (from notes.txt)"):
|
| 225 |
+
st.caption("This shows how the CLI version behaved before converting to Streamlit.")
|
| 226 |
+
try:
|
| 227 |
+
with open("notes.txt", "r", encoding="utf-8") as fh:
|
| 228 |
+
raw_text = fh.read()
|
| 229 |
+
|
| 230 |
+
# st.code uses <pre> with horizontal scroll and no wrapping
|
| 231 |
+
st.code(raw_text, language="text")
|
| 232 |
+
except FileNotFoundError:
|
| 233 |
+
st.info("notes.txt not found. Add it to your project folder to display here.")
|
uv.lock
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
walkthrough.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Streamlit Research Agent Walkthrough
|
| 2 |
+
|
| 3 |
+
I have successfully converted the command-line research agent script into a Streamlit web application.
|
| 4 |
+
|
| 5 |
+
## Changes
|
| 6 |
+
- Added `streamlit` to `pyproject.toml`.
|
| 7 |
+
- Created `app.py` which contains the Streamlit application logic.
|
| 8 |
+
- It initializes the `Research Agent` using `agno` and `google-genai`.
|
| 9 |
+
- It provides a chat interface for users to interact with the agent.
|
| 10 |
+
- It displays the agent's responses with streaming.
|
| 11 |
+
|
| 12 |
+
## Verification Results
|
| 13 |
+
|
| 14 |
+
### Automated Verification
|
| 15 |
+
I ran the application using `uv run streamlit run app.py` and verified it using a browser subagent.
|
| 16 |
+
|
| 17 |
+
- **URL**: http://localhost:8501
|
| 18 |
+
- **Page Title**: "Research Agent"
|
| 19 |
+
- **Chat Input**: Present with placeholder "What would you like to research?"
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
|
| 23 |
+
## How to Run
|
| 24 |
+
To run the application, execute the following command in your terminal:
|
| 25 |
+
|
| 26 |
+
```bash
|
| 27 |
+
uv run streamlit run app.py
|
| 28 |
+
```
|