Skip to content

Commit 9c13535

Browse files
authored
Update the docs for teams knowledge changes (#203)
1 parent 28f2e30 commit 9c13535

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

_snippets/team-reference.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,20 @@
1313
| `description` | `Optional[str]` | `None` | A description of the team that is added to the start of the system message |
1414
| `instructions` | `Optional[Union[str, List[str], Callable]]` | `None` | List of instructions for the team |
1515
| `expected_output` | `Optional[str]` | `None` | Provide the expected output from the team |
16+
| `additional_context` | `Optional[str]` | `None` | Additional context added to the end of the system message |
1617
| `success_criteria` | `Optional[str]` | `None` | Define the success criteria for the team |
1718
| `markdown` | `bool` | `False` | If markdown=true, add instructions to format the output using markdown |
1819
| `add_datetime_to_instructions` | `bool` | `False` | If True, add the current datetime to the instructions to give the agent a sense of time |
20+
| `knowledge` | `Optional[AgentKnowledge]` | `None` | Add a knowledge base to the team |
21+
| `retriever` | `Optional[Callable[..., Optional[List[Dict]]]]` | `None` | Function to get references to add to the user_message |
22+
| `references_format` | `Literal["json", "yaml"]` | `"json"` | Format of the references |
1923
| `context` | `Optional[Dict[str, Any]]` | `None` | User provided context |
2024
| `add_context` | `bool` | `False` | If True, add the context to the user prompt |
2125
| `enable_agentic_context` | `bool` | `False` | If True, enable the team agent to update the team context and automatically send the team context to the members |
2226
| `share_member_interactions` | `bool` | `False` | If True, send all previous member interactions to members |
2327
| `read_team_history` | `bool` | `False` | If True, read the team history |
28+
| `search_knowledge` | `bool` | `True` | Add a tool that allows the Model to search the knowledge base |
29+
| `get_member_information_tool` | `bool` | `True` | Add a tool that allows the Model to get information about the members of the team |
2430
| `show_tool_calls` | `bool` | `False` | Show tool calls in team response |
2531
| `response_model` | `Optional[Type[BaseModel]]` | `None` | Response model for the team response |
2632
| `use_json_mode` | `bool` | `False` | If `response_model` is set, sets the response "mode" of the model, i.e. if the model should explicitly respond with a JSON object instead of a Pydantic model |

teams/introduction.mdx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,64 @@ team_with_memory.print_response("What are the key challenges in quantum computin
128128
team_with_memory.print_response("Elaborate on the second challenge you mentioned")
129129
```
130130

131+
## Team Knowledge
132+
133+
Teams can use a knowledge base to store and retrieve information:
134+
135+
```python
136+
from pathlib import Path
137+
138+
from agno.agent import Agent
139+
from agno.embedder.openai import OpenAIEmbedder
140+
from agno.knowledge.url import UrlKnowledge
141+
from agno.models.openai import OpenAIChat
142+
from agno.team import Team
143+
from agno.tools.duckduckgo import DuckDuckGoTools
144+
from agno.vectordb.lancedb import LanceDb, SearchType
145+
146+
# Setup paths
147+
cwd = Path(__file__).parent
148+
tmp_dir = cwd.joinpath("tmp")
149+
tmp_dir.mkdir(parents=True, exist_ok=True)
150+
151+
# Initialize knowledge base
152+
agno_docs_knowledge = UrlKnowledge(
153+
urls=["https://docs.agno.com/llms-full.txt"],
154+
vector_db=LanceDb(
155+
uri=str(tmp_dir.joinpath("lancedb")),
156+
table_name="agno_docs",
157+
search_type=SearchType.hybrid,
158+
embedder=OpenAIEmbedder(id="text-embedding-3-small"),
159+
),
160+
)
161+
162+
web_agent = Agent(
163+
name="Web Search Agent",
164+
role="Handle web search requests",
165+
model=OpenAIChat(id="gpt-4o"),
166+
tools=[DuckDuckGoTools()],
167+
instructions=["Always include sources"],
168+
)
169+
170+
team_with_knowledge = Team(
171+
name="Team with Knowledge",
172+
members=[web_agent],
173+
model=OpenAIChat(id="gpt-4o"),
174+
knowledge=agno_docs_knowledge,
175+
show_members_responses=True,
176+
markdown=True,
177+
)
178+
179+
if __name__ == "__main__":
180+
# Set to False after the knowledge base is loaded
181+
load_knowledge = True
182+
if load_knowledge:
183+
agno_docs_knowledge.load()
184+
185+
team_with_knowledge.print_response("Tell me about the Agno framework", stream=True)
186+
```
187+
188+
131189
## Running Teams
132190

133191
Teams support both synchronous and asynchronous execution, with optional streaming:

0 commit comments

Comments
 (0)