Published on
🍵 3 min read

Creating an AI Agent using PhiData Framework

Authors

Photo

Overview

Introduction

AI agents are one of the hottest trends in 2025. There are lot's of improvements, new technologies, libraries in this field. In this post, we'll take a look at the Phidata framework and how it can be used to create an AI agent.

Dependencies

  • Python
  • Pip
  • Gemini

Example

In this example, we'll create a quote generator agent. This agent will take in a subject, author, or keyword from the user, search for relevant quotes, and return a formatted response with a brief explanation of the quote's meaning.

from phi.agent import Agent
from phi.tools.sql import SQLTools
from phi.model.google import Gemini
from phi.tools.duckduckgo import DuckDuckGo
from phi.storage.agent.sqlite import SqlAgentStorage

gemini_model = Gemini(api_key="")

agent = Agent(
    name="quote-generator-agent",
    model=gemini_model,
    instructions=[
        "When the user inputs a subject, author, or keyword, search for relevant quotes.",
        "Provide the quote along with the author's name.",
        "Format the response as: 'quote' - author",
        "Additionally, provide a brief explanation of the quote's meaning."
    ],
    tools=[DuckDuckGo()],
    add_history_to_messages=True,
    num_history_responses=10,
    markdown=True,
    monitoring=True,
)

agent.cli_app(markdown=True)

Example Response

saga

Final Thoughts

In this post, we've covered a simple use case for AI agents. The Phidata framework offers a flexible platform to build advanced assistants, including multi-model agents where multiple agents work together to achieve a goal. With so many exciting developments on the horizon, 2025 is shaping up to be a groundbreaking year for AI agents, operators, and more.

Stay tuned for more updates and happy coding!

Frequently Asked Questions

Banner Background

Emin Vergil

Software Engineer

I'm a curious and passionate person who likes building new things, learning new technologies, and sharing knowledge with others.

Subscribe to get future posts via email (or grab the RSS feed)