Skip to content

Commit dec1d20

Browse files
authored
Merge branch 'main' into feat/apify-tools
2 parents 41da458 + 8555965 commit dec1d20

File tree

15 files changed

+752
-41
lines changed

15 files changed

+752
-41
lines changed

agent-ui/introduction.mdx

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
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>

agents/prompts.mdx

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,23 +85,18 @@ The Agent creates a default system message that can be customized using the foll
8585
| Parameter | Type | Default | Description |
8686
|-----------|------|---------|-------------|
8787
| `description` | `str` | `None` | A description of the Agent that is added to the start of the system message. |
88-
| `task` | `str` | `None` | Describe the task the agent should achieve. |
88+
| `goal` | `str` | `None` | Describe the task the agent should achieve. |
8989
| `instructions` | `List[str]` | `None` | List of instructions added to the system prompt in `<instructions>` tags. Default instructions are also created depending on values for `markdown`, `output_model` etc. |
9090
| `additional_context` | `str` | `None` | Additional context added to the end of the system message. |
9191
| `expected_output` | `str` | `None` | Provide the expected output from the Agent. This is added to the end of the system message. |
92-
| `extra_instructions` | `List[str]` | `None` | List of extra instructions added to the default system prompt. Use these when you want to add some extra instructions at the end of the default instructions. |
93-
| `prevent_hallucinations` | `bool` | `False` | If True, add instructions to return "I don't know" when the agent does not know the answer. |
94-
| `prevent_prompt_injection` | `bool` | `False` | If True, add instructions to prevent prompt injection attacks. |
95-
| `limit_tool_access` | `bool` | `False` | If True, add instructions for limiting tool access to the default system prompt if tools are provided |
9692
| `markdown` | `bool` | `False` | Add an instruction to format the output using markdown. |
9793
| `add_datetime_to_instructions` | `bool` | `False` | If True, add the current datetime to the prompt to give the agent a sense of time. This allows for relative times like "tomorrow" to be used in the prompt |
98-
| `system_prompt` | `str` | `None` | System prompt: provide the system prompt as a string |
99-
| `system_prompt_template` | `PromptTemplate` | `None` | Provide the system prompt as a PromptTemplate. |
100-
| `use_default_system_message` | `bool` | `True` | If True, build a default system message using agent settings and use that. |
94+
| `system_message` | `str` | `None` | System prompt: provide the system prompt as a string |
10195
| `system_message_role` | `str` | `system` | Role for the system message. |
96+
| `create_default_system_message` | `bool` | `True` | If True, build a default system prompt using agent settings and use that. |
10297

10398
<Tip>
104-
Disable the default system message by setting `use_default_system_message=False`.
99+
Disable the default system message by setting `create_default_system_message=False`.
105100
</Tip>
106101

107102
## Default user message
@@ -110,15 +105,18 @@ The Agent creates a default user message, which is either the input message or a
110105

111106
| Parameter | Type | Default | Description |
112107
|-----------|------|---------|-------------|
113-
| `enable_rag` | `bool` | `False` | Enable RAG by adding references from the knowledge base to the prompt. |
114-
| `add_rag_instructions` | `bool` | `False` | If True, adds instructions for using the RAG to the system prompt (if knowledge is also provided). For example: add an instruction to prefer information from the knowledge base over its training data. |
108+
| `context` | `str` | `None` | Additional context added to the end of the user message. |
109+
| `add_context` | `bool` | `False` | If True, add the context to the user prompt. |
110+
| `resolve_context` | `bool` | `True` | If True, resolve the context (i.e. call any functions in the context) before adding it to the user prompt. |
111+
| `add_references` | `bool` | `False` | Enable RAG by adding references from the knowledge base to the prompt. |
112+
| `retriever` | `Callable` | `None` | Function to get references to add to the user_message. This function, if provided, is called when `add_references` is True. |
113+
| `references_format` | `Literal["json", "yaml"]` | `"json"` | Format of the references. |
115114
| `add_history_to_messages` | `bool` | `False` | If true, adds the chat history to the messages sent to the Model. |
116115
| `num_history_responses` | `int` | `3` | Number of historical responses to add to the messages. |
117-
| `user_prompt` | `Union[List, Dict, str]` | `None` | Provide the user prompt as a string. Note: this will ignore the message sent to the run function. |
118-
| `user_prompt_template` | `PromptTemplate` | `None` | Provide the user prompt as a PromptTemplate. |
119-
| `use_default_user_message` | `bool` | `True` | If True, build a default user prompt using references and chat history. |
116+
| `user_message` | `Union[List, Dict, str]` | `None` | Provide the user prompt as a string. Note: this will ignore the message sent to the run function. |
120117
| `user_message_role` | `str` | `user` | Role for the user message. |
118+
| `create_default_user_message` | `bool` | `True` | If True, build a default user prompt using references and chat history. |
121119

