Unable to create new custom agent

:wave:

I have installed visual code editor and got phidata up and running.

Got Open AI, Claude, EXA APIs set and working.

I have the access to the localhost:7777 and its 5 agents - web/finance/research/youtube/image agents.

I do not have technical background but I have seen many videos and got to this point.

I am trying to create custom AI agents such as content researcher agent which will use exa and open AI to give me content ideas.

  1. I am unable to create a custom agent.

After i run the command

python3 -m venv ~/.venvs/aienv
source ~/.venvs/aienv/bin/activate

I come across the error which is given below.

source : The term ‘source’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the path is correct and try again.
At line:2 char:1

  • source ~/.venvs/aienv/bin/activate
  •   + CategoryInfo          : ObjectNotFound: (source:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

Can you please let me know what am i doing wrong here?

  1. I have created a .py file in the phidata>cookbook>agents_101 and named it content researched agent. And I was hoping that this agent will be available for me in the playbook along with the default agents but i see the file in green color and it is untracked.

I am sure I am missing multiple steps here and if any one can guide me to a resource that is understandable by a non-tech user that would be great.

I have seen many youtube videos and they are too fast and might be missing some minor steps which are common for tech people and hence they don’t mention it?

Please let me know which steps to take.

Thanks in advance.

Hi @watermelon
Thank you for reaching out and using Phidata! I’ve tagged the relevant engineers to assist you with your query. We aim to respond within 24 hours.
If this is urgent, please feel free to let us know, and we’ll do our best to prioritize it.
Thanks for your patience!

Hey @watermelon , Which operating system are you using?
This error generally occurs if you are using windows.

Try these command in your command prompt to create a virtual environment, it should fix it.

python -m venv venv
venv\Scripts\activate

Hi Anurag,

I am using Windows 11.

Once i ran your suggested commands, I came across the below listed error.

PS C:\Users\ASUS\Downloads\phidata> python -m venv venv
PS C:\Users\ASUS\Downloads\phidata> venv\Scripts\activate
venv\Scripts\activate : File C:\Users\ASUS\Downloads\phidata\venv\Scripts\Activate.ps1 cannot be loaded because running scripts is disabled on this system. For more
information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1

  • venv\Scripts\activate
  •   + CategoryInfo          : SecurityError: (:) [], PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    

PS C:\Users\ASUS\Downloads\phidata>

Windows 11 restriction was there so that is the reason why i could not run any scripts.

started powershell as administrator and used

Set-ExecutionPolicy RemoteSigned

got past the error.

Hey @watermelon good to hear that, yes windows doesn’t allow running scripts by default.

Let us know if you run into any other issues.

Hi Anurag,

  1. I am unable to see the agent 06_content_research_Agent.py in the list of agents under localhost:7777

  1. I see that the two files i created under agents_101 are green in color and has been marked as Untracked. If this is the issue, can you let me know how to solve this issue with these two files so that I can see them under localhost:7777

  2. How to use the Open AI with the agents - whenever i type the below given command - I get an error message. Please help me with this issue as well so that I can get the new agents working with Open AI on the UI.

(venv) PS C:\Users\ASUS\Downloads\phidata> export OPENAI_API_KEY=sk-proj-*********

export : The term ‘export’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • export OPENAI_API_KEY=sk-proj-********
  •   + CategoryInfo          : ObjectNotFound: (export:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

BTW: the content_research_agent works in the terminal but I would like to see it in the UI.

Thanks in advance.

Adding this image as I could not add 2 images in the previous post. Thanks.

Point 3 solved with

[System.Environment]::SetEnvironmentVariable(“OPENAI_API_KEY”, "sk-proj-

custom created agents are working in the terminal - I need to run that in the playground UI but unable to do so

Hey @watermelon, what issue are you facing with running the agent on the playground?

Hi @manthanguptaa - I don’t know how to get the agent running on playground. I am able to run it on the terminal.

I am looking for steps to follow so that I can see my created agents on the playground and not just the demo agents.

If you could point me in the right direction, that would be great! or give me steps to follow on how to get the newly created agent on the playground.

Thanks :slightly_smiling_face:

You can refer to this documentation @watermelon

Hey @manthanguptaa - What should be the location of the file - playground.py

I mean where should we save it?

Hey @watermelon, you can save it in the root folder or any other folder you would like. That would just affect your imports