diff --git a/.assets/logo-dark.svg b/.assets/logo-dark.svg new file mode 100644 index 0000000000..b6fe2f5c11 --- /dev/null +++ b/.assets/logo-dark.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.assets/logo-light.svg b/.assets/logo-light.svg new file mode 100644 index 0000000000..cc07e1a37a --- /dev/null +++ b/.assets/logo-light.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.github/issue_template.md b/.github/issue_template.md new file mode 100644 index 0000000000..7b74b5fa94 --- /dev/null +++ b/.github/issue_template.md @@ -0,0 +1,30 @@ +# Description +Briefly describe the issue you’re experiencing or the bug you’ve found. + +## Steps to Reproduce +List the steps needed to encounter this bug or issue. + +## Agent Configuration (if applicable) +Provide relevant agent configuration. + +## Expected Behavior +What did you expect to happen? + +## Actual Behavior +What actually happened instead? + +## Screenshots or Logs (if applicable) +Include any relevant screenshots or error logs that demonstrate the issue. + +## Environment +- OS: (e.g. macOS, Windows 11) +- Browser (if relevant): (e.g. Chrome 108, Firefox 107) +- Agno Version: (e.g. v1.0.0) +- External Dependency Versions: (e.g., yfinance 0.2.52) +- Additional Environment Details: (e.g., Python 3.10) + +## Possible Solutions (optional) +Suggest any ideas you might have to fix or address the issue. + +## Additional Context +Add any other context or details about the problem here. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 4974c2e3a6..0aa383c9ae 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,15 +1,15 @@ ## Description -**Please include:** - -- **Summary of changes**: Clearly describe the key changes in this PR and their purpose. -- **Related issues**: Mention if this PR fixes or is connected to any issues (e.g., "Fixes #123" or "Relates to #456"). +- **Summary of changes**: Describe the key changes in this PR and their purpose. +- **Related issues**: Mention if this PR fixes or is connected to any issues. - **Motivation and context**: Explain the reason for the changes and the problem they solve. - **Environment or dependencies**: Specify any changes in dependencies or environment configurations required for this update. -- **Impact on AI/ML components**: (If applicable) Describe changes to AI/ML models and include performance metrics (e.g., accuracy, F1-score). +- **Impact on metrics**: (If applicable) Describe changes in any metrics or performance benchmarks. Fixes # (issue) +--- + ## Type of change Please check the options that are relevant: @@ -17,19 +17,23 @@ Please check the options that are relevant: - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) -- [ ] Model update -- [ ] Infrastructure change +- [ ] Model update (Addition or modification of models) +- [ ] Other (please describe): + +--- ## Checklist -- [ ] My code follows Phidata's style guidelines and best practices -- [ ] I have performed a self-review of my code -- [ ] I have added docstrings and comments for complex logic -- [ ] My changes generate no new warnings or errors -- [ ] I have added cookbook examples for my new addition (if needed) -- [ ] I have updated requirements.txt/pyproject.toml (if needed) -- [ ] I have verified my changes in a clean environment +- [ ] Adherence to standards: Code complies with Agno’s style guidelines and best practices. +- [ ] Formatting and validation: You have run `./scripts/format.sh` and `./scripts/validate.sh` to ensure code is formatted and linted. +- [ ] Self-review completed: A thorough review has been performed by the contributor(s). +- [ ] Documentation: Docstrings and comments have been added or updated for any complex logic. +- [ ] Examples and guides: Relevant cookbook examples have been included or updated (if applicable). +- [ ] Tested in a clean environment: Changes have been tested in a clean environment to confirm expected behavior. +- [ ] Tests (optional): Tests have been added or updated to cover any new or changed functionality. + +--- ## Additional Notes -Include any deployment notes, performance implications, or other relevant information: +Include any deployment notes, performance implications, security considerations, or other relevant information (e.g., screenshots or logs if applicable). diff --git a/.github/workflows/performance-comparison.yml b/.github/workflows/performance-comparison.yml new file mode 100644 index 0000000000..b0a60d3592 --- /dev/null +++ b/.github/workflows/performance-comparison.yml @@ -0,0 +1,42 @@ +name: Performance Comparison + +on: + workflow_dispatch: + +jobs: + compare-performance: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install openai memory_profiler agno langgraph langchain_openai + + - name: Run Performance Tests + # env: + # OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + run: | + echo "Running LangGraph Performance Test..." + python evals/performance/other/langgraph_instantiation.py > langgraph_results.txt + + echo "Running Agno Performance Test..." + python evals/performance/instantiation_with_tool.py > agno_results.txt + + - name: Process and Compare Results + run: | + echo "Performance Test Results" > comparison.md + echo "========================" >> comparison.md + echo "" >> comparison.md + echo "## LangGraph Results" >> comparison.md + cat langgraph_results.txt >> comparison.md + echo "" >> comparison.md + echo "## Agno Results" >> comparison.md + cat agno_results.txt >> comparison.md diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 147aa59b76..5682fa3659 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,10 @@ jobs: matrix: python-version: ["3.9"] + defaults: + run: + working-directory: libs/agno + steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} diff --git a/.gitignore b/.gitignore index 440782ecf9..83be36f0a5 100644 --- a/.gitignore +++ b/.gitignore @@ -35,9 +35,11 @@ dist # ignore virtualenvs .venv* +.perfenv* venv* -phienv* +agnoenv* aienv* +phienv* # ignore tmp dirs scratch diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000000..0bf02f33a5 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,2 @@ +# Default owner for all files in the repository +* @agno-agi/phidata-admins diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 08b2478e06..79d48cba7b 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -60,7 +60,7 @@ representative at an online or offline event. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at -help@phidata.com. +help@agno.com. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index df5b3cacfd..91bdb9e1be 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ -# Contributing to phidata +# Contributing to agno -Phidata is an open-source project and we welcome contributions. +Agno is an open-source project and we welcome contributions. ## 👩‍💻 How to contribute @@ -16,15 +16,17 @@ Please follow the [fork and pull request](https://docs.github.com/en/get-started 1. Clone the repository. 2. Create a virtual environment: - - For Unix, use `./scripts/create_venv.sh`. - - For Windows, use `.\scripts\create_venv.bat`. + - For Unix, use `./scripts/dev_setup.sh`. + - For Windows, use `.\scripts\dev_setup.bat`. - This setup will: - - Create a `phienv` virtual environment in the current directory. + - Create a `.venv` virtual environment in the current directory. - Install the required packages. - - Install the `phidata` package in editable mode. + - Install the `agno` package in editable mode. 3. Activate the virtual environment: - - On Unix: `source phienv/bin/activate` - - On Windows: `phienv\Scripts\activate` + - On Unix: `source .venv/bin/activate` + - On Windows: `.venv\Scripts\activate` + +> From here on you have to use `uv pip install` to install missing packages ## Formatting and validation @@ -37,60 +39,60 @@ Ensure your code meets our quality standards by running the appropriate formatti - `.\scripts\format.bat` - `.\scripts\validate.bat` -These scripts will perform code formatting with `ruff`, static type checks with `mypy`, and run unit tests with `pytest`. +These scripts will perform code formatting with `ruff` and static type checks with `mypy`. ## Adding a new Vector Database 1. Setup your local environment by following the [Development setup](#development-setup). -2. Create a new directory under `phi/vectordb` for the new vector database. +2. Create a new directory under `libs/agno/agno/vectordb` for the new vector database. 3. Create a Class for your VectorDb that implements the `VectorDb` interface - - Your Class will be in the `phi/vectordb//.py` file. - - The `VectorDb` interface is defined in `phi/vectordb/base - - Import your `VectorDb` Class in `phi/vectordb//__init__.py`. - - Checkout the [`phi/vectordb/pgvector/pgvector`](https://github.com/phidatahq/phidata/blob/main/phi/vectordb/pgvector/pgvector.py) file for an example. + - Your Class will be in the `libs/agno/agno/vectordb//.py` file. + - The `VectorDb` interface is defined in `libs/agno/agno/vectordb/base + - Import your `VectorDb` Class in `libs/agno/agno/vectordb//__init__.py`. + - Checkout the [`libs/agno/agno/vectordb/pgvector/pgvector`](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/vectordb/pgvector/pgvector.py) file for an example. 4. Add a recipe for using your `VectorDb` under `cookbook/vectordb/`. - - Checkout [`phidata/cookbook/vectordb/pgvector`](https://github.com/phidatahq/phidata/tree/main/cookbook/vectordb/pgvector) for an example. + - Checkout [`agno/cookbook/vectordb/pgvector`](https://github.com/agno-agi/agno/tree/main/cookbook/vectordb/pgvector) for an example. 5. Important: Format and validate your code by running `./scripts/format.sh` and `./scripts/validate.sh`. 6. Submit a pull request. ## Adding a new Model Provider 1. Setup your local environment by following the [Development setup](#development-setup). -2. Create a new directory under `phi/model` for the new Model provider. +2. Create a new directory under `libs/agno/agno/models` for the new Model provider. 3. If the Model provider supports the OpenAI API spec: - - Create a Class for your LLM provider that inherits the `OpenAILike` Class from `phi/model/openai/like.py`. - - Your Class will be in the `phi/model//.py` file. - - Import your Class in the `phi/model//__init__.py` file. - - Checkout the [`phi/model/xai/xai.py`](https://github.com/phidatahq/phidata/blob/main/phi/llm/together/together.py) file for an example. + - Create a Class for your LLM provider that inherits the `OpenAILike` Class from `libs/agno/agno/models/openai/like.py`. + - Your Class will be in the `libs/agno/agno/models//.py` file. + - Import your Class in the `libs/agno/agno/models//__init__.py` file. + - Checkout the [`agno/models/xai/xai.py`](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/models/together/together.py) file for an example. 4. If the Model provider does not support the OpenAI API spec: - Reach out to us on [Discord](https://discord.gg/4MtYHHrgA8) or open an issue to discuss the best way to integrate your LLM provider. - - Checkout [`phi/model/anthropic/claude.py`](https://github.com/phidatahq/phidata/blob/main/phi/model/anthropic/claude.py) or [`phi/model/cohere/chat.py`](https://github.com/phidatahq/phidata/blob/main/phi/model/cohere/chat.py) for inspiration. + - Checkout [`agno/models/anthropic/claude.py`](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/models/anthropic/claude.py) or [`agno/models/cohere/chat.py`](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/models/cohere/chat.py) for inspiration. 5. Add a recipe for using your Model provider under `cookbook/providers/`. - - Checkout [`phidata/cookbook/provider/claude`](https://github.com/phidatahq/phidata/tree/main/cookbook/providers/claude) for an example. + - Checkout [`agno/cookbook/provider/claude`](https://github.com/agno-agi/agno/tree/main/cookbook/providers/claude) for an example. 6. Important: Format and validate your code by running `./scripts/format.sh` and `./scripts/validate.sh`. 7. Submit a pull request. ## Adding a new Tool. 1. Setup your local environment by following the [Development setup](#development-setup). -2. Create a new directory under `phi/tools` for the new Tool. -3. Create a Class for your Tool that inherits the `Toolkit` Class from `phi/tools/toolkit/.py`. - - Your Class will be in `phi/tools/.py`. +2. Create a new directory under `libs/agno/agno/tools` for the new Tool. +3. Create a Class for your Tool that inherits the `Toolkit` Class from `libs/agno/agno/tools/toolkit/.py`. + - Your Class will be in `libs/agno/agno/tools/.py`. - Make sure to register all functions in your class via a flag. - - Checkout the [`phi/tools/youtube_tools.py`](https://github.com/phidatahq/phidata/blob/main/phi/tools/youtube_tools.py) file for an example. - - If your tool requires an API key, checkout the [`phi/tools/serpapi_tools.py`](https://github.com/phidatahq/phidata/blob/main/phi/tools/serpapi_tools.py) as well. + - Checkout the [`agno/tools/youtube_tools.py`](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/youtube_tools.py) file for an example. + - If your tool requires an API key, checkout the [`agno/tools/serpapi_tools.py`](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/serpapi_tools.py) as well. 4. Add a recipe for using your Tool under `cookbook/tools/`. - - Checkout [`phidata/cookbook/tools/youtube_tools`](https://github.com/phidatahq/phidata/blob/main/cookbook/tools/youtube_tools.py) for an example. + - Checkout [`agno/cookbook/tools/youtube_tools`](https://github.com/agno-agi/agno/blob/main/cookbook/tools/youtube_tools.py) for an example. 5. Important: Format and validate your code by running `./scripts/format.sh` and `./scripts/validate.sh`. 6. Submit a pull request. -Message us on [Discord](https://discord.gg/4MtYHHrgA8) or post on [Discourse](https://community.phidata.com/) if you have any questions or need help with credits. +Message us on [Discord](https://discord.gg/4MtYHHrgA8) or post on [Discourse](https://community.agno.com/) if you have any questions or need help with credits. ## 📚 Resources -- Documentation +- Documentation - Discord -- Discourse +- Discourse ## 📝 License diff --git a/README.md b/README.md index 569b649211..3fd5886d45 100644 --- a/README.md +++ b/README.md @@ -1,156 +1,188 @@ -