122120
<Tip>
123-
Disable the default user message by setting `use_default_user_message=False`.
121+
Disable the default user message by setting `create_default_user_message=False`.
124122
</Tip>

agents/structured-output.mdx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,17 @@ json_mode_agent = Agent(
3030
model=OpenAIChat(id="gpt-4o"),
3131
description="You write movie scripts.",
3232
response_model=MovieScript,
33+
use_json_mode=True,
3334
)
35+
json_mode_agent.print_response("New York")
36+
3437
# Agent that uses structured outputs
3538
structured_output_agent = Agent(
3639
model=OpenAIChat(id="gpt-4o"),
3740
description="You write movie scripts.",
3841
response_model=MovieScript,
3942
)
4043

41-
# Get the response in a variable
42-
# json_mode_response: RunResponse = json_mode_agent.run("New York")
43-
# pprint(json_mode_response.content)
44-
# structured_output_response: RunResponse = structured_output_agent.run("New York")
45-
# pprint(structured_output_response.content)
46-
47-
json_mode_agent.print_response("New York")
4844
structured_output_agent.print_response("New York")
4945
```
5046

changelog/overview.mdx

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,69 @@ title: "Product updates"
33
mode: "wide"
44
---
55

6+
<Update label="2025-04-02" description="v1.2.7">
7+
## 1.2.7
8+
9+
## New Features:
10+
11+
- **Gemini Image Generation**: Added support for generating images straight from Gemini using the `gemini-2.0-flash-exp-image-generation` model.
12+
13+
## Improvements:
14+
15+
- **Vertex AI**: Improved use of Vertex AI with Gemini Model class to closely follow the official Google specification
16+
- **Function Result Caching Improvement:** We now have result caching on all Agno Toolkits and any custom functions using the `@tool` decorator. See the docs [here](https://docs.agno.com/tools/functions).
17+
- **Async Vector DB and Knowledge Base Improvements**: Various knowledge bases, readers and vector DBs now have `async-await` support, so it will be used in `agent.arun` and `agent.aprint_response`. This also means that `knowledge_base.aload()` is possible which should greatly increase loading speed in some cases. The following have been converted:
18+
- Vector DBs:
19+
- `LanceDb`[Here](https://github.com/agno-agi/agno/blob/main/cookbook/agent_concepts/knowledge/vector_dbs/lance_db/async_lance_db.py) is a cookbook to illustrate how to use it.
20+
- `Milvus`[Here](https://github.com/agno-agi/agno/blob/main/cookbook/agent_concepts/knowledge/vector_dbs/milvus_db/async_milvus_db.py) is a cookbook to illustrate how to use it.
21+
- `Weaviate`[Here](https://github.com/agno-agi/agno/blob/main/cookbook/agent_concepts/knowledge/vector_dbs/weaviate_db/async_weaviate_db.py) is a cookbook to illustrate how to use it.
22+
- Knowledge Bases:
23+
- `JSONKnowledgeBase`[Here](https://github.com/agno-agi/agno/blob/main/cookbook/agent_concepts/knowledge/json_kb_async.py) is a cookbook to illustrate how to use it.
24+
- `PDFKnowledgeBase`[Here](https://github.com/agno-agi/agno/blob/main/cookbook/agent_concepts/knowledge/pdf_kb_async.py) is a cookbook to illustrate how to use it.
25+
- `PDFUrlKnowledgeBase`[Here](https://github.com/agno-agi/agno/blob/main/cookbook/agent_concepts/knowledge/pdf_url_kb_async.py) is a cookbook to illustrate how to use it.
26+
- `CSVKnowledgeBase`[Here](https://github.com/agno-agi/agno/blob/main/cookbook/agent_concepts/knowledge/csv_kb_async.py) is a cookbook to illustrate how to use it.
27+
- `CSVUrlKnowledgeBase`[Here](https://github.com/agno-agi/agno/blob/main/cookbook/agent_concepts/knowledge/csv_url_kb_async.py) is a cookbook to illustrate how to use it.
28+
- `ArxivKnowledgeBase`[Here](https://github.com/agno-agi/agno/blob/main/cookbook/agent_concepts/knowledge/arxiv_kb_async.py) is a cookbook to illustrate how to use it.
29+
- `WebsiteKnowledgeBase`[Here](https://github.com/agno-agi/agno/blob/main/cookbook/agent_concepts/knowledge/website_kb_async.py) is a cookbook to illustrate how to use it.
30+
- `YoutubeKnowledgeBase`[Here](https://github.com/agno-agi/agno/blob/main/cookbook/agent_concepts/knowledge/youtube_kb_async.py) is a cookbook to illustrate how to use it.
31+
- `TextKnowledgeBase`[Here](https://github.com/agno-agi/agno/blob/main/cookbook/agent_concepts/knowledge/text_kb_async.py) is a cookbook to illustrate how to use it.
32+
33+
## Bug Fixes:
34+
35+
- **Recursive Chunking Infinite Loop**: Fixes an issue with RecursiveChunking getting stuck in an infinite loop for large documents.
36+
</Update>
37+
38+
<Update label="2025-03-28" description="v1.2.6">
39+
## 1.2.6
40+
41+
## Bug Fixes:
42+
43+
- **Gemini Function call result fix**: Fixed a bug with function call results failing formatting and added proper role mapping .
44+
- **Reasoning fix**: Fixed an issue with default reasoning and improved logging for reasoning models .
45+
46+
</Update>
47+
<Update label="2025-03-27" description="v1.2.5">
48+
## 1.2.5
49+
50+
## New Features:
51+
52+
- **E2B Tools:** Added E2B Tools to run code in E2B Sandbox
53+
54+
## Improvements:
55+
56+
- **Teams Tools**: Add `tools` and `tool_call_limit` to `Team`. This means the team leader itself can also have tools provided by the user, so it can act as an agent.
57+
- **Teams Instructions:** Improved instructions around attached images, audio, videos, and files. This should increase success when attaching artifacts to prompts meant for member agents.
58+
- **MCP Include/Exclude Tools**: Expanded `MCPTools` to allow you to specify tools to specifically include or exclude from all the available tools on an MCP server. This is very useful for limiting which tools the model has access to.
59+
- **Tool Decorator Async Support**: The `@tool()` decorator now supports async functions, including async pre and post-hooks.
60+
61+
## Bug Fixes:
62+
63+
- **Default Chain-of-Thought Reasoning:** Fixed issue where reasoning would not default to manual CoT if the provided reasoning model was not capable of reasoning.
64+
- **Teams non-markdown responses**: Fixed issue with non-markdown responses in teams.
65+
- **Ollama tool choice:** Removed `tool_choice` from Ollama usage as it is not supported.
66+
- **Worklow session retrieval from storage**: Fixed `entity_id` mappings.
67+
68+
</Update>
669
<Update label="2025-03-25" description="v1.2.4">
770
## 1.2.4
871

0 commit comments

Comments
 (0)