|
4 | 4 | "cell_type": "markdown", |
5 | 5 | "metadata": {}, |
6 | 6 | "source": [ |
7 | | - "# Stock Market Tracker - Minimal Agent Demo\n", |
| 7 | + "# Stock Market Tracker - Multi-step Agent in a single prompt\n", |
8 | 8 | "\n", |
9 | | - "This notebook shows how **easy** it is to build an autonomous agent with aisuite + MCP tools.\n", |
| 9 | + "This notebook shows how **easy** it is to build a multi-step agent using a single prompt with aisuite + MCP tools.\n", |
10 | 10 | "\n", |
11 | | - "**What it does**: Fetches latest stock market data and creates an HTML dashboard - all autonomously!\n", |
| 11 | + "**What it does**: 1. Fetches latest stock market data, 2. Analyzes content and 3. Creates an HTML dashboard.\n", |
12 | 12 | "\n", |
13 | | - "**Requirements**: `ANTHROPIC_API_KEY` in your `.env` file" |
| 13 | + "**Requirements**: `OPENAI_API_KEY` in your `.env` file" |
14 | 14 | ] |
15 | 15 | }, |
16 | 16 | { |
|
56 | 56 | "cell_type": "markdown", |
57 | 57 | "metadata": {}, |
58 | 58 | "source": [ |
59 | | - "## Craft instructions, and run Agent." |
| 59 | + "## Craft instructions" |
60 | 60 | ] |
61 | 61 | }, |
62 | 62 | { |
|
112 | 112 | "print(\"✓ Agent instructions defined\")" |
113 | 113 | ] |
114 | 114 | }, |
| 115 | + { |
| 116 | + "cell_type": "markdown", |
| 117 | + "metadata": {}, |
| 118 | + "source": [ |
| 119 | + "## Run Agent with MCP tools." |
| 120 | + ] |
| 121 | + }, |
115 | 122 | { |
116 | 123 | "cell_type": "code", |
117 | 124 | "execution_count": 3, |
|
126 | 133 | "✓ DASHBOARD CREATED!\n", |
127 | 134 | "============================================================\n", |
128 | 135 | "\n", |
129 | | - "Summary:\n", |
130 | | - "- File created: stock_dashboard.html with a professional responsive dashboard.\n", |
131 | | - "- Number of stocks: 5\n", |
132 | | - "- Top 3 gainers (by % change): \n", |
133 | | - " 1) GLTO +248.49%\n", |
134 | | - " 2) COGT +119.03%\n", |
135 | | - " 3) NVTS +22.45%\n" |
| 136 | + "The stock market dashboard for November 11, 2025, has been successfully created and saved as 'stock_dashboard.html'. It displays the top 5 stock gainers with a professional layout. Here are the top 3 gainers:\n", |
| 137 | + "\n", |
| 138 | + "1. **Cogent Biosciences, Inc. (COGT)** - +119.03%\n", |
| 139 | + "2. **Navitas Semiconductor Corporation (NVTS)** - +22.45%\n", |
| 140 | + "3. **Opendoor Technologies Inc. (OPEN)** - +21.77%\n", |
| 141 | + "\n", |
| 142 | + "The dashboard includes modern typography, responsive design, and highlights positive percentage changes in green.\n" |
136 | 143 | ] |
137 | 144 | } |
138 | 145 | ], |
|
142 | 149 | "tools = fetch_mcp.get_callable_tools() + filesystem_mcp.get_callable_tools()\n", |
143 | 150 | "\n", |
144 | 151 | "response = client.chat.completions.create(\n", |
145 | | - " model=\"openai:gpt-5\",\n", |
| 152 | + " model=\"openai:gpt-4o\",\n", |
146 | 153 | " messages=[{\"role\": \"user\", \"content\": prompt}],\n", |
147 | 154 | " tools=tools,\n", |
148 | 155 | " max_turns=20\n", |
|
181 | 188 | " " |
182 | 189 | ], |
183 | 190 | "text/plain": [ |
184 | | - "<IPython.lib.display.IFrame at 0x10b617b60>" |
| 191 | + "<IPython.lib.display.IFrame at 0x114517b60>" |
185 | 192 | ] |
186 | 193 | }, |
187 | 194 | "metadata": {}, |
|
232 | 239 | "\n", |
233 | 240 | "## That's It!\n", |
234 | 241 | "\n", |
235 | | - "In just **~30 lines of code**, you built an autonomous agent that:\n", |
| 242 | + "In just **few lines of code**, you built an autonomous agent that:\n", |
236 | 243 | "- ✅ Fetches live stock data from the web\n", |
237 | 244 | "- ✅ Creates a beautiful HTML dashboard\n", |
238 | 245 | "- ✅ Saves it to disk\n", |
239 | | - "- ✅ All without manual tool execution!\n", |
240 | 246 | "\n", |
241 | 247 | "**Try it yourself**:\n", |
242 | | - "- Modify the prompt to fetch different data\n", |
243 | | - "- Change the output format (JSON, CSV, etc.)\n", |
| 248 | + "- Modify the prompt to fetch TOP losers and gainers.\n", |
| 249 | + "- Modify to fetch data across multiple days.\n", |
| 250 | + "- Modify to fetch headlines from any Finance News website to explain why stocks rose or fell. (NOTE: Many websites do not like automated calls - be mindful of their policies.)\n", |
| 251 | + "- Try asking Agent to plot a graph with the data in the HTML page.\n", |
244 | 252 | "- Add more MCP tools (memory, search, etc.)\n", |
245 | 253 | "\n", |
| 254 | + "Remember to **increase max_turns** to a higher number if you increase the complexity of the tasks.\n", |
| 255 | + "\n", |
246 | 256 | "**Learn more**: Check out other notebooks in `examples/agents/`" |
247 | 257 | ] |
248 | 258 | } |
|
0 commit comments