Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /agno-agi_agno /cookbook /91_tools /duckduckgo_tools.py
| """ | |
| Duckduckgo Tools | |
| ============================= | |
| Demonstrates duckduckgo tools. | |
| """ | |
| from agno.agent import Agent | |
| from agno.models.openai import OpenAIChat | |
| from agno.tools.duckduckgo import DuckDuckGoTools | |
| from agno.tools.websearch import WebSearchTools | |
| # --------------------------------------------------------------------------- | |
| # Create Agent | |
| # --------------------------------------------------------------------------- | |
| # Example 1: Enable specific DuckDuckGo functions | |
| agent = Agent( | |
| model=OpenAIChat(id="gpt-5.6-luna"), | |
| tools=[DuckDuckGoTools(enable_search=True, enable_news=False)], | |
| ) | |
| # Example 2: Enable all DuckDuckGo functions (both search and news) | |
| agent_all = Agent( | |
| model=OpenAIChat(id="gpt-5.6-luna"), | |
| tools=[DuckDuckGoTools(enable_search=True, enable_news=True)], | |
| ) | |
| # Example 3: Enable only news search | |
| news_agent = Agent( | |
| model=OpenAIChat(id="gpt-5.6-luna"), | |
| tools=[DuckDuckGoTools(enable_search=False, enable_news=True)], | |
| ) | |
| # Example 4: Use WebSearchTools for other search backends (e.g., yandex) | |
| # Note: DuckDuckGoTools always uses duckduckgo backend. | |
| # For other backends, use WebSearchTools directly. | |
| yandex_agent = Agent( | |
| model=OpenAIChat(id="gpt-5.6-luna"), | |
| tools=[WebSearchTools(enable_search=True, enable_news=False, backend="yandex")], | |
| add_datetime_to_context=True, | |
| ) | |
| # Test the agents | |
| # --------------------------------------------------------------------------- | |
| # Run Agent | |
| # --------------------------------------------------------------------------- | |
| if __name__ == "__main__": | |
| agent.print_response("What's the latest about GPT-5?", markdown=True) | |
| # news_agent.print_response( | |
| # "Find recent news about artificial intelligence", markdown=True | |
| # ) | |
| # yandex_agent.print_response("What's happening in AI?", markdown=True) | |
Xet Storage Details
- Size:
- 1.82 kB
- Xet hash:
- cd2c98bd52ef11837992fc2e54d305b233744ef9024e911c27db914e591931ac
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.