Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
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
15 changes: 13 additions & 2 deletions config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,28 @@ tools:
base_class: path.to.my.tools.CustomTool
my_other_tool:
base_class: "name_of_tool_class_in_registry"
# Search tools: configure Tavily API key and search limits per tool
# Search tools: configure search provider and API keys per tool
# (can be overridden per-agent in tools list)
web_search_tool:
engine: "tavily" # Search engine: "tavily" (default), "brave", or "perplexity"
tavily_api_key: "your-tavily-api-key-here" # Tavily API key (get at tavily.com)
tavily_api_base_url: "https://api.tavily.com" # Tavily API URL
max_results: 12
max_searches: 6
extract_page_content_tool:
tavily_api_key: "your-tavily-api-key-here" # Same Tavily API key
tavily_api_key: "your-tavily-api-key-here" # Same Tavily API key (Tavily-only feature)
tavily_api_base_url: "https://api.tavily.com"
content_limit: 2000
# Standalone search tools (for multi-engine setups where LLM picks the engine)
brave_search_tool:
brave_api_key: "your-brave-api-key-here" # Brave Search API key
brave_api_base_url: "https://api.search.brave.com/res/v1/web/search"
perplexity_search_tool:
perplexity_api_key: "your-perplexity-api-key-here" # Perplexity API key
perplexity_api_base_url: "https://api.perplexity.ai/search"
tavily_search_tool:
tavily_api_key: "your-tavily-api-key-here"
tavily_api_base_url: "https://api.tavily.com"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Описать бы более детальное разделение тулов. Зачем столько много в примере.
Мы уверены, что прям так надо показывать пользователю?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут паттерн проекта такой что целые опциональные секции (prompts, proxy, доп mcp серверы) комментируются, а тулы с конфигами всегда раскомментированы. пользователь просто не добавляет ненужный тул в agent tools список. standalone тулы следуют этому же паттерну, плюс комментарий-разделитель уже есть на строке 72

но я согласен что пояснение можно сделать лучше, сейчас одна строчка и всё. можно расписать два сценария подробнее

как по твоему лучше оформить - закоментировать блоки или оставить с более подробным описанием?


agents:
custom_research_agent:
Expand Down
1 change: 1 addition & 0 deletions examples/sgr_deep_research/config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ tools:
# Core tools (base_class defaults to sgr_agent_core.tools.*)
# Search tools: configure Tavily API key and search limits per tool
web_search_tool:
engine: "tavily" # Search engine: "tavily" (default), "brave", or "perplexity"
tavily_api_key: "your-tavily-api-key-here" # Tavily API key (get at tavily.com)
tavily_api_base_url: "https://api.tavily.com" # Tavily API URL
max_searches: 4 # Max search operations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ tools:
# Core tools (base_class defaults to sgr_agent_core.tools.*)
# Search tools: configure Tavily API key and search limits per tool
web_search_tool:
engine: "tavily" # Search engine: "tavily" (default), "brave", or "perplexity"
tavily_api_key: "your-tavily-api-key-here" # Tavily API key (get at tavily.com)
tavily_api_base_url: "https://api.tavily.com" # Tavily API URL
max_searches: 4 # Max search operations
Expand Down
16 changes: 8 additions & 8 deletions sgr_agent_core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
SourceData,
)
from sgr_agent_core.next_step_tool import NextStepToolsBuilder, NextStepToolStub
from sgr_agent_core.services import AgentRegistry, MCP2ToolConverter, PromptLoader, ToolRegistry
from sgr_agent_core.services import (
AgentRegistry,
MCP2ToolConverter,
PromptLoader,
ToolRegistry,
)
from sgr_agent_core.tools import * # noqa: F403

