Home » Guide To Building AI Agents with Llama 3.3 and Phi Data

Guide To Building AI Agents with Llama 3.3 and Phi Data

by Sharath G
Spread the love

Creating an AI agent can seem complex, but with the Lama 3.3 open-source LLM and the Phi Data framework, it’s easier than ever to build powerful, customizable AI tools. In this guide, we’ll create a finance agent to compare two stocks based on analyst recommendations and company fundamentals. Later, we’ll form a team of agents, showcasing their collaboration to achieve complex tasks. Let’s dive into this exciting tutorial.

What is an AI Agent?

AI agents are systems designed to perform specific tasks autonomously by leveraging tools and LLMs. They operate by combining models with plugins, enabling them to interact with APIs, fetch data, or analyze content efficiently. Before continuing, consider watching our introductory video to better understand AI agents.

Why Use Phi Data?

Phi Data stands out due to its clean and minimal API. In November 2024 alone, 2.8 million agents were created using Phi Data, reflecting its growing popularity and adoption by many companies. Other frameworks like LangChain or Microsoft Autogen are also good, but Phi Data offers an efficient and lightweight alternative, making it ideal for beginners and professionals alike.

In this initial blog post i’ll use Groq Cloud to run the Lama 3.3 model on Groq Cloud, a free platform that supports heavy LLMs without requiring expensive hardware. Groqcloud offers a simple and effective userinterface for checking usage and also provides free limit to quickly get started instead of setting up a new hardware for running LLMs locally.

Building a Sample Agent

Here is an example of how you can build a finance-focused agent using PhiData:

from phi.agent import Agent
from phi.model.groq import Groq
import os
from dotenv import load_dotenv

load_dotenv()

# Create an Agent
agent = Agent(
    model=Groq(model="llama-3.3-70b-versatile"))

# Testing out the agent with an example query?
response = agent.run("Why is the sky blue?")
print(response.content)

Outputs:
The sky appears blue because of a phenomenon called Rayleigh scattering. It’s the scattering of light by small particles or molecules in the atmosphere, which favors shorter (blue) wavelengths over longer (red) wavelengths. This is why the sky generally takes on a blue hue during the daytime.

Why Use PhiData Agents?

  • Customizable: Unlike ChatGPT, you can integrate internal APIs or proprietary tools.
  • Powerful Collaboration: Create teams of agents for multi-tasking.
  • Open Source Flexibility: Choose between open-source LLMs or premium APIs like OpenAI.

By combining Llama 3.3 with the Phi Data framework, you can create robust, task-specific agents or teams of agents tailored to your needs. Explore further by integrating more tools or experimenting with different LLMs. All the code from this tutorial is available on GitHub. Start building your agents today! Do comment with your thoughts and any unique agents you are planning on building that helps with speeding up day to day tasks or automating it!

You may also like