Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 46 additions & 4 deletions .github/workflows/test_on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ jobs:
working-directory: .
run: |
source .venv/bin/activate
python -m pytest ./libs/agno/tests/integration/workflow
python -m pytest ./libs/agno/tests/integration/workflows ./libs/agno/tests/integration/workflows_2

test-embedder:
runs-on: ubuntu-latest
Expand All @@ -687,6 +687,7 @@ jobs:
fail-fast: true # Stop all matrix jobs if one fails
env:
HUGGINGFACE_API_KEY: ${{ secrets.HUGGINGFACE_API_KEY }}
JINA_API_KEY: ${{ secrets.JINA_API_KEY }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -707,7 +708,7 @@ jobs:
source .venv/bin/activate
python -m pytest ./libs/agno/tests/integration/embedder

test-knowledge:
test-knowledge-1:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -734,7 +735,48 @@ jobs:
working-directory: .
run: |
source .venv/bin/activate
python -m pytest ./libs/agno/tests/integration/knowledge
python -m pytest ./libs/agno/tests/integration/knowledge/test_csv_knowledge_base.py \
./libs/agno/tests/integration/knowledge/test_csv_url_knowledge_base.py \
./libs/agno/tests/integration/knowledge/test_docx_knowledge_base.py \
./libs/agno/tests/integration/knowledge/test_json_knowledge_base.py \
./libs/agno/tests/integration/knowledge/test_md_knowledge_base.py \
./libs/agno/tests/integration/knowledge/test_pdf_knowledge_base.py \
./libs/agno/tests/integration/knowledge/test_pdf_url_knowledge_base.py \
./libs/agno/tests/integration/knowledge/test_pdf_bytes_knowledge_base.py \
./libs/agno/tests/integration/knowledge/test_text_knowledge_base.py

test-knowledge-2:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
fail-fast: true # Stop all matrix jobs if one fails
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Run dev setup
working-directory: .
run: |
./scripts/dev_setup.sh
- name: Run knowledge integration tests
working-directory: .
run: |
source .venv/bin/activate
python -m pytest ./libs/agno/tests/integration/knowledge/test_arxiv_knowledge_base.py \
./libs/agno/tests/integration/knowledge/test_firecrawl_knowledge_base.py \
./libs/agno/tests/integration/knowledge/test_url_knowledge_base.py \
./libs/agno/tests/integration/knowledge/test_website_knowledge_base.py \
./libs/agno/tests/integration/knowledge/test_youtube_knowledge_base.py

# Run remaining integration tests
test-remaining:
Expand Down Expand Up @@ -764,4 +806,4 @@ jobs:
working-directory: .
run: |
source .venv/bin/activate
python -m pytest --ignore=./libs/agno/tests/integration/models --ignore=./libs/agno/tests/integration/agent --ignore=./libs/agno/tests/integration/knowledge --ignore=./libs/agno/tests/integration/teams --ignore=./libs/agno/tests/integration/embedder ./libs/agno/tests/integration
python -m pytest --ignore=./libs/agno/tests/integration/models --ignore=./libs/agno/tests/integration/agent --ignore=./libs/agno/tests/integration/knowledge --ignore=./libs/agno/tests/integration/teams --ignore=./libs/agno/tests/integration/embedder --ignore=./libs/agno/tests/integration/workflows --ignore=./libs/agno/tests/integration/workflows_2 ./libs/agno/tests/integration
10 changes: 5 additions & 5 deletions libs/agno/agno/models/openai/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def get_async_client(self) -> AsyncOpenAI:

def get_request_params(
self,
messages: List[Message],
messages: Optional[List[Message]] = None,
response_format: Optional[Union[Dict, Type[BaseModel]]] = None,
tools: Optional[List[Dict[str, Any]]] = None,
tool_choice: Optional[Union[str, Dict[str, Any]]] = None,
Expand Down Expand Up @@ -214,13 +214,13 @@ def get_request_params(
log_debug(f"Added web_search_preview tool for deep research model: {self.id}")

if tools:
request_params["tools"] = self._format_tool_params(messages=messages, tools=tools)
request_params["tools"] = self._format_tool_params(messages=messages, tools=tools) # type: ignore

if tool_choice is not None:
request_params["tool_choice"] = tool_choice

# Handle reasoning tools for o3 and o4-mini models
if self.id.startswith("o3") or self.id.startswith("o4-mini"):
if (self.id.startswith("o3") or self.id.startswith("o4-mini")) and messages is not None:
request_params["store"] = True

# Check if the last assistant message has a previous_response_id to continue from
Expand Down Expand Up @@ -756,11 +756,11 @@ def _process_stream_response(
UrlCitation(url=stream_event.annotation.get("url"), title=stream_event.annotation.get("title"))
)
else:
if stream_event.annotation.type == "url_citation":
if stream_event.annotation.type == "url_citation": # type: ignore
if stream_data.response_citations.urls is None:
stream_data.response_citations.urls = []
stream_data.response_citations.urls.append(
UrlCitation(url=stream_event.annotation.url, title=stream_event.annotation.title)
UrlCitation(url=stream_event.annotation.url, title=stream_event.annotation.title) # type: ignore
)

model_response.citations = stream_data.response_citations
Expand Down
2 changes: 1 addition & 1 deletion libs/agno/agno/tools/linkup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def web_search_with_linkup(self, query: str, depth: Optional[str] = None, output
try:
response = self.linkup.search(
query=query,
depth=depth or self.depth,
depth=depth or self.depth, # type: ignore
output_type=output_type or self.output_type, # type: ignore
)
return response
Expand Down
4 changes: 3 additions & 1 deletion libs/agno/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "agno"
version = "1.7.5"
version = "1.7.6"
description = "Agno: a lightweight library for building Multi-Agent Systems"
requires-python = ">=3.7,<4"
readme = "README.md"
Expand Down Expand Up @@ -65,6 +65,7 @@ arize = ["arize-phoenix", "agno[opentelemetry]", "opentelemetry-exporter-otlp-pr
langfuse = ["langfuse"]

# Dependencies for Models
aws-bedrock = ["boto3", "aioboto3"]
anthropic = ["anthropic"]
azure = ["azure-ai-inference", "aiohttp"]
cerebras = ["cerebras-cloud-sdk"]
Expand Down Expand Up @@ -167,6 +168,7 @@ aws = ["agno-aws", "agno-docker"]

# All models
models = [
"agno[aws-bedrock]",
"agno[anthropic]",
"agno[azure]",
"agno[cerebras]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ def setup_vector_db():
vector_db.drop()


@pytest.mark.skip(reason="Skipping test")
def test_website_knowledge_base_directory(setup_vector_db):
"""Test loading multiple websites into the knowledge base."""
urls = ["https://docs.agno.com/introduction/agents", "https://docs.agno.com/introduction/playground"]
urls = ["https://docs.agno.com/introduction/agents", "https://fastapi.tiangolo.com/"]

kb = WebsiteKnowledgeBase(urls=urls, max_links=1, vector_db=setup_vector_db)
kb.load(recreate=True)
Expand Down Expand Up @@ -59,10 +60,11 @@ def test_website_knowledge_base_single_url(setup_vector_db):
assert any(call["function"]["name"] == "search_knowledge_base" for call in function_calls)


@pytest.mark.skip(reason="Skipping test")
@pytest.mark.asyncio
async def test_website_knowledge_base_async_directory(setup_vector_db):
"""Test asynchronously loading multiple websites into the knowledge base."""
urls = ["https://docs.agno.com/introduction/agents", "https://docs.agno.com/introduction/playground"]
urls = ["https://docs.agno.com/introduction/agents", "https://fastapi.tiangolo.com/"]

kb = WebsiteKnowledgeBase(urls=urls, max_links=1, vector_db=setup_vector_db)
await kb.aload(recreate=True)
Expand Down
22 changes: 0 additions & 22 deletions libs/agno/tests/integration/models/groq/test_tool_use.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from agno.agent import Agent, RunResponse # noqa
from agno.models.groq import Groq
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.exa import ExaTools
from agno.tools.yfinance import YFinanceTools

Expand Down Expand Up @@ -139,27 +138,6 @@ class StockPrice(BaseModel):
assert response.content.currency is not None


def test_multiple_tool_calls():
agent = Agent(
model=Groq(id="llama-3.3-70b-versatile"),
tools=[YFinanceTools(cache_results=True), DuckDuckGoTools(cache_results=True)],
markdown=True,
telemetry=False,
monitoring=False,
)

response = agent.run("What is the current price of TSLA and what is the latest news about it?")

# Verify tool usage
tool_calls = []
for msg in response.messages:
if msg.tool_calls:
tool_calls.extend(msg.tool_calls)
assert len([call for call in tool_calls if call.get("type", "") == "function"]) >= 2 # Total of 2 tool calls made
assert response.content is not None
assert "TSLA" in response.content and "latest news" in response.content.lower()


def test_tool_call_custom_tool_no_parameters():
def get_the_weather_in_tokyo():
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ async def arun(self, message: str) -> AsyncIterator[RunResponse]:
yield RunResponse(run_id=self.run_id, content="Received message: " + message)

workflow = ExampleWorkflow(storage=workflow_storage)
response = await workflow.arun(message="Tell me a joke.")
async for item in response:
async for item in workflow.arun(message="Tell me a joke."):
assert item.content == "Received message: Tell me a joke."

stored_workflow_session = workflow_storage.read(session_id=workflow.session_id)
Expand Down
2 changes: 2 additions & 0 deletions scripts/run_model_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ pip install --upgrade pip

print_info "Installing base packages..."
pip install \
aioboto3 \
boto3 \
docstring-parser \
gitpython \
httpx \
Expand Down
Loading