__all__ = [
Expand All @@ -50,9 +55,9 @@
"SourceData",
# Services
"AgentRegistry",
"ToolRegistry",
"PromptLoader",
"MCP2ToolConverter",
"PromptLoader",
"ToolRegistry",
# Configuration
"AgentConfig",
"AgentDefinition",
Expand All @@ -64,11 +69,6 @@
# Next step tools
"NextStepToolStub",
"NextStepToolsBuilder",
# Models
"AgentStatesEnum",
"AgentContext",
"SearchResult",
"SourceData",
# Factory
"AgentFactory",
]
15 changes: 15 additions & 0 deletions sgr_agent_core/agent_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ class SearchConfig(BaseModel, extra="allow"):
max_results: int = Field(default=10, ge=1, description="Maximum number of search results")
content_limit: int = Field(default=3500, gt=0, description="Content character limit per source")

engine: Literal["tavily", "brave", "perplexity"] = Field(
default="tavily",
description="Search engine provider to use",
)
brave_api_key: str | None = Field(default=None, description="Brave Search API key")
brave_api_base_url: str = Field(
default="https://api.search.brave.com/res/v1/web/search",
description="Brave Search API base URL",
)
perplexity_api_key: str | None = Field(default=None, description="Perplexity API key")
perplexity_api_base_url: str = Field(
default="https://api.perplexity.ai/search",
description="Perplexity Search API base URL",
)


class PromptsConfig(BaseModel, extra="allow"):
system_prompt_file: FilePath | None = Field(
Expand Down
2 changes: 1 addition & 1 deletion sgr_agent_core/base_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class ToolRegistryMixin:
def __init_subclass__(cls, **kwargs) -> None:
super().__init_subclass__(**kwargs)
if cls.__name__ not in ("BaseTool", "MCPBaseTool", "SystemBaseTool"):
if cls.__name__ not in ("BaseTool", "MCPBaseTool", "_BaseSearchTool", "SystemBaseTool"):
ToolRegistry.register(cls, name=cls.tool_name)


Expand Down
2 changes: 0 additions & 2 deletions sgr_agent_core/services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
from sgr_agent_core.services.mcp_service import MCP2ToolConverter
from sgr_agent_core.services.prompt_loader import PromptLoader
from sgr_agent_core.services.registry import AgentRegistry, StreamingGeneratorRegistry, ToolRegistry
from sgr_agent_core.services.tavily_search import TavilySearchService
from sgr_agent_core.services.tool_instantiator import ToolInstantiator

__all__ = [
"TavilySearchService",
"MCP2ToolConverter",
"ToolRegistry",
"StreamingGeneratorRegistry",
Expand Down
107 changes: 0 additions & 107 deletions sgr_agent_core/services/tavily_search.py

This file was deleted.

19 changes: 11 additions & 8 deletions sgr_agent_core/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
)
from sgr_agent_core.tools.adapt_plan_tool import AdaptPlanTool
from sgr_agent_core.tools.answer_tool import AnswerTool
from sgr_agent_core.tools.brave_search_tool import BraveSearchTool
from sgr_agent_core.tools.clarification_tool import ClarificationTool
from sgr_agent_core.tools.create_report_tool import CreateReportTool
from sgr_agent_core.tools.extract_page_content_tool import ExtractPageContentTool
from sgr_agent_core.tools.final_answer_tool import FinalAnswerTool
from sgr_agent_core.tools.generate_plan_tool import GeneratePlanTool
from sgr_agent_core.tools.perplexity_search_tool import PerplexitySearchTool
from sgr_agent_core.tools.reasoning_tool import ReasoningTool
from sgr_agent_core.tools.tavily_search_tool import TavilySearchTool
from sgr_agent_core.tools.web_search_tool import WebSearchTool

__all__ = [
Expand All @@ -23,16 +26,16 @@
"ToolNameSelectorStub",
"NextStepToolsBuilder",
# Individual tools
"ClarificationTool",
"GeneratePlanTool",
"WebSearchTool",
"ExtractPageContentTool",
"AdaptPlanTool",
"CreateReportTool",
"AnswerTool",
"BraveSearchTool",
"ClarificationTool",
"CreateReportTool",
"ExtractPageContentTool",
"FinalAnswerTool",
"GeneratePlanTool",
"PerplexitySearchTool",
"ReasoningTool",
# Tool lists
"NextStepToolStub",
"NextStepToolsBuilder",
"TavilySearchTool",
"WebSearchTool",
]
Loading