Phidata — AI Agents with Memory, Knowledge & Tools
Python framework for building AI agents with built-in memory (PostgreSQL), knowledge bases (RAG), and 50+ tool integrations. Production-ready with monitoring dashboard. 18,000+ GitHub stars.
What it is
Phidata is a Python framework for building AI agents that come with built-in memory (backed by PostgreSQL), knowledge bases (via RAG), and 50+ tool integrations out of the box. It provides a structured approach to creating agents that remember conversations, search through documents, and take actions via external APIs.
The framework targets developers building production AI assistants, customer support bots, or research agents that need persistent state and access to domain-specific knowledge.
How it saves time or tokens
Phidata bundles memory, knowledge, and tool calling into a single framework. Without it, you would need to separately integrate a vector database, build RAG pipelines, implement conversation persistence, and wire up tool schemas. Phidata provides all of this with minimal configuration, reducing setup time from days to hours.
How to use
- Install Phidata:
pip install phidata. - Create an Agent with your chosen model, tools, and knowledge source.
- Run the agent with
.run()or.print_response()for interactive use.
Example
from phi.agent import Agent
from phi.tools.duckduckgo import DuckDuckGo
from phi.model.openai import OpenAIChat
agent = Agent(
model=OpenAIChat(id='gpt-4o'),
tools=[DuckDuckGo()],
description='You are a research assistant.',
instructions=['Always cite your sources.'],
show_tool_calls=True,
markdown=True,
)
agent.print_response('What are the latest developments in AI agents?')
Related on TokRepo
- Phidata Deep-Dive -- detailed Phidata framework breakdown
- AI Tools for Agents -- compare AI agent frameworks
Common pitfalls
- Phidata's memory requires a PostgreSQL database for persistence. For local development, use Docker to run a lightweight Postgres instance.
- Tool calling adds latency per turn. Limit the number of active tools to those the agent actually needs for the current task.
- Knowledge base indexing must be triggered manually after adding new documents. Automate re-indexing in your CI/CD pipeline for production.
Frequently Asked Questions
Phidata stores conversation history and agent state in PostgreSQL. Each session has a unique ID, and the agent automatically loads prior context when a session resumes. This gives agents persistent memory across restarts.
Phidata supports PDF files, web pages, text documents, and custom data sources for RAG. Documents are chunked, embedded, and stored in a vector database (pgvector by default) for semantic retrieval.
Yes. Phidata provides a Team class for orchestrating multiple agents. You can define agents with different roles and have them collaborate on tasks with a supervisor agent routing work.
Phidata supports OpenAI, Anthropic, Google Gemini, Groq, Together AI, Ollama, and other providers. You swap models by changing the model parameter in the Agent constructor.
Phidata is open source under the MIT license. There is also a paid cloud platform (phi.com) for monitoring, debugging, and team collaboration on agent projects.
Citations (3)
- Phidata GitHub— AI agents with memory, knowledge, and 50+ tool integrations
- Phidata Memory Docs— PostgreSQL-backed agent memory and pgvector knowledge
- Phidata Teams Docs— Multi-agent team orchestration
Related on TokRepo
Source & Thanks
Discussion
Related Assets
Moodle — Open-Source Learning Management System
The most widely used open-source learning platform, providing course management, assessments, and collaboration tools for educators and organizations worldwide.
Sylius — Headless E-Commerce Framework on Symfony
An open-source headless e-commerce platform built on Symfony and API Platform, designed for developers who need a customizable and API-first commerce solution.
Akaunting — Free Self-Hosted Accounting Software
A free, open-source online accounting application built on Laravel for small businesses and freelancers to manage invoices, expenses, and financial reports.