Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

First_Agentic_AI - LangChain Research Agent

An autonomous research assistant built with LangChain and Google Gemini. Give it a topic: it searches Wikipedia and the live web (DuckDuckGo), reasons step-by-step via tool-calling, and returns a structured summary with sources - optionally saved to a file.

Inspired by Tech With Tim's tutorial, then extended with structured Pydantic outputs and a save-to-file tool.

What it does

  • Tool-calling agent - LangChain create_tool_calling_agent with ReAct-style reasoning decides when to search, summarize, or save
  • Tools (tools.py): Wikipedia fetch + summarize, DuckDuckGo web search, timestamped file saver (research_output.txt)
  • Structured output - Pydantic models: topic, summary, sources, tools used
  • LLM - gemini-2.5-flash (free tier); swappable for OpenAI/Groq
  • Verbose mode - watch the agent think in the terminal

Stack

Python · LangChain · Google Gemini API · DuckDuckGo Search · Wikipedia API · Pydantic

Screenshot

Run locally

Prereqs: Python 3.10+, a free Gemini API key

git clone https://github.com/prsdx/First_Agentic_AI
cd First_Agentic_AI
python -m venv env
env\Scripts\activate        # Windows
# source env/bin/activate  # macOS/Linux
pip install -r requirements.txt

Create a .env file in the root:

GOOGLE_API_KEY=your_gemini_api_key_here

Run it:

python main.py

Enter a topic, watch the agent reason, then check research_output.txt (auto-generated) for saved results.

Files

File Purpose
main.py Entrypoint: LLM init, prompt, agent executor
tools.py Wikipedia / DuckDuckGo / file-saver tool definitions
requirements.txt Pinned dependencies

Example trace (illustrative)

> Entering new AgentExecutor chain...
Thought: I need to research this topic. I will start with Wikipedia.
Action: wiki_tool
Action Input: history of AI agents
Observation: [Wikipedia snippet...]
Thought: Good overview. Now web search for recent developments.
Action: search
Action Input: history of AI agents
Observation: [DuckDuckGo results...]
Thought: Time to summarize and save.
Action: save_text_to_file
Observation: Data successfully saved to research_output.txt
> Finished chain.

Credits

About

LangChain research agent — Gemini tool-calling with live web search for multi-hop research questions

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages