Agents
Agents are autonomous programs that complete tasks using language models.
What is phidata?
Phidata is a framework for building agentic systems, engineers use phidata to:
- Build Agents with memory, knowledge, tools and reasoning.
- Build teams of Agents that can work together.
- Chat with Agents using a beautiful Agent UI.
- Monitor, evaluate and optimize Agents.
- Build agentic systems i.e. applications with an API, database and vectordb.
Let’s build some agents
Setup your virtual environment
Install libraries
Export your OpenAI key
Phidata works with every LLM but for these examples let’s use OpenAI.
You can get an API key from here.
Web Search Agent
Let’s build a simple agent that can search the web, create a file web_search.py
Create a web search agent
Run the agent
Install libraries
Run the agent
Financial Agent
Lets create another agent that can query financial data, create a file finance_agent.py
Create a finance agent
Run the agent
Install libraries
Run the agent
Team of Agents
A team of agents can work together to solve complex problems, create a file agent_team.py
Create an agent team
Run the agent team
Run the agent team
Agent teams are non-deterministic and are not recommended for production systems, we recommend using workflows instead.
Agentic RAG
Instead of always inserting the “context” into the prompt, we give our Agent a tool to search its knowledge base (vector db) for the information it needs.
This saves tokens and improves response quality. Create a file rag_agent.py
Create a RAG agent
Run the agent
Install libraries
Run the agent
Structured Outputs
Agents can return their output in a structured format as a Pydantic model.
Create a file structured_output.py
Create a structured output agent
Run the agent
Next Steps
- Chat with your Agents using a beautiful Agent UI.
- Learn how to monitor and debug your Agents.
- For more advanced cases, build deterministic, stateful, multi-agent workflows.
Was this page helpful?