WorkflowsMay 7, 2026·3 min read

Phidata Assistants — Memory, Knowledge & Tools in One Class

Phidata Assistant glues memory, knowledge bases, tool use into one Python class. Add knowledge with PgVector or Lance, free UI playground included.

Agent ready

Review-first install path

This asset needs a review step. The copied prompt tells the agent to dry-run, show the writes, then proceed only after confirmation.

Needs Confirmation · 64/100Policy: confirm
Agent surface
Any MCP/CLI agent
Kind
Knowledge
Install
Single
Trust
Trust: Community
Entrypoint
Asset
Review-first command
npx -y tokrepo@latest install 33c9de80-3ef2-4a44-ad08-e0a52917884d --target codex

Dry-run first, confirm the writes, then run this command.

Intro

Phidata's Assistant class is the Python-first agent abstraction — memory, knowledge bases, structured outputs, and tool use plugged in as keyword arguments. No graph, no nodes, no decorators outside the tool registration. Best for: builders who want a Python class they can grow into a production agent, not a framework that takes over their whole codebase. Works with: any LLM via LiteLLM, PgVector / Lance / SingleStore for knowledge. Setup time: 5 minutes.


Hello assistant

from phi.assistant import Assistant
from phi.tools.duckduckgo import DuckDuckGo

assistant = Assistant(
    description="Research assistant. Use web search aggressively, cite sources.",
    tools=[DuckDuckGo()],
    show_tool_calls=True,
    markdown=True,
)

assistant.print_response("Compare Pinecone, Weaviate, Qdrant in 2026")

Add memory

from phi.memory import AssistantMemory
from phi.memory.db.postgres import PgMemoryDb

assistant = Assistant(
    memory=AssistantMemory(db=PgMemoryDb(table_name="assistant_memory")),
    ...
)

Memory persists across runs. The next session starts with a summary of past conversations.

Add knowledge (RAG built in)

from phi.knowledge.pdf import PDFUrlKnowledgeBase
from phi.vectordb.pgvector import PgVector

kb = PDFUrlKnowledgeBase(
    urls=["https://example.com/paper.pdf"],
    vector_db=PgVector(table_name="kb"),
)
kb.load(recreate=False)

assistant = Assistant(
    knowledge_base=kb,
    add_references_to_prompt=True,
    ...
)

The Assistant retrieves relevant chunks per query and injects them into the prompt.

Built-in playground

from phi.playground import Playground, serve_playground_app

app = Playground(assistants=[assistant]).get_app()
serve_playground_app("main:app", reload=True)

localhost:7777 gives you a chat UI to test the Assistant — useful in dev, not for prod.


FAQ

Q: Phidata vs Agno — what's the relationship? A: Same team. Phidata is the older brand; Agno is the newer name + cleaner runtime. Phidata still maintained but Agno is where new features land. For new projects, prefer Agno.

Q: Is Phidata free? A: Yes — open-source under Mozilla Public License 2.0. The hosted Phidata Cloud (monitoring + auth) is paid, but everything you run on your own infra is free.

Q: Can I use Phidata with Claude? A: Yes — Phidata uses LiteLLM under the hood. Set llm=Claude(model='claude-3-5-sonnet-20241022') or any of 100+ providers. Tool use, structured outputs, and memory all work the same.


Quick Use

  1. pip install phidata duckduckgo-search
  2. Define an Assistant with description, tools, optional memory and knowledge_base
  3. assistant.print_response("<your question>") — or serve the playground at localhost:7777

Intro

Phidata's Assistant class is the Python-first agent abstraction — memory, knowledge bases, structured outputs, and tool use plugged in as keyword arguments. No graph, no nodes, no decorators outside the tool registration. Best for: builders who want a Python class they can grow into a production agent, not a framework that takes over their whole codebase. Works with: any LLM via LiteLLM, PgVector / Lance / SingleStore for knowledge. Setup time: 5 minutes.


Hello assistant

from phi.assistant import Assistant
from phi.tools.duckduckgo import DuckDuckGo

assistant = Assistant(
    description="Research assistant. Use web search aggressively, cite sources.",
    tools=[DuckDuckGo()],
    show_tool_calls=True,
    markdown=True,
)

assistant.print_response("Compare Pinecone, Weaviate, Qdrant in 2026")

Add memory

from phi.memory import AssistantMemory
from phi.memory.db.postgres import PgMemoryDb

assistant = Assistant(
    memory=AssistantMemory(db=PgMemoryDb(table_name="assistant_memory")),
    ...
)

Memory persists across runs. The next session starts with a summary of past conversations.

Add knowledge (RAG built in)

from phi.knowledge.pdf import PDFUrlKnowledgeBase
from phi.vectordb.pgvector import PgVector

kb = PDFUrlKnowledgeBase(
    urls=["https://example.com/paper.pdf"],
    vector_db=PgVector(table_name="kb"),
)
kb.load(recreate=False)

assistant = Assistant(
    knowledge_base=kb,
    add_references_to_prompt=True,
    ...
)

The Assistant retrieves relevant chunks per query and injects them into the prompt.

Built-in playground

from phi.playground import Playground, serve_playground_app

app = Playground(assistants=[assistant]).get_app()
serve_playground_app("main:app", reload=True)

localhost:7777 gives you a chat UI to test the Assistant — useful in dev, not for prod.


FAQ

Q: Phidata vs Agno — what's the relationship? A: Same team. Phidata is the older brand; Agno is the newer name + cleaner runtime. Phidata still maintained but Agno is where new features land. For new projects, prefer Agno.

Q: Is Phidata free? A: Yes — open-source under Mozilla Public License 2.0. The hosted Phidata Cloud (monitoring + auth) is paid, but everything you run on your own infra is free.

Q: Can I use Phidata with Claude? A: Yes — Phidata uses LiteLLM under the hood. Set llm=Claude(model='claude-3-5-sonnet-20241022') or any of 100+ providers. Tool use, structured outputs, and memory all work the same.


Source & Thanks

Built by Phidata. Licensed under MPL-2.0.

phidatahq/phidata — ⭐ 13,000+

🙏

Source & Thanks

Built by Phidata. Licensed under MPL-2.0.

phidatahq/phidata — ⭐ 13,000+

Discussion

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

Related Assets