|
| 1 | +--- |
| 2 | +title: A beautiful UI for your Agents |
| 3 | +sidebarTitle: Getting Started |
| 4 | +--- |
| 5 | + |
| 6 | +<Frame> |
| 7 | + <img |
| 8 | + height="200" |
| 9 | + src="/images/agent-ui.png" |
| 10 | + style={{ borderRadius: '8px' }} |
| 11 | + /> |
| 12 | +</Frame> |
| 13 | + |
| 14 | +Agno provides a beautiful UI for interacting with your agents, completely open source, free to use and build on top of. It's a simple interface that allows you to chat with your agents, view their memory, knowledge, and more. |
| 15 | + |
| 16 | +<Note> |
| 17 | +No data is sent to [agno.com](https://app.agno.com), all agent data is stored locally in your sqlite database. |
| 18 | +</Note> |
| 19 | + |
| 20 | +The Open Source Agent UI is built with Next.js and TypeScript. After the success of the [Agent Playground](/introduction/playground), the community asked for a self-hosted alternative and we delivered! |
| 21 | + |
| 22 | +# Get Started with Agent UI |
| 23 | + |
| 24 | +To clone the Agent UI, run the following command in your terminal: |
| 25 | + |
| 26 | +```bash |
| 27 | +npx create-agent-ui@latest |
| 28 | +``` |
| 29 | + |
| 30 | +Enter `y` to create a new project, install dependencies, then run the agent-ui using: |
| 31 | + |
| 32 | +```bash |
| 33 | +cd agent-ui && npm run dev |
| 34 | +``` |
| 35 | + |
| 36 | +Open [http://localhost:3000](http://localhost:3000) to view the Agent UI, but remember to connect to your local agents. |
| 37 | + |
| 38 | +<Frame> |
| 39 | + <img |
| 40 | + height="200" |
| 41 | + src="/images/agent-ui-homepage.png" |
| 42 | + style={{ borderRadius: '8px' }} |
| 43 | + /> |
| 44 | +</Frame> |
| 45 | + |
| 46 | +<br /> |
| 47 | + |
| 48 | +<Accordion title="Clone the repository manually" icon="github"> |
| 49 | + |
| 50 | +You can also clone the repository manually |
| 51 | + |
| 52 | +```bash |
| 53 | +git clone https://github.com/agno-agi/agent-ui.git |
| 54 | +``` |
| 55 | + |
| 56 | +And run the agent-ui using |
| 57 | + |
| 58 | +```bash |
| 59 | +cd agent-ui && pnpm install && pnpm dev |
| 60 | +``` |
| 61 | + |
| 62 | +</Accordion> |
| 63 | + |
| 64 | +## Connect to Local Agents |
| 65 | + |
| 66 | +The Agent UI needs to connect to a playground server, which you can run locally or on any cloud provider. |
| 67 | + |
| 68 | +Let's start with a local playground server. Create a file `playground.py` |
| 69 | + |
| 70 | +```python playground.py |
| 71 | +from agno.agent import Agent |
| 72 | +from agno.models.openai import OpenAIChat |
| 73 | +from agno.playground import Playground, serve_playground_app |
| 74 | +from agno.storage.agent.sqlite import SqliteAgentStorage |
| 75 | +from agno.tools.duckduckgo import DuckDuckGoTools |
| 76 | +from agno.tools.yfinance import YFinanceTools |
| 77 | + |
| 78 | +agent_storage: str = "tmp/agents.db" |
| 79 | + |
| 80 | +web_agent = Agent( |
| 81 | + name="Web Agent", |
| 82 | + model=OpenAIChat(id="gpt-4o"), |
| 83 | + tools=[DuckDuckGoTools()], |
| 84 | + instructions=["Always include sources"], |
| 85 | + # Store the agent sessions in a sqlite database |
| 86 | + storage=SqliteAgentStorage(table_name="web_agent", db_file=agent_storage), |
| 87 | + # Adds the current date and time to the instructions |
| 88 | + add_datetime_to_instructions=True, |
| 89 | + # Adds the history of the conversation to the messages |
| 90 | + add_history_to_messages=True, |
| 91 | + # Number of history responses to add to the messages |
| 92 | + num_history_responses=5, |
| 93 | + # Adds markdown formatting to the messages |
| 94 | + markdown=True, |
| 95 | +) |
| 96 | + |
| 97 | +finance_agent = Agent( |
| 98 | + name="Finance Agent", |
| 99 | + model=OpenAIChat(id="gpt-4o"), |
| 100 | + tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True, company_news=True)], |
| 101 | + instructions=["Always use tables to display data"], |
| 102 | + storage=SqliteAgentStorage(table_name="finance_agent", db_file=agent_storage), |
| 103 | + add_datetime_to_instructions=True, |
| 104 | + add_history_to_messages=True, |
| 105 | + num_history_responses=5, |
| 106 | + markdown=True, |
| 107 | +) |
| 108 | + |
| 109 | +app = Playground(agents=[web_agent, finance_agent]).get_app() |
| 110 | + |
| 111 | +if __name__ == "__main__": |
| 112 | + serve_playground_app("playground:app", reload=True) |
| 113 | +``` |
| 114 | + |
| 115 | +In another terminal, run the playground server: |
| 116 | + |
| 117 | +<Steps> |
| 118 | + <Step title="Setup your virtual environment"> |
| 119 | + |
| 120 | + <CodeGroup> |
| 121 | + ```bash Mac |
| 122 | + python3 -m venv .venv |
| 123 | + source .venv/bin/activate |
| 124 | + ``` |
| 125 | + |
| 126 | + ```bash Windows |
| 127 | + python3 -m venv aienv |
| 128 | + aienv/scripts/activate |
| 129 | + ``` |
| 130 | + </CodeGroup> |
| 131 | + |
| 132 | + </Step> |
| 133 | + <Step title="Install dependencies"> |
| 134 | + |
| 135 | + <CodeGroup> |
| 136 | + ```bash Mac |
| 137 | + pip install -U openai duckduckgo-search yfinance sqlalchemy 'fastapi[standard]' agno |
| 138 | + ``` |
| 139 | + |
| 140 | + ```bash Windows |
| 141 | + pip install -U openai duckduckgo-search yfinance sqlalchemy 'fastapi[standard]' agno |
| 142 | + ``` |
| 143 | + </CodeGroup> |
| 144 | + |
| 145 | + </Step> |
| 146 | + <Step title="Export your OpenAI key"> |
| 147 | + |
| 148 | + <CodeGroup> |
| 149 | + ```bash Mac |
| 150 | + export OPENAI_API_KEY=sk-*** |
| 151 | + ``` |
| 152 | + |
| 153 | + ```bash Windows |
| 154 | + setx OPENAI_API_KEY sk-*** |
| 155 | + ``` |
| 156 | + </CodeGroup> |
| 157 | + |
| 158 | + </Step> |
| 159 | + <Step title="Run the Playground"> |
| 160 | + |
| 161 | + ```shell |
| 162 | + python playground.py |
| 163 | + ``` |
| 164 | + |
| 165 | + </Step> |
| 166 | +</Steps> |
| 167 | + |
| 168 | +<Tip>Make sure the `serve_playground_app()` points to the file containing your `Playground` app.</Tip> |
| 169 | + |
| 170 | +## View the playground |
| 171 | + |
| 172 | +- Open [http://localhost:3000](http://localhost:3000) to view the Agent UI |
| 173 | +- Select the `localhost:7777` endpoint and start chatting with your agents! |
| 174 | + |
| 175 | +<video |
| 176 | + autoPlay |
| 177 | + muted |
| 178 | + controls |
| 179 | + className="w-full aspect-video" |
| 180 | + src="/videos/agent-ui-demo.mp4" |
| 181 | +></video> |
0 commit comments