Skip to content

Commit f7c306e

Browse files
committed
added financial ai agent and video summarizer project and blog
1 parent d81059a commit f7c306e

18 files changed

Lines changed: 2143 additions & 18 deletions

blog.html

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,54 @@ <h2 class="section-heading">Recent Posts</h2>
8989

9090
<!-- blogs -->
9191

92+
<article class="blog-post" data-tags="python,streamlit,agno,google gemini,duckduckgo api,google-generativeai,python-dotenv">
93+
<h3 class="post-meta">
94+
<a href="posts/building-an-intelligent-video-analyst-crafting-the-agents-brain-part-2.html">Building an Intelligent Video Analyst: Crafting the Agent&#39;s Brain (Part 2)</a>
95+
</h3>
96+
97+
<p class="section-label">Published on: 2025-09-22</p>
98+
99+
<p>A robust pipeline is just the beginning; the real intelligence comes from the agent's 'brain.' This post is a deep dive into the art of prompt engineering, showing how carefully crafted instructions enable our `Agno` agent to not only analyze video with Google Gemini but also to autonomously use web search tools for a richer, more contextual analysis. See how the final pieces came together to create an intelligent video research assistant.</p>
100+
101+
102+
<div class="tech-stack">
103+
104+
</div>
105+
106+
</article>
107+
108+
<article class="blog-post" data-tags="python,streamlit,agno,google gemini,duckduckgo api,google-generativeai,python-dotenv">
109+
<h3 class="post-meta">
110+
<a href="posts/building-an-intelligent-video-analyst-the-foundational-pipeline-part-1.html">Building an Intelligent Video Analyst: The Foundational Pipeline (Part 1)</a>
111+
</h3>
112+
113+
<p class="section-label">Published on: 2025-09-21</p>
114+
115+
<p>My journey to build an intelligent video analyst started with what seemed like a simple task: uploading a video. I quickly hit a wall with Google's asynchronous File API, a common real-world challenge that requires more than just basic code. This post covers the architectural decisions, the code for building a resilient video processing pipeline, and the "aha!" moment that made it all work, setting the stage for the AI agent.</p>
116+
117+
118+
<div class="tech-stack">
119+
120+
</div>
121+
122+
</article>
123+
124+
<article class="blog-post" data-tags="python,agno,groq,agentic ai,multi-agent systems,fastapi,duckduckgotools,yfinancetools,google api">
125+
<h3 class="post-meta">
126+
<a href="posts/multi-agent-chaos-when-ai-agents-wouldnt-cooperate.html">Multi-Agent Chaos: When AI Agents Wouldn&#39;t Cooperate</a>
127+
</h3>
128+
129+
<p class="section-label">Published on: 2025-09-20</p>
130+
131+
<p>My journey to build an AI financial analyst started with a single, confused bot that failed miserably. The solution wasn't a better model, but a better architecture: a coordinated team of AI specialists. Here's a deep dive into the code, the struggles, and the key lessons learned from building a multi-agent system with Agno and Groq.</p>
132+
133+
134+
<div class="tech-stack">
135+
136+
</div>
137+
138+
</article>
139+
92140
<article class="blog-post" data-tags="aws,python,flask,scikit-learn,pandas,numpy,aws ec2,aws elastic beanstalk,mlops">
93141
<h3 class="post-meta">
94142
<a href="posts/student-performance-prediction-when-simple-isnt-always-better.html">Student Performance Prediction: When Simple Isn&#39;t Always Better</a>
@@ -256,18 +304,32 @@ <h2 class="section-heading">Filter by Technology</h2>
256304

257305
<button class="tag filter-tag" data-tag="aws sagemaker">AWS SageMaker</button>
258306

307+
<button class="tag filter-tag" data-tag="agentic ai">Agentic AI</button>
308+
309+
<button class="tag filter-tag" data-tag="agno">Agno</button>
310+
259311
<button class="tag filter-tag" data-tag="cloudwatch">CloudWatch</button>
260312

261313
<button class="tag filter-tag" data-tag="dagshub">Dagshub</button>
262314

263315
<button class="tag filter-tag" data-tag="docker">Docker</button>
264316

317+
<button class="tag filter-tag" data-tag="duckduckgo api">DuckDuckGo API</button>
318+
319+
<button class="tag filter-tag" data-tag="duckduckgotools">DuckDuckGoTools</button>
320+
265321
<button class="tag filter-tag" data-tag="fastapi">FastAPI</button>
266322

267323
<button class="tag filter-tag" data-tag="flask">Flask</button>
268324

