diff --git a/docs/notebooks/llamastack_agents_getting_started_examples.ipynb b/docs/notebooks/llamastack_agents_getting_started_examples.ipynb index 3101be93c..1ac1a2f92 100644 --- a/docs/notebooks/llamastack_agents_getting_started_examples.ipynb +++ b/docs/notebooks/llamastack_agents_getting_started_examples.ipynb @@ -4,27 +4,31 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Llama Stack Agents - Complete Guide\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/meta-llama/llama-stack/blob/main/docs/notebooks/llamastack_agents_getting_started_examples.ipynb)\n", "\n", - "This notebook provides a comprehensive guide to building agents with Llama Stack, covering:\n", + "# Llama Stack Agents - Getting Started Guide\n", "\n", - "1. **Basic Agent Example** - Simple agent creation and conversation\n", - "2. **Advanced Agent Features** - RAG, multi-turn conversations\n", - "3. **MCP Tools Integration** - Model Context Protocol tools for extended capabilities\n", + "This notebook provides a comprehensive introduction to building AI agents with Llama Stack. The Agent SDK is built on top of an open source version of **OpenAI's Responses+ APIs**, providing a standardized interface for agent workflows.\n", + "\n", + "## What You'll Learn\n", + "\n", + "1. **Basic Agent Creation** - Simple Q&A agents with streaming\n", + "2. **Multi-Turn Conversations** - Maintaining context across conversations\n", + "3. **RAG Integration** - Adding knowledge bases to your agents \n", + "4. **MCP Tools** - Extending agents with Model Context Protocol tools\n", "\n", "## Prerequisites\n", "\n", - "Before running this notebook, ensure:\n", - "- ✅ Llama Stack server is running: `llama stack run starter --port 8321`\n", - "- ✅ Ollama (or vllm) is running\n", - "- ✅ A model is available: `llama3.3:70b`\n", + "- Llama Stack server running: `llama stack run starter --port 8321`\n", + "- A model provider configured (Ollama, Fireworks, etc.)\n", + "- Python 3.10+\n", "\n", "## Setup" ] }, { "cell_type": "code", - "execution_count": 119, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -53,7 +57,7 @@ }, { "cell_type": "code", - "execution_count": 120, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -91,7 +95,7 @@ }, { "cell_type": "code", - "execution_count": 121, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -105,7 +109,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "✅ Created session: conv_fc6e84e0499f522e30a4c91e6a3f13d6f03fa326386c403b\n" + "✅ Created session: conv_e6afd7aaa97b49ce8f4f96a801b07893d9cb784d72e53e3c\n" ] } ], @@ -118,7 +122,7 @@ }, { "cell_type": "code", - "execution_count": 122, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -134,9 +138,9 @@ "text": [ "User: What is the capital of France? Please explain briefly.\n", "\n", - "Assistant: The capital of France is Paris. It's a city known for its iconic landmarks like the Eiffel Tower, art museums, and historic architecture, serving as the country's political, cultural, and economic center.The capital of France is Paris. It's a city known for its iconic landmarks like the Eiffel Tower, art museums, and historic architecture, serving as the country's political, cultural, and economic center.\n", + "Assistant: The capital of France is Paris. It's the country's largest city, known for iconic landmarks like the Eiffel Tower, Notre-Dame Cathedral, and the Louvre Museum, serving as the center of French politics, culture, and economy.The capital of France is Paris. It's the country's largest city, known for iconic landmarks like the Eiffel Tower, Notre-Dame Cathedral, and the Louvre Museum, serving as the center of French politics, culture, and economy.\n", "\n", - "✅ Response captured: 204 characters\n" + "✅ Response captured: 223 characters\n" ] } ], @@ -171,14 +175,14 @@ }, { "cell_type": "code", - "execution_count": 123, + "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "INFO:httpx:HTTP Request: DELETE http://localhost:8321/v1/conversations/conv_fc6e84e0499f522e30a4c91e6a3f13d6f03fa326386c403b \"HTTP/1.1 200 OK\"\n" + "INFO:httpx:HTTP Request: DELETE http://localhost:8321/v1/conversations/conv_e6afd7aaa97b49ce8f4f96a801b07893d9cb784d72e53e3c \"HTTP/1.1 200 OK\"\n" ] }, { @@ -219,16 +223,9 @@ }, { "cell_type": "code", - "execution_count": 124, + "execution_count": 6, "metadata": {}, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "✅ Created conversation agent\n" - ] - }, { "name": "stderr", "output_type": "stream", @@ -240,7 +237,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "✅ Created session: conv_53b1fa277c2b51b59846a499a4a8f4fb264c86d50fe03b30\n" + "✅ Created conversation agent\n", + "✅ Created session: conv_936121c2e27b7d1f7d3f0b6a62adce867d79268f5f9ce265\n" ] } ], @@ -260,21 +258,9 @@ }, { "cell_type": "code", - "execution_count": 125, + "execution_count": 7, "metadata": {}, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "============================================================\n", - "Turn 1\n", - "============================================================\n", - "User: My name is Alice and I'm learning about AI.\n", - "Assistant: " - ] - }, { "name": "stderr", "output_type": "stream", @@ -286,7 +272,12 @@ "name": "stdout", "output_type": "stream", "text": [ - "Nice to meet you, Alice! Learning about AI can be a fascinating topic. There's so much to explore, from machine learning and natural language processing to computer vision and robotics. What specific area of AI are you most interested in or would you like to start with the basics? I'm here to help and provide guidance as you learn.Nice to meet you, Alice! Learning about AI can be a fascinating topic. There's so much to explore, from machine learning and natural language processing to computer vision and robotics. What specific area of AI are you most interested in or would you like to start with the basics? I'm here to help and provide guidance as you learn.\n", + "\n", + "============================================================\n", + "Turn 1\n", + "============================================================\n", + "User: My name is Alice and I'm learning about AI.\n", + "Assistant: Nice to meet you, Alice! It's great that you're interested in learning about AI. What aspects of AI would you like to explore? Are you curious about machine learning, natural language processing, or something else? I'll be happy to help and provide information tailored to your interests.Nice to meet you, Alice! It's great that you're interested in learning about AI. What aspects of AI would you like to explore? Are you curious about machine learning, natural language processing, or something else? I'll be happy to help and provide information tailored to your interests.\n", "\n", "============================================================\n", "Turn 2\n", @@ -306,63 +297,47 @@ "name": "stdout", "output_type": "stream", "text": [ - "As a beginner, it's essential to start with resources that are easy to understand and provide a solid foundation in AI concepts. Here are some popular resources:\n", + "As a beginner, it's essential to start with resources that provide a solid foundation in AI concepts. Here are some recommendations:\n", "\n", - "**Online Courses:**\n", + "1. **Online Courses**:\n", + "\t* Andrew Ng's Machine Learning course on Coursera: A popular and comprehensive introduction to machine learning.\n", + "\t* Stanford University's Natural Language Processing with Deep Learning Specialization on Coursera: Covers NLP fundamentals and deep learning techniques.\n", + "2. **Books**:\n", + "\t* \"Introduction to Artificial Intelligence\" by Philip C. Jackson Jr.: A gentle introduction to AI concepts, including machine learning and computer vision.\n", + "\t* \"Deep Learning\" by Ian Goodfellow, Yoshua Bengio, and Aaron Courville: A detailed book on deep learning techniques, although it may require some prior knowledge of linear algebra and calculus.\n", + "3. **Websites and Blogs**:\n", + "\t* Machine Learning Mastery: A website offering tutorials, examples, and explanations on various machine learning topics.\n", + "\t* KDnuggets: A popular blog covering AI, machine learning, and data science news, tutorials, and research papers.\n", + "4. **YouTube Channels**:\n", + "\t* 3Blue1Brown (Grant Sanderson): Engaging video explanations on AI, machine learning, and linear algebra concepts.\n", + "\t* Sentdex: Offers video tutorials on various AI topics, including machine learning, deep learning, and computer vision.\n", + "5. **Communities and Forums**:\n", + "\t* Kaggle: A platform for data science competitions and hosting datasets, where you can learn from others and participate in discussions.\n", + "\t* Reddit's r/MachineLearning and r/AI: Active communities discussing AI-related topics, sharing resources, and providing feedback on projects.\n", "\n", - "1. **Coursera - Machine Learning by Andrew Ng**: A fantastic course that covers the basics of machine learning.\n", - "2. **edX - Introduction to Artificial Intelligence**: A broad introduction to AI, covering topics like computer vision, robotics, and natural language processing.\n", - "3. **Udemy - Artificial Intelligence for Beginners**: A beginner-friendly course that explores AI fundamentals.\n", + "Remember, learning about AI is a continuous process. Start with the basics, build projects, and gradually move on to more advanced topics. Practice and experimentation are key to gaining hands-on experience.\n", "\n", - "**Websites and Blogs:**\n", + "What specific area of AI would you like to explore first, Alice?As a beginner, it's essential to start with resources that provide a solid foundation in AI concepts. Here are some recommendations:\n", "\n", - "1. **Towards Data Science**: A great blog that features articles on machine learning, AI, and data science.\n", - "2. **AI Alignment Forum**: A website that discusses the latest developments in AI research and applications.\n", - "3. **KDnuggets**: A popular blog that covers AI, machine learning, and data science topics.\n", + "1. **Online Courses**:\n", + "\t* Andrew Ng's Machine Learning course on Coursera: A popular and comprehensive introduction to machine learning.\n", + "\t* Stanford University's Natural Language Processing with Deep Learning Specialization on Coursera: Covers NLP fundamentals and deep learning techniques.\n", + "2. **Books**:\n", + "\t* \"Introduction to Artificial Intelligence\" by Philip C. Jackson Jr.: A gentle introduction to AI concepts, including machine learning and computer vision.\n", + "\t* \"Deep Learning\" by Ian Goodfellow, Yoshua Bengio, and Aaron Courville: A detailed book on deep learning techniques, although it may require some prior knowledge of linear algebra and calculus.\n", + "3. **Websites and Blogs**:\n", + "\t* Machine Learning Mastery: A website offering tutorials, examples, and explanations on various machine learning topics.\n", + "\t* KDnuggets: A popular blog covering AI, machine learning, and data science news, tutorials, and research papers.\n", + "4. **YouTube Channels**:\n", + "\t* 3Blue1Brown (Grant Sanderson): Engaging video explanations on AI, machine learning, and linear algebra concepts.\n", + "\t* Sentdex: Offers video tutorials on various AI topics, including machine learning, deep learning, and computer vision.\n", + "5. **Communities and Forums**:\n", + "\t* Kaggle: A platform for data science competitions and hosting datasets, where you can learn from others and participate in discussions.\n", + "\t* Reddit's r/MachineLearning and r/AI: Active communities discussing AI-related topics, sharing resources, and providing feedback on projects.\n", "\n", - "**Books:**\n", + "Remember, learning about AI is a continuous process. Start with the basics, build projects, and gradually move on to more advanced topics. Practice and experimentation are key to gaining hands-on experience.\n", "\n", - "1. **\"Artificial Intelligence: A Modern Approach\" by Stuart Russell and Peter Norvig**: A comprehensive textbook on AI.\n", - "2. **\"Deep Learning\" by Ian Goodfellow, Yoshua Bengio, and Aaron Courville**: A book that focuses on deep learning techniques.\n", - "3. **\"Life 3.0: Being Human in the Age of Artificial Intelligence\" by Max Tegmark**: A thought-provoking book that explores the future of AI.\n", - "\n", - "**YouTube Channels:**\n", - "\n", - "1. **3Blue1Brown (Grant Sanderson)**: Animated explanations of machine learning and AI concepts.\n", - "2. **Crash Course - Artificial Intelligence**: Engaging video lessons on AI basics.\n", - "3. **Siraj Raval**: A channel that offers explanations of AI and machine learning concepts.\n", - "\n", - "Remember, Alice, these resources are just a starting point. As you progress in your learning journey, you'll discover more advanced topics and specialized areas within AI.\n", - "\n", - "What do you think? Is there a particular resource or topic that catches your attention?As a beginner, it's essential to start with resources that are easy to understand and provide a solid foundation in AI concepts. Here are some popular resources:\n", - "\n", - "**Online Courses:**\n", - "\n", - "1. **Coursera - Machine Learning by Andrew Ng**: A fantastic course that covers the basics of machine learning.\n", - "2. **edX - Introduction to Artificial Intelligence**: A broad introduction to AI, covering topics like computer vision, robotics, and natural language processing.\n", - "3. **Udemy - Artificial Intelligence for Beginners**: A beginner-friendly course that explores AI fundamentals.\n", - "\n", - "**Websites and Blogs:**\n", - "\n", - "1. **Towards Data Science**: A great blog that features articles on machine learning, AI, and data science.\n", - "2. **AI Alignment Forum**: A website that discusses the latest developments in AI research and applications.\n", - "3. **KDnuggets**: A popular blog that covers AI, machine learning, and data science topics.\n", - "\n", - "**Books:**\n", - "\n", - "1. **\"Artificial Intelligence: A Modern Approach\" by Stuart Russell and Peter Norvig**: A comprehensive textbook on AI.\n", - "2. **\"Deep Learning\" by Ian Goodfellow, Yoshua Bengio, and Aaron Courville**: A book that focuses on deep learning techniques.\n", - "3. **\"Life 3.0: Being Human in the Age of Artificial Intelligence\" by Max Tegmark**: A thought-provoking book that explores the future of AI.\n", - "\n", - "**YouTube Channels:**\n", - "\n", - "1. **3Blue1Brown (Grant Sanderson)**: Animated explanations of machine learning and AI concepts.\n", - "2. **Crash Course - Artificial Intelligence**: Engaging video lessons on AI basics.\n", - "3. **Siraj Raval**: A channel that offers explanations of AI and machine learning concepts.\n", - "\n", - "Remember, Alice, these resources are just a starting point. As you progress in your learning journey, you'll discover more advanced topics and specialized areas within AI.\n", - "\n", - "What do you think? Is there a particular resource or topic that catches your attention?\n", + "What specific area of AI would you like to explore first, Alice?\n", "\n", "============================================================\n", "Turn 3\n", @@ -382,7 +357,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Your name is Alice! I remember you told me that when we started our conversation about learning AI. How's your exploration of AI resources going so far, Alice? Do you have any questions or need help with anything specific?Your name is Alice! I remember you told me that when we started our conversation about learning AI. How's your exploration of AI resources going so far, Alice? Do you have any questions or need help with anything specific?\n", + "Your name is Alice! I remember that from our previous conversation when you introduced yourself as someone interested in learning about AI. How can I assist you further today?Your name is Alice! I remember that from our previous conversation when you introduced yourself as someone interested in learning about AI. How can I assist you further today?\n", "\n", "✅ Completed 3 conversational turns with context retention\n" ] @@ -423,14 +398,14 @@ }, { "cell_type": "code", - "execution_count": 126, + "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "INFO:httpx:HTTP Request: DELETE http://localhost:8321/v1/conversations/conv_53b1fa277c2b51b59846a499a4a8f4fb264c86d50fe03b30 \"HTTP/1.1 200 OK\"\n" + "INFO:httpx:HTTP Request: DELETE http://localhost:8321/v1/conversations/conv_936121c2e27b7d1f7d3f0b6a62adce867d79268f5f9ce265 \"HTTP/1.1 200 OK\"\n" ] }, { @@ -458,51 +433,76 @@ }, { "cell_type": "code", - "execution_count": 127, + "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Knowledge base: 3 documents\n", - " - doc1: Llama Stack is Meta's comprehensive framework for ...\n", - " - doc2: MCP (Model Context Protocol) is a standardized pro...\n", - " - doc3: RAG (Retrieval-Augmented Generation) combines info...\n" + "Knowledge base: 3 Paul Graham essay excerpts\n", + " - pg_essay_1: What I Worked On\n", + " - pg_essay_2: How to Start a Startup\n", + " - pg_essay_3: Maker's Schedule, Manager's Schedule\n" ] } ], "source": [ - "# Sample knowledge base documents\n", + "# Sample knowledge base: Paul Graham essay excerpts\n", + "# This is a common RAG example - using actual content from Paul Graham's essays\n", "documents = [\n", " {\n", - " \"doc_id\": \"doc1\",\n", - " \"content\": \"Llama Stack is Meta's comprehensive framework for building LLM applications. \"\n", - " \"It provides standardized APIs for inference, safety, agents, and more.\",\n", - " \"metadata\": {\"category\": \"framework\", \"source\": \"docs\"}\n", + " \"doc_id\": \"pg_essay_1\",\n", + " \"content\": \"\"\"What I Worked On\n", + "\n", + " Before college the two main things I worked on, outside of school, were writing and programming.\n", + " I didn't write essays. I wrote what beginning writers were supposed to write then, and probably\n", + " still are: short stories. My stories were awful. They had hardly any plot, just characters with\n", + " strong feelings, which I imagined made them deep.\n", + "\n", + " The first programs I tried writing were on the IBM 1401 that our school district used for what\n", + " was then called 'data processing.' This was in 9th grade, so I was 13 or 14. The school district's\n", + " 1401 happened to be in the basement of our junior high school, and my friend Rich Draves and I got\n", + " permission to use it.\"\"\",\n", + " \"metadata\": {\"essay\": \"What I Worked On\", \"author\": \"Paul Graham\", \"year\": 2021}\n", " },\n", " {\n", - " \"doc_id\": \"doc2\",\n", - " \"content\": \"MCP (Model Context Protocol) is a standardized protocol that allows AI models \"\n", - " \"to interact with external tools and data sources in a consistent way.\",\n", - " \"metadata\": {\"category\": \"protocol\", \"source\": \"docs\"}\n", + " \"doc_id\": \"pg_essay_2\",\n", + " \"content\": \"\"\"How to Start a Startup\n", + "\n", + " You need three things to create a successful startup: to start with good people, to make something\n", + " customers actually want, and to spend as little money as possible. Most startups that fail do it\n", + " because they fail at one of these. A startup that does all three will probably succeed.\n", + "\n", + " And that's kind of exciting, when you think about it, because all three are doable. Hard, but doable.\n", + " And since a startup that succeeds ordinarily makes its founders rich, that implies getting rich is\n", + " doable too. Hard, but doable.\"\"\",\n", + " \"metadata\": {\"essay\": \"How to Start a Startup\", \"author\": \"Paul Graham\", \"year\": 2005}\n", " },\n", " {\n", - " \"doc_id\": \"doc3\",\n", - " \"content\": \"RAG (Retrieval-Augmented Generation) combines information retrieval with \"\n", - " \"language generation to provide more accurate and contextual responses.\",\n", - " \"metadata\": {\"category\": \"technique\", \"source\": \"docs\"}\n", + " \"doc_id\": \"pg_essay_3\",\n", + " \"content\": \"\"\"Maker's Schedule, Manager's Schedule\n", + "\n", + " One reason programmers dislike meetings so much is that they're on a different type of schedule\n", + " from other people. Meetings cost them more.\n", + "\n", + " There are two types of schedule, which I'll call the manager's schedule and the maker's schedule.\n", + " The manager's schedule is for bosses. It's embodied in the traditional appointment book, with each\n", + " day cut into one hour intervals. When you use time that way, it's merely a practical problem to\n", + " meet with someone. But there's another way of using time that's common among people who make things,\n", + " like programmers and writers. They generally prefer to use time in units of half a day at least.\"\"\",\n", + " \"metadata\": {\"essay\": \"Maker's Schedule, Manager's Schedule\", \"author\": \"Paul Graham\", \"year\": 2009}\n", " },\n", "]\n", "\n", - "print(f\"Knowledge base: {len(documents)} documents\")\n", + "print(f\"Knowledge base: {len(documents)} Paul Graham essay excerpts\")\n", "for doc in documents:\n", - " print(f\" - {doc['doc_id']}: {doc['content'][:50]}...\")" + " print(f\" - {doc['doc_id']}: {doc['metadata']['essay']}\")" ] }, { "cell_type": "code", - "execution_count": 128, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -523,7 +523,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "✅ Created session: conv_0361da3cbb5e8a9d9ce4ae6404e16f66724e6a18f8c01077\n" + "✅ Created session: conv_9ae94374c781501f2d712620dcc8e55961b5a226df229b1d\n" ] } ], @@ -547,19 +547,9 @@ }, { "cell_type": "code", - "execution_count": 129, + "execution_count": 11, "metadata": {}, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Query: What is Llama Stack and what does it provide?\n", - "Retrieved 1 relevant document(s)\n", - "\n", - "Answer: " - ] - }, { "name": "stderr", "output_type": "stream", @@ -571,7 +561,16 @@ "name": "stdout", "output_type": "stream", "text": [ - "According to the provided context from Document 1, Llama Stack is Meta's comprehensive framework for building LLM (Large Language Model) applications. It provides standardized APIs (Application Programming Interfaces) for various functions, including inference, safety, agents, and more.According to the provided context from Document 1, Llama Stack is Meta's comprehensive framework for building LLM (Large Language Model) applications. It provides standardized APIs (Application Programming Interfaces) for various functions, including inference, safety, agents, and more.\n", + "Query: What did Paul Graham work on before college?\n", + "Retrieved 1 relevant document(s)\n", + "\n", + "Answer: Based on the provided context from \"What I Worked On\", before college, Paul Graham worked on two main things outside of school: \n", + "\n", + "1. Writing (specifically short stories)\n", + "2. Programming (initially on the IBM 1401)Based on the provided context from \"What I Worked On\", before college, Paul Graham worked on two main things outside of school: \n", + "\n", + "1. Writing (specifically short stories)\n", + "2. Programming (initially on the IBM 1401)\n", "\n", "\n" ] @@ -580,7 +579,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "INFO:httpx:HTTP Request: DELETE http://localhost:8321/v1/conversations/conv_0361da3cbb5e8a9d9ce4ae6404e16f66724e6a18f8c01077 \"HTTP/1.1 200 OK\"\n" + "INFO:httpx:HTTP Request: DELETE http://localhost:8321/v1/conversations/conv_9ae94374c781501f2d712620dcc8e55961b5a226df229b1d \"HTTP/1.1 200 OK\"\n" ] }, { @@ -592,13 +591,13 @@ } ], "source": [ - "# Query with context\n", - "query = \"What is Llama Stack and what does it provide?\"\n", + "# Query with context from Paul Graham essays\n", + "query = \"What did Paul Graham work on before college?\"\n", "\n", "# Simulate retrieval (in production, use vector search)\n", - "relevant_docs = [doc for doc in documents if \"llama stack\" in doc[\"content\"].lower()]\n", - "context = \"\\n\\n\".join([f\"Document {i+1}:\\n{doc['content']}\"\n", - " for i, doc in enumerate(relevant_docs)])\n", + "relevant_docs = [doc for doc in documents if \"before college\" in doc[\"content\"].lower()]\n", + "context = \"\\n\\n\".join([f\"From '{doc['metadata']['essay']}':\\n{doc['content']}\"\n", + " for doc in relevant_docs])\n", "\n", "# Create prompt with retrieved context\n", "prompt_with_context = f\"\"\"Context from knowledge base:\n", @@ -650,7 +649,7 @@ }, { "cell_type": "code", - "execution_count": 130, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -726,7 +725,7 @@ }, { "cell_type": "code", - "execution_count": 132, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -754,7 +753,7 @@ "\n", "MCP_ACCESS_TOKEN = \"YOUR_ACCESS_TOKEN_HERE\"\n", "## ran an MCP server locally, you can replace this field with your mcp server url\n", - "MCP_SERVER_URL = \"http://localhost:3000/sse\" \n", + "MCP_SERVER_URL = \"http://localhost:3000/sse\"\n", "#MCP_SERVER_URL = \"https://mcp.deepwiki.com/sse\"\n", "mcp_tools = [\n", " {\n", @@ -779,7 +778,7 @@ }, { "cell_type": "code", - "execution_count": 133, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -827,9 +826,16 @@ }, { "cell_type": "code", - "execution_count": 145, + "execution_count": 15, "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created MCP agent\n" + ] + }, { "name": "stderr", "output_type": "stream", @@ -841,8 +847,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Created MCP agent\n", - "✅ Created session: conv_d86d8242813c4019f1176754067d0e393923fcc364429f5b\n" + "✅ Created session: conv_5613324aa4c3193b1434bf562fe1c75dc2e0563c681738b1\n" ] } ], @@ -862,7 +867,7 @@ }, { "cell_type": "code", - "execution_count": 146, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -888,7 +893,7 @@ "\n", "\n", " [Tool Execution Started]\n", - "The current weather in New York City is 52°F with a slight chance of very light rain and winds of 12 mph NE. Tomorrow's forecast shows a high of 55°F with a slight chance of very light rain and winds of 14 to 17 mph NE. Over the next few days, the city can expect temperatures ranging from 49°F to 61°F with varying chances of rain and wind speeds. It's recommended to check the latest forecasts for the most up-to-date information.The current weather in New York City is 52°F with a slight chance of very light rain and winds of 12 mph NE. Tomorrow's forecast shows a high of 55°F with a slight chance of very light rain and winds of 14 to 17 mph NE. Over the next few days, the city can expect temperatures ranging from 49°F to 61°F with varying chances of rain and wind speeds. It's recommended to check the latest forecasts for the most up-to-date information.\n", + "The current weather in New York City is mostly cloudy with a temperature of 49°F and a wind speed of 17 mph NE. Today, it will be partly sunny with a high of 55°F. Tonight, there's a chance of rain showers with a low of 53°F. The rest of the week will see a mix of rain, thunderstorms, and sunshine, with temperatures ranging from the mid-50s to the mid-60s. It's a good idea to check the forecast regularly for updates.The current weather in New York City is mostly cloudy with a temperature of 49°F and a wind speed of 17 mph NE. Today, it will be partly sunny with a high of 55°F. Tonight, there's a chance of rain showers with a low of 53°F. The rest of the week will see a mix of rain, thunderstorms, and sunshine, with temperatures ranging from the mid-50s to the mid-60s. It's a good idea to check the forecast regularly for updates.\n", "\n", "\n", " Summary: Used 2 tool(s) to answer the query\n" @@ -944,14 +949,14 @@ }, { "cell_type": "code", - "execution_count": 147, + "execution_count": 17, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "INFO:httpx:HTTP Request: DELETE http://localhost:8321/v1/conversations/conv_d86d8242813c4019f1176754067d0e393923fcc364429f5b \"HTTP/1.1 200 OK\"\n" + "INFO:httpx:HTTP Request: DELETE http://localhost:8321/v1/conversations/conv_5613324aa4c3193b1434bf562fe1c75dc2e0563c681738b1 \"HTTP/1.1 200 OK\"\n" ] }, {