ScriptsApr 7, 2026·2 min read

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.

TL;DR
Phidata builds production AI agents with PostgreSQL-backed memory, RAG knowledge, and 50+ tools.
§01

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.

§02

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.

§03

How to use

  1. Install Phidata: pip install phidata.
  2. Create an Agent with your chosen model, tools, and knowledge source.
  3. Run the agent with .run() or .print_response() for interactive use.
§04

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?')
§05

Related on TokRepo

§06

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

How does Phidata handle agent memory?+

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.

What knowledge sources does Phidata support?+

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.

Does Phidata support multi-agent workflows?+

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.

Which LLM providers does Phidata work with?+

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.

Is Phidata free?+

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)
🙏

Source & Thanks

Created by Phidata. Licensed under Apache 2.0.

phidata — stars 18,000+

Thanks for making production agents batteries-included.

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets