← Back to Day 2
Lab: Tool-Use

The Multi-Tool Prototype

From "Chatbot" to "Search Agent."

Objective

We will build an agent that doesn't guess-and-hallucinate. We will build one that follows a strict protocol: Plan -> Search -> Verify -> Answer.


Part 1: The System Prompt (Logic)

Open Google AI Studio. We will design the brain first.

1Define the Persona

Paste this into the System Instructions:

You are ScholarBot. You NEVER answer from your own training data if the question is about current events or specific citations.
Protocol:
1. Receive Query.
2. Formulate 3 distinct search queries.
3. [ACTION: Search]
4. Compare results.
5. Synthesize answer with inline citations.

2Test the Constraint

Ask it: "What is the latest population of Bloomington, IL?"

Success Criteria: It should STOP and explicitly say "I need to search for this" (even if it can't actually search yet in this sandbox, it should roleplay the action).


Part 2: The Deployment (HuggingFace)

Now we make it real using Python and Streamlit on HuggingFace Spaces.

1Create Space

Go to huggingface.co/spaces and create a new Space. Select "Streamlit" as the SDK.

2The Code

Use your VS Code Pair Programmer (GitHub Copilot) to generate the script. Prompt:

"Write a Python Streamlit app that takes a user query, uses the Google Search API (or DuckDuckGo), and summarizes the top 3 results."

3Deploy

Commit the `app.py` file to your HuggingFace repo. Watch it build. You now have a live URL to share.