Hello all my name is Krish Naik and welcome to my YouTube channel. So guys I am super excited now we are going to probably build a lot of end-to-end agentic AI applications with the help of different different frameworks. In this specific video we'll just get started to showcase you like how do we specifically build agentic AI applications, how do we build independent agents and how do we probably combine them to work in a specific complex workflow.
right and as i said i will be covering multiple frameworks so in this particular video we are going to discuss about a framework which is called as file data so before i start ahead with respect to this particular video please make sure that you will keep a like target to thousand only thousand and will keep a comment target to hundred please make sure that you fulfill this target because this will basically motivate me to upload more videos as quickly as possible so quickly let's go ahead and share my screen So here, let me just quickly go ahead and open the documentation of PhiData, right? So this PhiData, we are basically going to use it as a framework. The best part about this is that it is an open source platform to build, ship and monitor agentech systems.
Okay, so here you're just not building it, but here you'll be able to monitor it, you'll be able to deploy it, each and everything you'll be able to do it, right? And it is completely open source with respect to the framework that you really want to use. Here. you will be able to build ai agents you you'll be able to build multi-modal agents you'll be able to create agentic workflows more complex agentic workflows and all right so uh and this is super helpful if you just have some amount of domain knowledge you should be able to build in an amazing way uh the best part about this is that you can choose any llm and turn any llm into an agent right because many people whenever i request them right they say that hey krish you Instead of OpenAI, you know, we don't have an API key, try to use some open source models.
So here you will be able to use Grok, you'll be able to use HuggingFace, you'll be able to use Ulama. So I will just try to show you the most easiest way how you can probably integrate any open source LLM models, right? Then you'll be able to add knowledge, provide domain specific information to solve your problems, right?
And different, different complex workflows also you'll be able to do it. You just need to probably write some amount of code. And writing this kind of code is also very simple, which we will be probably seeing from the documentation. Now, these are the basic information.
Then you have this entire documentation where you can probably refer. You can work with how many different kind of agents you can specifically work with. You can also go ahead and write your own prompts, tools, knowledge, memory.
All these things are there, right? Not only that, if you probably go ahead and see, you will also be able to integrate with different models like OpenAI, Anthropic Cloud, AWS Bedrock. Azure. What I'm actually going to do is that I will probably pick up some good open source and I'll show you with respect to cloud like AWS Bedrock Cloud and all. I have that access.
Gemini Vertex AI also I'll try to show you. Hugging Face, Grok. If you want I can also show with NVIDIA.
Ulama I don't want to show you because see Ulama is just like the LLM setup in your local right and I know you don't have very high powered machines you know you don't have huge RAM so usually it becomes slow. So let's start. We will go step by step and what we are basically going to do is that as we go ahead, first of all, I will show you how you can go ahead and set up the project and how you can go ahead and start. So let's begin. So guys, now let's go ahead and start.
I will be building the project completely from basics and scratch, you know, probably from a basic setup point of view. So here is the folder location, which I'm actually going to use from here. I can just go ahead and open my VS code. So once I open my VS code, it will. look something like this okay so here let me just go ahead and open my vs code okay now once we open a vs code as you all know the first and the basic information or basic thing that we really need to probably go ahead and do is create our create our python environment right so here i'm going to go ahead and write so let me just go ahead and write my command prompt and the first thing that i'm actually going to go ahead and write conda create minus p venv okay minus p basically means within the folder location uh it is just going to create this virtual environment so that i don't have to probably look at any other way right so conda create minus p venv python double equal to 3.12 okay so once i probably go ahead and execute this it will ask me for one more confirmation so i will just go ahead and give yes so again it depends on your internet speed how much time it is basically going to take you know so quickly let me just go ahead and write y and the uh and the installation has started taking place right the next thing is that i will go ahead and create my requirements dot txt okay and what all requirements I specifically require I'm just going to go ahead and write okay so some of the requirements that I'm actually going to use is something like this okay open AI open AI will not require it so I will just remove it I'll require phi data since we are using this particular framework called as phi data then python.env then yfinance packaging duckduckgo search this is just like a tool you know this tool will be specifically used by agent to do any kind of web search okay then you have this fast api internally when you probably want to run this in the cloud uh five data platform we will be requiring fast api as the uh you know front-end application in chart then you have uvcon and then since we are using grok grok has all the open source libraries uh hosted in and we'll be able to get the api also right so we will be using specifically grok okay so these are some of the libraries that we are going to use in the requirement.txt now quickly what i'm actually going to do is that i'll go ahead and write pip install oh first of all i need to activate the environment so conda activate v and v okay once i specifically oh it says not a conda environment okay spelling v e and v okay v e and v so yes uh we have installed uh we have activated our conda environment then the next thing i will just go ahead and clear my screen uh what we are basically going to uh do over here is that i'll just go ahead and write python oh sorry now i have my venv environment the next thing that i'm going to write is pip install minus r requirement.txt okay so once i'm going to probably do the installation of all the libraries the next step is that we can probably go ahead and start now since we are uh also installing python.env so for this we also require one dot env file okay now inside this dot env file i will be requiring two important information one is phi data key and the second one is my grok api key okay now how do you get your grok api key and phi data key i will just go ahead and explain you but before that let me just go ahead and copy this particular grok api key grok api keys i hope everybody knows it we can specifically get it from the grok platform so quickly i will go to my grok platform okay so here i will go ahead and write grok form okay now if you know about grok it is a fast ai inferencing it provides you good open source libraries you can see all these open source libraries it will be able to provide you so you can specifically use for some number of requests which is completely for free okay then i will just go ahead and click on dev console so let me just go ahead and click on dev console now once i go to the dev console i have already logged in over here if you have not logged in i would suggest please go ahead and log in Then here you can probably go ahead and see API keys.
I've created a lot of API keys over here. So you can just go ahead and click on create, write the API key name and you can get the API. Right. It will basically start from GSK.
Okay. So once you have this particular API key, all you have to do is that just go ahead and update this. Okay. Grok API key. Now this API key that you are able to see is my FIDATA API key.
Because... whenever i run my application my local it should be able to run it over here so what you have to do is that just go ahead and logging in phi data and this will basically be your dashboard okay so dashboard looks like this you can go ahead and click on api key and you can just copy this okay so copy this api key and keep it ready okay so two important keys that you specifically require one is the phi phi phi underscore api key i'll just go ahead and write it down like this okay and then you have your grok api key these two keys we will specifically require okay perfect i'm just keeping it for my purpose you know whenever i specifically require it i will be able to use it okay now to start with uh the most easiest way how you can probably just go ahead and write something and you can probably go ahead and start you know i will just start with a simple project which will be like a financial analyst you can probably consider okay so here i will just go ahead and create my file and i'll write financial underscore agent dot py okay now with respect to financial agent dot py okay i have two problems change the environment okay now i have changed the environment now first thing first uh with respect to the financial agent you know here what we are basically going to do is that i will create a application okay in terms internally it will have multiple agents okay one agent like let's say that if i go ahead and probably ask a question hey can you summarize and recommend about the stock of nvidia So this is my question. Now, as soon as I put this particular question, how my chatbot should interact?
Just imagine in this. My chatbot should probably go ahead and contact agents. The first agent will be the person or I'll not say person. The first agent will be my AI agent, autonomous AI agent, which will be doing all the interaction to get the details of the stock.
So that will be my first AI agent. The second AI agent will be that it will also try to probably get some information from the news, right, from the web search, what new information you specifically have. Once we combine all of those information, then they should probably interact with my LLM model and come to a conclusion, you know, saying that, hey, what all recommendations we specifically have for that stock. So I hope you are able to understand.
So that is why I've written this financialagent.py. so let me quickly go ahead and import some libraries so i'll write from phi dot agent import agent okay import agent capital letter from phi dot agent import agent okay okay then from phi dot model dot open ai sorry i'll not use open ai Instead what I can also use is I will be using some tools specifically like Y Finance and all. Okay.
So let me quickly go ahead and write it down. I will just keep my face hidden so that you focus on the entire coding that we are specifically doing. Okay. So let me just zoom in. So first of all I will be importing from FIDATA, FI.AGENT.
Then you have this FI.MODEL.YFINANCE or um let me do one thing let me also use something called as grok okay grok import grok okay so i'm going to also use this grok because this will basically be my model and here also what i can do is that i can use capital grok yeah okay this is done uh i'm going to specifically use grok i'm going to use agents now as i said that i'm also going to use a specific tool so phi dot tools dot tools dot y finance okay y finance and then i'm going to go ahead and import y finance to now why how do you think that i've come up with this you know so the best part about phi data is that it has lot of integration with various tools let's say if i go ahead and click this specific tool there is something called as duckduckgo search there is something called as y finance y finance is also there there is youtube there is zoom twitter so many different different things are there so you can probably integrate all the specific tools right so for this so what you need to do is that you need to install y finance so i will just go ahead and see that whether i have installed it or not so in the requirement.txt we have installed finance y finance and then uh you'll be able to see that i just need to import it in the way along with the agent right and then i will be able to call these tools inside any agent okay inside any agent and i can probably give some parameters like analyze recommendation and all see there are a lot of different different things analyze recommendation company news technical indicators historical prices we can just keep it that that as a boolean value okay so that is how we basically call this okay so we will i'll show you how once i start using this okay so this is my uh y finance tool now another tool that i'm actually going to use as i said that i also want to do my web search right So I will be using this DuckDuckGo search. Okay, DuckDuckDugo. And I will just import my DuckDuckGo. So this is my another tool. So if you probably go ahead and see, this is my DuckDuckGo.
And this enables an AI agent to search the web for information. Because if I'm probably able to search some information from the internet, it will be amazing, right? So here what I'm going to do is that I'll just go ahead and install this libraries. Now let's see whether that library is also available or not. So if that is also available, I've already installed it.
Okay. perfect now the next thing that i will do i'll write from five dot five dot model dot i have imported grok also okay i think this is good enough now let's go ahead and let's start our first work okay now the first thing that i will do is that i will go ahead and create my web search agent so now with respect to different different tasks i have to probably go ahead and create my different different agents so my first agent will be nothing but web search agent now in order to create an agent i'll be using this agent itself right i'll be using this agent and i'll go ahead and give some name so first thing is that i will say hey web search agent okay so this is the first information that i'm giving about the agent okay the second thing is that i will go ahead and write some role see all the parameters that you will be able to see over here role agent id uh so many different different parameters are there right so we you can probably refer the documentation but here i will just give you the minimalistic parameters that we have i'll say hey search the web for the information search the web for the information the next thing that i'm actually going to do is that i'm going to call my model now which model this web agent is basically going to use see every tools that we are going to create every agents we are going to create the backbone there will be an llm model That LLM model will be provided some data from the tools that we are going to use in this particular case We are going to use the duck duck go search tool, right? So here I will just go ahead and call my model Let's say I'm going to use my grok model and from this grok.
Let's assume that which libraries we are going to specifically use Okay, we can use any library, right? three point three seven B special specs dick If you want we can also use this preview this this whatever libraries you specifically what we can use it, right? so in this our scenario what i'm actually going to use i'm going to use one library which is called as a preview okay so here uh i will just go ahead and write my id is equal to this particular library okay lama3 grok 70 billion eight one it's up to you whatever my library you basically want to use you can actually use it okay then uh i have my next thing that is called as tools now inside my tools i am going to use my you can use multiple tools also right now in my example i'll just go use a dog dog go i'll just go ahead and initialize this okay so this is the tool now what is basically going to happen is that this agent is whenever a query is basically done right first of all it is just going to go ahead and hit this particular tool for that query it is going to get the response and it is basically going to this use this particular model with this particular prompt and it is going to give us the info right the output response then i have my instructions this is my another parameter I'll say hey always include sources so I'm saying that hey whenever you are doing the search with respect to the duck duck go right you should also provide me the source from where you're getting the information okay then I will show show underscore tool underscore calls is equal to true okay and then I will also try to convert this into markdown so I'll make it as true so you You may be thinking krish from where are you getting this parameter? Just go ahead and check out the documentation guys only this many specific set of parameters will be used in which you can probably Use it for your purpose. Okay now understand here.
I have created one basic agent, right? So this is my if I go ahead and write my comment This is my web search agent, right like similarly you can create any number of agents you want. Okay. Now, let's go ahead and create my financial agent right because this financial agent is also going to do a web search it's just like guys i gave a person a task let's say there is a domain expert in finance i said that hey just try to explore about nvidia now the person what he is doing is that uh he's just going and doing an internet search he's getting the information with respect to all the information that he already have he'll combine them and he'll give us a perfect response okay now uh let's go ahead and create my next financial agent now inside this financial agent i will just go ahead and write finance underscore agent you is equal to agent again i'll initialize my another agent uh let's say the name i'm going to go ahead and write finance ai agent okay then you have this model grok id is equal to let's say the same model we are going to use over here also because this is a finance agent okay but understand what this finance agent is basically going to do it is going to interact with a another tool right and one of the tool that we have specifically used is yt finance right why oh sorry why finance tool now though this particular why finance tool has all the information regarding the stock it'll it'll probably this agent is just like integrating with an api to get the information about any stocks anything is over there in the market right you so now here i'm going to basically use a tool now inside this tool i will just go ahead and write okay my y finance tool is over here um let's say i will copy it from here itself where is my y finance y finance y y finance and let's say this is my tool i will just go ahead and copy this entire thing okay so i don't have to probably worry about anything okay so i will remove this i don't want this list i don't want this okay now this is my analyst recommendation stock fundamentals true this this let's say that i want some more things i want technical indicators or company news okay i can also set this parameter as company news company news and i'll set it to is equal to true okay perfect right so this is a tool that we are specifically going to use it then here also i have to probably provide my instructions i like these are some basic instructions that we have to probably make sure to have it you know so instruction and i'll say hey uh let's go ahead and use tables to display the data okay so this is my another instruction that i'm trying to give this person okay uh instruction is basically there now what i will do along with this i will just go ahead and write show underscore tools oh show underscore tools underscore calls right i'll set this to true okay show underscore tools underscore and here also i'll set it to markdown is equal to true okay perfect uh these are all the parameters we can specifically use uh this show underscore tools underscore calls is equal to true basically means that it will just show us like what all tools are basically there i'll just make sure to have this right spelling okay now this is perfect uh now i have created two independent agents one is the web search agent one is the financial agent now whenever we define a workflow uh now this if i combine both of this particular agent it becomes a multi-model agents right so here i will just go ahead and create a variable multi underscore ai underscore agent okay is equal to agent and here i'm just going to use team team is equal to web underscore web underscore search underscore agent comma finance underscore agent and then i have my instructions always include sources okay and here i will also combine both these instructions right over here then use table to display the data the same thing whatever we have actually done it is over there okay now i will be having show underscore tool underscore calls is equal to true and then i have my markdown is equal to true okay perfect now this is my multi-ai agent which is combining both of them see here we have used the first parameter as team which is combining both these agents then we have the instruction then we have show underscore tools as a show underscore tools underscore calls is equal to true then i also have this markdown is equal to true now to initiate this it is nothing but multi ai agent dot print response i can just write my query over here later on if you are creating the chatbot we can write our query over here and automatically this multi agent can also work So summarize analyst recommendation and share the latest news. Let's say this is my question for NV.
NVDA is nothing but NVDA. OK, NVDA. And here I'm going to basically use stream is equal to true.
OK, perfect. So this is my query. I think you should be able to see it. print response this this this stream is equal to true okay i'm just asking hey summarize analyst recommendation share the latest news for nvidia okay now this is done i will just go ahead and run this and show you whether everything should work fine because it should work fine i guess so now if i go ahead and write python financialagent.py and here we go openai not installed pip install openai where is openai being used let's see have i used openai somewhere okay let's do one thing let's let's quickly install this also i think some or the other libraries that may be using so there is some error we'll try to solve it clear pip install minus r requirement.txt requirement.txt okay so once this installation happens now we are good to go ahead and run it okay python financial agent.py Now you can see again I'm getting an error.
So guys here you can see that I'm still getting an error even though I've installed OpenAI. But I think OpenAI is not required in this particular scenario. So what we can basically do is that as you all know that we have already imported our grok API key. But we have not passed it right.
So I'll copy this and what I'm actually going to do with respect to grok is that in Windows you know. Whenever we talk about Windows what. the first thing that we really need to do is that i will just go ahead and clear my screen i will go ahead and write set x okay and we will set the grok api key api underscore key is equal to and i'll just give the api key over here please make sure that you have to write this in your terminal set grok api key and your api key name okay or whatever the api key is there and once i press enter and then what it will happen is that it will probably go ahead and save this okay now the next step will be that i will just go ahead and run this okay python financial agent dot py uh so after this here you can see still it is asking me open ai api key now my suggestion would be that guys here we are not specifically using any opening api key but uh since it is asking for what you can basically do is that you can use an opening api key i know uh you know that There won't be any charges as such, but you can just go ahead and go ahead and create your API key itself and from the OpenAI website and you can just add it over here.
OK, so in order to add it, I will just go ahead and use this over here. Let me quickly do one thing. Let me quickly import OpenAI, OpenAI. And after importing OpenAI, I'll just go ahead and write OpenAI.API underscore key is equal to OS. get env get env and here you have your openai key now you may be thinking krish uh do we definitely require this or not i will just check you know from the documentation still i'll start to explore why this is not coming you know even though we are not using openai api key because see if i'm importing it we are not using openai anywhere right but it is asking for this specific key you know now this environment variable i have to create it over here so quickly i what i will do is that i will just go ahead and put my open ai api key over here i hope everybody knows how to probably go ahead and get your open ai api key so this is mine don't use this but anyhow you'll not be able to use it also because after the video i'll just try to delete it you know then uh after doing this i will quickly go ahead and load so from dot env import import load underscore dot env now here you can see that internally i don't know where it is basically being used probably in this specific thing it is being used i don't know you know i'll just go ahead and check out the documentation but i'm not specifically using openai anywhere okay so now let's see it should work now finally it should work and we should be able to get the response the api client pass option must be set by passing api key to the client okay and where is the client let's see still it is saying open ai key not set okay no worries what we can basically do is that i can go ahead and set something like this i can also go ahead and set it like this so i'll write open underscore api key and i will just remove this and we'll set it in this way so i will copy this totally and let me paste it over here let me press enter now i think it should work now after calling this load underscore dot env let me just go ahead and initialize this load underscore dot env okay and then i think it should be able to call this keys so i'll just check guys again why open ai key it is requiring it should not require it anyhow but i don't know well i'll just check out from the documentation financial agent dot py now i think it should definitely work now see you can see summarize analyst recommendation share the latest news for nvda and then here you will be able to see this all task is being running transfer task to finance ai here is the latest information about this and all the news are over here strong by it is saying this by 48 so it has a good information saying that hey it's probably doing really well and you can also see the latest news ai stock trade in 2025 there is an expected growth in ai enthusiasm in 2025 analyst reports and the latest news article related to nvda right these objects reflect the current market sentiments development related to this one at all right so it's it's able to give me a good information over here right and these were the errors that we were getting because of that open ai key but i still don't understand where open ai may be used probably it may be used in this particular multi-eye agent when we are trying to combine this you But let's let's check or if you have any comments, please do let me know with respect to this.
OK, but still, I feel that here we are getting all the information in the terminal. You know, probably I want to display in some kind of chatbot form, you know, and we'll try to probably have a look over here. So what I'm actually going to do is that I'll just go ahead and create my new file.
Let's say I will go ahead and write playground.py. OK, now inside this playground.py, I will probably do almost same thing. whatever things I've actually used over there, you know, with respect to the keys and all.
So first of all, let me just go ahead and import all these things. Again, I don't know why OpenAI is basically being used. I will just go ahead and probably raise a support ticket for this particular platform to just understand where specifically it is being used.
Then these are some of the basic libraries, YFinance, Tool, DuckDuckGo and Agent. and i'm also going to use this five dot api so that it converts this entire platform into api then i'm also going to import this three important libraries okay one is playground and surf playground app now here is where your fast api will be specifically used now let me just go ahead and write phi dot ap okay api is equal to uh os dot get e and v okay and here i'm going to basically use this same env which i have actually created for my phi api right so here is my phi api key and i will just go ahead and paste it over here so we want the phi api key itself because we will create this as a custom chatbot in the phi data platform okay then uh my web search agent and this will be almost same so i will copy this entirely till here okay and here you'll be able to see that i'm pasting it okay uh it still required groks uh grok so let's import this particular grok so where is the grok i'll be using this i'll be pasting it over here okay so this is my grok uh and grok is basically used over here this is perfect uh my finance agent and this now i'm going to go ahead and create my playground so i'll write app is equal to playground okay and here i'm going to combine my agent agents is equal to finance underscore agent comma web search web search underscore agent okay and then i will go ahead and write dot get underscore app right so this is the entire thing what i'm doing right if you really want to get into a playground instead of creating this multi agent now like how we did in the previous video previous step we are just going to create this particular playground so what uh fire data basically does is inside this platform it provides you a playground where you can probably combine all the agents and you can basically see it okay then we will just go ahead and start if underscore underscore name uh underscore underscore underscore double equal to underscore underscore main underscore underscore Then we are just going to go ahead and write serve playground app. And here I'm just going to give my playground colon app.
Now understand, playground is my file name. Okay. And this app is nothing but from where my program is basically starting. Right. And here I will just say reload is equal to true.
It is just like debug is equal to true. So if I make any changes, this is just going to start. Right.
If I don't want to go like this, I can also go ahead and run this particular code over here. Right. Directly so now I think it looks good.
Let's now run it. Okay. See now the best part will be that if I run this file, right?
So this is my entire recommendation. I'll clear the screen. If I write python playground.py. Now this is basically going to run.
Okay. And it is going to run in one localhost 777. But if I just go ahead and hit this URL, it will not work like that. So what I have to do, I have to probably log in into my Fidata dashboard.
Okay. I will just go ahead and click on playground. Okay. It will save me to select an endpoint. So here.
Local host endpoint 777 will be there by default. Okay, so I'll just go ahead and click this now here You can see it is green color. It is showing green color That basically means my endpoint over here is running right at this particular port.
So this is also running So what I'm actually going to do now I've connected to my endpoint and this is my entire playground how you can specifically use okay So now if I just go ahead and write what is your special skill? i stock analyst i can fetch the latest information on the stocks and companies i can provide current stock prices company fundamentals analyst recommendation latest you know which stock are you interested in i'll say i am interested uh in tesla okay so specify for what looking for example so you could specify what kind of information you're looking about tesla for example stock price fundamentals and all so what i will do is that i will write the same statement what we had actually given in the financial agent i'll say hey summarize and latest news on tesla right so i'll just copy this for tesla okay summarize analyst recommendations share the latest news for tesla by this there's this very nicely step by step all the specific information is basically getting displayed and that is the beautiness about this right so here you will be able to see that here are the latest news this this this this a stock goes this okay so this is what it is okay and here i can also write compare tesla and nvidia and provide analyst recommendation right so if i uh you'll be able to see that all the information tesla this this based on nvidia has a much stronger buy recommendation compared to tesla can you And you can probably go ahead and interact this. Now, it is just like I'm interacting with a stockbroker over here or financial analyst who can probably provide me more information.
And this is quite amazing. I know you should not probably use this. I'm not 100% sure whether it is just going to give you the profit.
But here we have defined an amazing complex workflow and we have implemented it completely end-to-end. So this is your financial analysis. Again, as we... go ahead more complex workflows will try to define but i hope you were able to understand this please create a workflow to get started docs so you can also see that we can also go ahead and create our workflow like this and we'll be seeing more about it as we go ahead right but this particular tool is quite amazing to get you get started with amazing things over here but i hope you were able to understand this see financial ai agent over here grok lama 3 is basically being used So yes, this was it from my side. I hope you like this particular session.
This was quite a big session, but there are more and more things that we are going to come up. This was it from my side. I hope you like this particular video. I'll see you in the next video.
Thank you. Take care. Bye.