269325
<button class="tag filter-tag" data-tag="github actions">GitHub Actions</button>
270326

327+
<button class="tag filter-tag" data-tag="google api">Google API</button>
328+
329+
<button class="tag filter-tag" data-tag="google gemini">Google Gemini</button>
330+
331+
<button class="tag filter-tag" data-tag="groq">Groq</button>
332+
271333
<button class="tag filter-tag" data-tag="huggingface transformers">HuggingFace Transformers</button>
272334

273335
<button class="tag filter-tag" data-tag="mlops">MLOps</button>
@@ -276,6 +338,8 @@ <h2 class="section-heading">Filter by Technology</h2>
276338

277339
<button class="tag filter-tag" data-tag="mongodb">MongoDB</button>
278340

341+
<button class="tag filter-tag" data-tag="multi-agent systems">Multi-Agent Systems</button>
342+
279343
<button class="tag filter-tag" data-tag="nlp">NLP</button>
280344

281345
<button class="tag filter-tag" data-tag="numpy">NumPy</button>
@@ -288,10 +352,18 @@ <h2 class="section-heading">Filter by Technology</h2>
288352

289353
<button class="tag filter-tag" data-tag="scikit-learn">Scikit-learn</button>
290354

355+
<button class="tag filter-tag" data-tag="streamlit">Streamlit</button>
356+
291357
<button class="tag filter-tag" data-tag="tensorboard">TensorBoard</button>
292358

293359
<button class="tag filter-tag" data-tag="weights &amp; biases">Weights &amp; Biases</button>
294360

361+
<button class="tag filter-tag" data-tag="yfinancetools">YFinanceTools</button>
362+
363+
<button class="tag filter-tag" data-tag="google-generativeai">google-generativeai</button>
364+
365+
<button class="tag filter-tag" data-tag="python-dotenv">python-dotenv</button>
366+
295367
<button class="tag filter-tag" data-tag="torchvision">torchvision</button>
296368