- phidata -

- -

- - Read the Docs +

+ + +## Overview + +[Agno](https://docs.agno.com) is a lightweight framework for building multi-modal Agents. + +## Simple, Fast, and Agnostic -

-Build multi-modal Agents with memory, knowledge, tools and reasoning. -

+Agno is designed with three core principles: - +- **Simplicity**: No graphs, chains, or convoluted patterns — just pure python. +- **Uncompromising Performance**: Blazing fast agents with a minimal memory footprint. +- **Truly Agnostic**: Any model, any provider, any modality. Future-proof agents. -## What is phidata? +## Key features -**Phidata is a framework for building multi-modal agents**, use phidata to: +Here's why you should build Agents with Agno: -- **Build multi-modal agents with memory, knowledge, tools and reasoning.** -- **Build teams of agents that can work together to solve problems.** -- **Chat with your agents using a beautiful Agent UI.** +- **Lightning Fast**: Agent creation is 6000x faster than LangGraph (see [performance](#performance)). +- **Model Agnostic**: Use any model, any provider, no lock-in. +- **Multi Modal**: Native support for text, image, audio and video. +- **Multi Agent**: Delegate tasks across a team of specialized agents. +- **Memory Management**: Store user sessions and agent state in a database. +- **Knowledge Stores**: Use vector databases for Agentic RAG or dynamic few-shot. +- **Structured Outputs**: Make Agents respond with structured data. +- **Monitoring**: Track agent sessions and performance in real-time on [agno.com](https://app.agno.com). -## Install + +## Installation ```shell -pip install -U phidata +pip install -U agno ``` -## Key Features +## What are Agents? -- [Simple & Elegant](#simple--elegant) -- [Powerful & Flexible](#powerful--flexible) -- [Multi-Modal by default](#multi-modal-by-default) -- [Multi-Agent orchestration](#multi-agent-orchestration) -- [A beautiful Agent UI to chat with your agents](#a-beautiful-agent-ui-to-chat-with-your-agents) -- [Agentic RAG built-in](#agentic-rag) -- [Structured Outputs](#structured-outputs) -- [Reasoning Agents](#reasoning-agents-experimental) -- [Monitoring & Debugging built-in](#monitoring--debugging) -- [Demo Agents](#demo-agents) +Agents are autonomous programs that use language models to achieve tasks. They solve problems by running tools, accessing knowledge and memory to improve responses. -## Simple & Elegant +Instead of a rigid binary definition, let's think of Agents in terms of agency and autonomy. -Phidata Agents are simple and elegant, resulting in minimal, beautiful code. +- **Level 0**: Agents with no tools (basic inference tasks). +- **Level 1**: Agents with tools for autonomous task execution. +- **Level 2**: Agents with knowledge, combining memory and reasoning. +- **Level 3**: Teams of agents collaborating on complex workflows. -For example, you can create a web search agent in 10 lines of code, create a file `web_search.py` +## Example - Basic Agent ```python -from phi.agent import Agent -from phi.model.openai import OpenAIChat -from phi.tools.duckduckgo import DuckDuckGo +from agno.agent import Agent +from agno.models.openai import OpenAIChat -web_agent = Agent( +agent = Agent( model=OpenAIChat(id="gpt-4o"), - tools=[DuckDuckGo()], - instructions=["Always include sources"], - show_tool_calls=True, - markdown=True, + description="You are an enthusiastic news reporter with a flair for storytelling!", + markdown=True ) -web_agent.print_response("Tell me about OpenAI Sora?", stream=True) +agent.print_response("Tell me about a breaking news story from New York.", stream=True) ``` -Install libraries, export your `OPENAI_API_KEY` and run the Agent: +To run the agent, install dependencies and export your `OPENAI_API_KEY`. ```shell -pip install phidata openai duckduckgo-search +pip install agno openai export OPENAI_API_KEY=sk-xxxx -python web_search.py +python basic_agent.py ``` -## Powerful & Flexible +[View this example in the cookbook](./cookbook/getting_started/01_basic_agent.py) -Phidata agents can use multiple tools and follow instructions to achieve complex tasks. +## Example - Agent with tools -For example, you can create a finance agent with tools to query financial data, create a file `finance_agent.py` +This basic agent will obviously make up a story, lets give it a tool to search the web. ```python -from phi.agent import Agent -from phi.model.openai import OpenAIChat -from phi.tools.yfinance import YFinanceTools +from agno.agent import Agent +from agno.models.openai import OpenAIChat +from agno.tools.duckduckgo import DuckDuckGoTools -finance_agent = Agent( - name="Finance Agent", +agent = Agent( model=OpenAIChat(id="gpt-4o"), - tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True, company_news=True)], - instructions=["Use tables to display data"], + description="You are an enthusiastic news reporter with a flair for storytelling!", + tools=[DuckDuckGoTools()], show_tool_calls=True, - markdown=True, + markdown=True ) -finance_agent.print_response("Summarize analyst recommendations for NVDA", stream=True) +agent.print_response("Tell me about a breaking news story from New York.", stream=True) ``` -Install libraries and run the Agent: +Install dependencies and run the Agent: ```shell -pip install yfinance +pip install duckduckgo-search -python finance_agent.py +python agent_with_tools.py ``` -## Multi-Modal by default +Now you should see a much more relevant result. + +[View this example in the cookbook](./cookbook/getting_started/02_agent_with_tools.py) -Phidata agents support text, images, audio and video. +## Example - Agent with knowledge -For example, you can create an image agent that can understand images and make tool calls as needed, create a file `image_agent.py` +Agents can store knowledge in a vector database and use it for RAG or dynamic few-shot learning. + +**Agno agents use Agentic RAG** by default, which means they will search their knowledge base for the specific information they need to achieve their task. ```python -from phi.agent import Agent -from phi.model.openai import OpenAIChat -from phi.tools.duckduckgo import DuckDuckGo +from agno.agent import Agent +from agno.models.openai import OpenAIChat +from agno.embedder.openai import OpenAIEmbedder +from agno.tools.duckduckgo import DuckDuckGoTools +from agno.knowledge.pdf_url import PDFUrlKnowledgeBase +from agno.vectordb.lancedb import LanceDb, SearchType agent = Agent( model=OpenAIChat(id="gpt-4o"), - tools=[DuckDuckGo()], - markdown=True, + description="You are a Thai cuisine expert!", + instructions=[ + "Search your knowledge base for Thai recipes.", + "If the question is better suited for the web, search the web to fill in gaps.", + "Prefer the information in your knowledge base over the web results." + ], + knowledge=PDFUrlKnowledgeBase( + urls=["https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf"], + vector_db=LanceDb( + uri="tmp/lancedb", + table_name="recipes", + search_type=SearchType.hybrid, + embedder=OpenAIEmbedder(id="text-embedding-3-small"), + ), + ), + tools=[DuckDuckGoTools()], + show_tool_calls=True, + markdown=True ) -agent.print_response( - "Tell me about this image and give me the latest news about it.", - images=["https://upload.wikimedia.org/wikipedia/commons/b/bf/Krakow_-_Kosciol_Mariacki.jpg"], - stream=True, -) +# Comment out after the knowledge base is loaded +if agent.knowledge is not None: + agent.knowledge.load() + +agent.print_response("How do I make chicken and galangal in coconut milk soup", stream=True) +agent.print_response("What is the history of Thai curry?", stream=True) ``` -Run the Agent: +Install dependencies and run the Agent: ```shell -python image_agent.py +pip install lancedb tantivy pypdf duckduckgo-search + +python agent_with_knowledge.py ``` -## Multi-Agent orchestration +[View this example in the cookbook](./cookbook/getting_started/03_agent_with_knowledge.py) -Phidata agents can work together as a team to achieve complex tasks, create a file `agent_team.py` +## Example - Multi Agent Teams + +Agents work best when they have a singular purpose, a narrow scope and a small number of tools. When the number of tools grows beyond what the language model can handle or the tools belong to different categories, use a team of agents to spread the load. ```python -from phi.agent import Agent -from phi.model.openai import OpenAIChat -from phi.tools.duckduckgo import DuckDuckGo -from phi.tools.yfinance import YFinanceTools +from agno.agent import Agent +from agno.models.openai import OpenAIChat +from agno.tools.duckduckgo import DuckDuckGoTools +from agno.tools.yfinance import YFinanceTools web_agent = Agent( name="Web Agent", role="Search the web for information", model=OpenAIChat(id="gpt-4o"), - tools=[DuckDuckGo()], - instructions=["Always include sources"], + tools=[DuckDuckGoTools()], + instructions="Always include sources", show_tool_calls=True, markdown=True, ) @@ -160,7 +192,7 @@ finance_agent = Agent( role="Get financial data", model=OpenAIChat(id="gpt-4o"), tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True)], - instructions=["Use tables to display data"], + instructions="Use tables to display data", show_tool_calls=True, markdown=True, ) @@ -173,381 +205,113 @@ agent_team = Agent( markdown=True, ) -agent_team.print_response("Summarize analyst recommendations and share the latest news for NVDA", stream=True) +agent_team.print_response("What's the market outlook and financial performance of AI semiconductor companies?", stream=True) ``` -Run the Agent team: +Install dependencies and run the Agent team: ```shell -python agent_team.py -``` - -## A beautiful Agent UI to chat with your agents +pip install duckduckgo-search yfinance -Phidata provides a beautiful UI for interacting with your agents. Let's take it for a spin, create a file `playground.py` - -![agent_playground](https://github.com/user-attachments/assets/546ce6f5-47f0-4c0c-8f06-01d560befdbc) - -> [!NOTE] -> Phidata does not store any data, all agent data is stored locally in a sqlite database. - -```python -from phi.agent import Agent -from phi.model.openai import OpenAIChat -from phi.storage.agent.sqlite import SqlAgentStorage -from phi.tools.duckduckgo import DuckDuckGo -from phi.tools.yfinance import YFinanceTools -from phi.playground import Playground, serve_playground_app - -web_agent = Agent( - name="Web Agent", - model=OpenAIChat(id="gpt-4o"), - tools=[DuckDuckGo()], - instructions=["Always include sources"], - storage=SqlAgentStorage(table_name="web_agent", db_file="agents.db"), - add_history_to_messages=True, - markdown=True, -) - -finance_agent = Agent( - name="Finance Agent", - model=OpenAIChat(id="gpt-4o"), - tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True, company_news=True)], - instructions=["Use tables to display data"], - storage=SqlAgentStorage(table_name="finance_agent", db_file="agents.db"), - add_history_to_messages=True, - markdown=True, -) - -app = Playground(agents=[finance_agent, web_agent]).get_app() - -if __name__ == "__main__": - serve_playground_app("playground:app", reload=True) -``` - - -Authenticate with phidata by running the following command: - -```shell -phi auth -``` - -or by exporting the `PHI_API_KEY` for your workspace from [phidata.app](https://www.phidata.app) - -```bash -export PHI_API_KEY=phi-*** -``` - -Install dependencies and run the Agent Playground: - -``` -pip install 'fastapi[standard]' sqlalchemy - -python playground.py -``` - -- Open the link provided or navigate to `http://phidata.app/playground` -- Select the `localhost:7777` endpoint and start chatting with your agents! - -