297369
</div>
Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
# Building a Multi-Agent Financial AI System: My Journey from Confusion to Clarity
2+
3+
*Or how I learned to stop worrying and love coordinating AI agents*
4+
5+
---
6+
7+
## Why I Built This (And Why You Might Want To Too)
8+
9+
Let me be honest – I didn't start this project thinking I'd build a multi-agent system. I just wanted to automate my stock research because manually checking Yahoo Finance, reading analyst reports, and googling market sentiment was eating up way too much of my time.
10+
11+
What started as "let me just pull some stock data with Python" turned into a fascinating deep dive into AI agents, and honestly, some pretty frustrating debugging sessions. But the end result? A system that can analyze any stock in seconds, pulling real-time data and current market sentiment simultaneously.
12+
13+
If you're curious about AI agents, frustrated with manual financial research, or just want to see how different AI models can work together, this might be interesting for you.
14+
15+
## The "Aha!" Moment: Why Multiple Agents?
16+
17+
My first attempt was simple – one AI agent with access to Yahoo Finance. It worked, but the analysis felt incomplete. I'd get great financial data but miss the context of what was happening in the market.
18+
19+
Then I tried giving one agent access to both financial data AND web search. Big mistake. The agent got confused about which tool to use when, and the responses were inconsistent. Sometimes it would search the web for stock prices (which it already had access to via Yahoo Finance), other times it would try to get news from financial APIs.
20+
21+
That's when I realized: **different tasks need different specialists.**
22+
23+
- **Financial data extraction**: Needs precision, structured queries, and understanding of financial metrics
24+
- **Market research**: Needs broad search capabilities, source evaluation, and context synthesis
25+
26+
So I built two specialized agents and let a coordinator manage them. Game changer.
27+
28+
## Setting Up: Where I Went Wrong (So You Don't Have To)
29+
30+
### The API Key Dance
31+
32+
Let's start with the painful part – getting your API keys sorted. I made this harder than it needed to be.
33+
34+
**What I did wrong first:**
35+
```bash
36+
# I thought I could just export these in terminal
37+
export GROQ_API_KEY="your_key_here"
38+
export AGNO_API_KEY="your_other_key_here"
39+
```
40+
41+
This works... until you close your terminal. Then you're back to square one.
42+
43+
**What actually works:**
44+
```bash
45+
# Copy the sample file
46+
cp .env.sample .env
47+
48+
# Edit .env with your actual keys
49+
GROQ_API_KEY=your_actual_groq_key_here
50+
AGNO_API_KEY=your_actual_agno_key_here
51+
```
52+
53+
Pro tip: Get your Groq API key from [console.groq.com](https://console.groq.com/keys) first. It's free and fast. The Agno key is only needed if you want the playground interface.
54+
55+
### Dependencies Hell (And How I Escaped)
56+
57+
My requirements.txt went through several iterations:
58+
59+
```python
60+
# Version 1 (didn't work)
61+
agno
62+
groq
63+
yfinance
64+
duckduckgo-search
65+
python-dotenv
66+
fastapi
67+
68+
# Version 2 (worked but was slow)
69+
agno==0.1.0
70+
groq==0.8.0
71+
# ... specific versions
72+
73+
# Final version (current)
74+
agno
75+
groq
76+
yfinance
77+
duckduckgo-search
78+
python-dotenv
79+
fastapi[standard] # This [standard] part was key!
80+
```
81+
82+
The `fastapi[standard]` inclusion was crucial for the playground to work properly. Spent two hours debugging why the web interface wasn't starting before I figured this out.
83+
84+
## The Code: How It Actually Works
85+
86+
### Agent Architecture (The Fun Part)
87+
88+
Here's the core of my system:
89+
90+
```python
91+
# Web Search Agent - My "market researcher"
92+
web_search_agent = Agent(
93+
name="Web Search Agent",
94+
role="Search the web for the information",
95+
model=Groq(id="llama-3.1-8b-instant"),
96+
tools=[DuckDuckGoTools()],
97+
instructions=["Always include sources"],
98+
show_tool_calls=True,
99+
markdown=True,
100+
)
101+
102+
# Finance Agent - My "data analyst"
103+
finance_agent = Agent(
104+
name="Finance AI Agent",
105+
model=Groq(id="gemma2-9b-it"),
106+
tools=[
107+
YFinanceTools(
108+
stock_price=True,
109+
analyst_recommendations=True,
110+
stock_fundamentals=True,
111+
company_news=True,
112+
),
113+
],
114+
instructions="Use tables to display the data",
115+
show_tool_calls=True,
116+
markdown=True,
117+
)
118+
119+
# The coordinator - brings it all together
120+
multi_ai_agent = Agent(
121+
team=[web_search_agent, finance_agent],
122+
model=Groq(id="gemma2-9b-it"),
123+
instructions=["Always include sources", "Use table to display the data"],
124+
show_tool_calls=True,
125+
markdown=True,
126+
)
127+
```
128+
129+
### Why These Specific Models?
130+
131+
I experimented with different model combinations:
132+
133+
- **Llama 3.1 8B Instant** for web search: Fast, good at parsing search results, doesn't overthink
134+
- **Gemma2 9B IT** for financial analysis: Better at structured data interpretation and mathematical reasoning
135+
136+
Initially, I used the same model for both agents, but the web search agent was too slow, and the finance agent made too many unnecessary web searches.
137+
138+
### The Tools: My Digital Swiss Army Knife
139+
140+
**YFinanceTools** - This was surprisingly comprehensive:
141+
```python
142+
YFinanceTools(
143+
stock_price=True, # Real-time prices
144+
analyst_recommendations=True, # Buy/sell/hold ratings
145+
stock_fundamentals=True, # P/E, market cap, etc.
146+
company_news=True, # Latest company-specific news
147+
)
148+
```
149+
150+
**DuckDuckGoTools** - My web search workhorse:
151+
152+
- No API limits (unlike Google)
153+
- Good at finding recent news
154+
- Automatically includes sources
155+
- Doesn't get blocked by rate limits
156+
157+
### The Workflow in Action
158+
159+
When I ask: *"Analyze Apple stock and give me the current sentiment"*
160+
161+
1. **Coordinator** receives the query and thinks: "This needs both financial data and market research"
162+
2. **Finance Agent** kicks in:
163+
- Calls `YFinanceTools.stock_price("AAPL")`
164+
- Calls `YFinanceTools.analyst_recommendations("AAPL")`
165+
- Formats data into neat tables
166+
3. **Web Search Agent** simultaneously:
167+
- Searches for "Apple stock market sentiment news"
168+
- Finds recent articles and analyst reports
169+
- Provides source links
170+
4. **Coordinator** combines everything into a comprehensive analysis
171+
172+
The whole process takes about 30-60 seconds and gives me information that would take me 15-20 minutes to gather manually.
173+
174+
## My Biggest Challenges (And How I Solved Them)
175+
176+
### Challenge 1: Agent Confusion
177+
**Problem**: My agents were stepping on each other's toes. The finance agent would try to search the web for stock prices it already had access to.
178+
179+
**Solution**: Clear role definitions and specific instructions. I learned that AI agents need very explicit boundaries.
180+
181+
**What worked**:
182+
```python
183+
# Instead of vague instructions
184+
instructions="Get financial information"
185+
186+
# I became specific
187+
instructions="Use tables to display the data. Only use YFinance tools for financial data."
188+
```
189+
190+
### Challenge 2: Inconsistent Output Formats
191+
**Problem**: Sometimes I'd get markdown tables, sometimes plain text, sometimes a mix.
192+
193+
**Solution**: Standardized instructions across all agents and enabled `markdown=True` everywhere.
194+
195+
### Challenge 3: API Rate Limits
196+
**Problem**: During testing, I kept hitting rate limits with various APIs.
197+
198+
**Solution**: This is why I switched to DuckDuckGo for web search – no API limits, and it's actually quite good for financial news.
199+
200+
### Challenge 4: Environment Variables Not Loading
201+
**Problem**: The classic "it works on my machine" scenario. Environment variables weren't loading consistently.
202+
203+
**Solution**:
204+
```python
205+
from dotenv import load_dotenv
206+
load_dotenv() # This MUST be called before accessing env vars
207+
```
208+
209+
Such a simple fix, but it took me embarrassingly long to figure out.
210+
211+
## What I Learned Along the Way
212+
213+
> 1. Agent Specialization is Key
214+
Don't try to make one agent do everything. Specialized agents with clear roles perform much better than generalists.
215+
216+
> 2. Instructions Matter More Than You Think
217+
The difference between "get financial data" and "use tables to display financial data from YFinance tools only" is huge in terms of output quality.
218+
219+
> 3. Tool Selection is Critical
220+
I initially wanted to use multiple financial APIs, but YFinance alone covers 90% of what I need. Sometimes less is more.
221+
222+
> 4. Debugging Multi-Agent Systems is... Interesting
223+
Setting `show_tool_calls=True` was a lifesaver. Being able to see which agent called which tool when helped me understand the flow and debug issues.
224+
225+
> 5. The Playground is Worth the Setup
226+
Initially, I thought the playground was just a nice-to-have. Wrong. It's incredibly useful for testing different queries and understanding how agents respond to various inputs.
227+
228+
## My Takeaways and What's Next
229+
230+
### What Worked Really Well:
231+
- **Multi-agent architecture**: The specialization approach paid off
232+
- **Tool integration**: YFinance + DuckDuckGo covers most financial research needs
233+
- **Groq models**: Fast, reliable, and cost-effective
234+
- **Interactive playground**: Great for experimentation
235+
236+
### What I'd Do Differently:
237+
- **Start with clearer agent roles**: Would have saved hours of debugging
238+
- **Set up better error handling**: Currently, if one agent fails, everything stops
239+
- **Add more financial metrics**: Could integrate more sophisticated analysis tools
240+
241+
### What's Next:
242+
I'm thinking about adding:
243+
244+
- **Portfolio analysis agent**: For analyzing multiple stocks at once
245+
- **Technical analysis tools**: Chart patterns, indicators, etc.
246+
- **Sentiment scoring**: Quantifying market sentiment from news
247+
- **Alert system**: Notifications when stocks hit certain conditions
248+
249+
## Want to Try It Yourself?
250+
251+
If you're interested in building something similar:
252+
253+
1. **Start simple**: One agent, one tool, one specific task
254+
2. **Add complexity gradually**: Don't try to build everything at once
255+
3. **Test extensively**: Use the playground to understand agent behavior
256+
4. **Focus on instructions**: They're more important than you think
257+
258+
The full code is available [in my repository], and honestly, half the learning was in the debugging process. Don't be discouraged if it doesn't work perfectly the first time – that's part of the fun.
259+
260+
## Final Thoughts
261+
262+
Building this system taught me that AI agents are powerful, but they're not magic. They need clear instructions, appropriate tools, and careful coordination. The technology is there, but the art is in the orchestration.
263+
264+
Also, there's something deeply satisfying about asking your computer "How's Tesla doing?" and getting a comprehensive analysis with real-time data, analyst opinions, and market context in under a minute.
265+
266+
If you build something similar, I'd love to hear about it. What tools did you use? What challenges did you face? How did you solve them?
267+
268+
---
269+
270+
*Have questions about the implementation or want to share your own multi-agent adventures? Feel free to reach out or check out the code repository.*

0 commit comments

Comments
 (0)