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
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ jobs:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
version: "0.13.7"

- name: Set up Python
uses: actions/setup-python@v5
Expand Down
6 changes: 5 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
| Document | Purpose |
|----------|---------|
| [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | System shape, layer rules, golden principles |
| [docs/CODEBASE_DIAGRAM.md](docs/CODEBASE_DIAGRAM.md) | Mermaid codebase diagrams and code anchors |
| [docs/DESIGN.md](docs/DESIGN.md) | Python conventions, API patterns, logging conventions |
| [docs/PLANS.md](docs/PLANS.md) | Active exec-plans index |
| [docs/PLANS.md](docs/PLANS.md) | Canonical active and completed exec-plans index |
| [docs/QUALITY_SCORE.md](docs/QUALITY_SCORE.md) | Domain health grades and tech debt tracker |
| [docs/RELIABILITY.md](docs/RELIABILITY.md) | Critical paths, SLO placeholders, rollback policy |
| [docs/SECURITY.md](docs/SECURITY.md) | Security invariants, auth/secrets guidance, data classes |
Expand All @@ -22,8 +23,11 @@
```text
AGENTS.md <- you are here
├── agentic_internet/ <- package source
├── examples/ <- usage examples
├── tests/ <- pytest suite
├── docs/ARCHITECTURE.md <- layer model and dependency rules
├── docs/CODEBASE_DIAGRAM.md <- Mermaid codebase diagrams
├── docs/PLANS.md <- canonical exec-plan index
├── docs/design-docs/index.md <- architectural decisions
├── docs/exec-plans/active/ <- in-flight plans
├── docs/product-specs/index.md <- product specs
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
prune tests
prune examples
72 changes: 45 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Core project docs:
| Doc | Purpose |
|-----|---------|
| [Architecture](docs/ARCHITECTURE.md) | System layers, dependency direction, golden principles |
| [Codebase diagrams](docs/CODEBASE_DIAGRAM.md) | Mermaid system diagrams and code anchors |
| [Design](docs/DESIGN.md) | Python conventions, API patterns, logging |
| [Security](docs/SECURITY.md) | Secret handling, input validation, data classes |
| [Plans](docs/PLANS.md) | Active and completed exec-plans |
Expand All @@ -22,7 +23,7 @@ Core project docs:
- **🔍 Web Search & Scraping**: Search the web, scrape content, and gather information
- **🌍 Browser Use**: Interact with websites, fill forms, click buttons, and extract structured data in the cloud using the Browser Use Cloud SDK
- **📰 News Analysis**: Find and analyze recent news on any topic
- **💻 Code Execution**: Execute Python code safely in a sandboxed environment
- **💻 Code Execution**: Execute Python with restricted builtins and an import allowlist; use a remote or container sandbox for untrusted code
- **📊 Data Analysis**: Analyze datasets and generate insights
- **🔬 Research Agent**: Conduct multi-depth research on any topic
- **🛠️ Extensible Tools**: Easy to add custom tools and capabilities
Expand Down Expand Up @@ -135,7 +136,7 @@ uv run python -m agentic_internet.cli --help
uv run python -m agentic_internet.cli chat --verbose

# Use a specific model
uv run python -m agentic_internet.cli run "Write a short story on GPT-5 models" --model gpt-5.2 --verbose
uv run python -m agentic_internet.cli run "Compare recent agent frameworks" --model gpt-6.1-terra --verbose

# Quiet mode (less verbose)
uv run python -m agentic_internet.cli run "Describe the latest AI breakthroughs" --model gemini-3-flash --verbose --quiet
Expand All @@ -151,7 +152,7 @@ uv run python -m agentic_internet.cli run "Search for Python tutorials" --verbos
uv run python -m agentic_internet.cli run "Analyze crypto market trends" --output results.txt --verbose

# Specify model and iterations
uv run python -m agentic_internet.cli run "Complex research task" --model claude-opus-4.5 --max-iterations 15 --verbose
uv run python -m agentic_internet.cli run "Complex research task" --model claude-sonnet-5.5 --max-iterations 15 --verbose
```

### Research Mode
Expand All @@ -170,7 +171,7 @@ uv run python -m agentic_internet.cli research "climate change" --format json --

```bash
# Multi-model task
uv run python -m agentic_internet.cli multi "Analyze the impact of AI on healthcare" --models gpt-5.2 --models claude-opus-4.5 --workers 3 --output results.json
uv run python -m agentic_internet.cli multi "Analyze the impact of AI on healthcare" --models gpt-6.1-terra --models claude-sonnet-5.5 --workers 3 --output results.json

# News analysis
uv run python -m agentic_internet.cli news "artificial intelligence breakthroughs" --time 7d --sources "TechCrunch" --sources "Wired" --limit 20 --format markdown --output news_report.md
Expand All @@ -180,7 +181,7 @@ uv run python -m agentic_internet.cli news "artificial intelligence breakthrough

```bash
# Orchestrated task
uv run python -m agentic_internet.cli orchestrate "Develop a business plan for an AI startup" --coordinator gpt-5.2 --workers claude-opus-4.5 --output business_plan.json
uv run python -m agentic_internet.cli orchestrate "Develop a business plan for an AI startup" --coordinator gpt-6.1-terra --workers claude-sonnet-5.5 --output business_plan.json
```


Expand Down Expand Up @@ -309,6 +310,13 @@ MultiEngineSearchTool

## 💡 Examples

Standalone scripts live in [`examples/`](examples/). Run them from the repository root, for example:

```bash
python examples/basic_usage.py
python examples/advanced_usage.py
```

### Web Research
```python
from agentic_internet import ResearchAgent
Expand Down Expand Up @@ -421,7 +429,13 @@ agentic-internet/
│ ├── agents/ # Agent implementations
│ │ ├── internet_agent.py
│ │ ├── basic_agent.py
│ │ ├── multi_model_serpapi.py
│ │ ├── multi_model/ # Focused multi-model implementations
│ │ │ ├── model_manager.py
│ │ │ ├── schemas.py
│ │ │ ├── context.py
│ │ │ ├── tools.py
│ │ │ └── system.py
│ │ ├── multi_model_serpapi.py # Compatibility re-exports
│ │ ├── search_orchestrator.py
│ │ └── specialized_agents.py
│ ├── tools/ # Custom tools
Expand All @@ -431,10 +445,10 @@ agentic-internet/
│ │ └── mcp_integration.py
│ ├── config/ # Configuration
│ │ └── settings.py
│ ├── utils/ # Utilities
│ │ └── model_utils.py
│ └── examples/ # Usage examples
├── tests/ # Test suite (102 tests)
│ └── utils/ # Utilities
│ └── model_utils.py
├── examples/ # Usage examples
├── tests/ # Pytest suite
├── pyproject.toml # Project configuration
├── README.md
└── .env # Environment variables
Expand Down Expand Up @@ -486,31 +500,35 @@ agent = InternetAgent(tools=[MyCustomTool()])
All models are accessed via [OpenRouter](https://openrouter.ai/) for unified API access, with optional direct provider APIs.

### Flagship Models
| Provider | Model | Best For |
|----------|-------|----------|
| Anthropic | Claude Opus 4.5, Sonnet 4.5, Haiku 4.5 | Reasoning, planning, orchestration |
| OpenAI | GPT-5.2, GPT-5.1, O4-Mini, O3 | General tasks, coding, reasoning |
| Google | Gemini 3 Pro, Gemini 3 Flash | Multimodal, fast responses |
| DeepSeek | V3.2, V3.2 Speciale, R1 | Open-weight reasoning, specialized |
| xAI | Grok 4.1 Fast, Grok 4, Grok Code Fast | Creative tasks, fast coding |
| Mistral | Large 2512, Devstral 2, Magistral Medium | Business analysis, agentic coding |
| Qwen | Qwen3 Coder, Qwen3 Max, Qwen3 235B | Coding, multilingual, synthesis |
| Meta | Llama 4 Maverick, Llama 4 Scout | Open source general tasks |
| MoonshotAI | Kimi K2.5 | Long context specialist |
| Perplexity | Sonar Pro, Sonar Reasoning Pro | Search-optimized research |
| MiniMax | M2.1 | Balanced reasoning |
| Xiaomi | MiMo V2 Flash | Cost-effective coding |

The static catalog is a curated offline fallback. Run `agentic-internet models --live` for the freshest OpenRouter inventory, capability flags, context lengths, and pricing metadata.

| Provider | Models | Best For |
|----------|--------|----------|
| Anthropic | Claude Opus 4.8, Sonnet 5.5, Haiku 5.5 | Reasoning, planning, orchestration |
| OpenAI | GPT-6.1 Terra, GPT-6.1 Sol, GPT-6 Luna, GPT-5.2 | General tasks, coding, reasoning |
| Google | Gemini 4 Argon, Gemini 3.5 Flash, Gemini 2.5 Pro | Multimodal analysis, fast responses |
| DeepSeek | V4.1 Flash, V3.2, R1 | Efficient and open-weight reasoning |
| Qwen | Qwen3.8 Max Prime, Qwen3.7 Max, Qwen3 Coder | Coding, multilingual synthesis |
| MoonshotAI | Kimi K3.1 Pro, Kimi K2.5 | Long-context and agentic tasks |
| Mistral | Large 4, Large 2512, Devstral 2 | Business analysis, agentic coding |
| MiniMax | M3.1 Flash | Fast, balanced agent workflows |
| xAI | Grok 4.3, Grok Build 0.1 | Reasoning and coding |
| Perplexity | Sonar Pro, Sonar Reasoning Pro, Sonar Deep Research | Search-optimized research |
| Other | Liquid LFM 3, Tencent HY4, Cohere Command A Plus, Step 5 Preview | Efficient and specialized agent workflows |

Free variants `lfm-3-1.7b-free` and `nemotron-3.5-super-vl-free` are available for bounded provider smoke tests. Free availability and final response quality remain provider-dependent; no paid fallback is implicit.

### Direct Provider APIs
- **OpenAI**: GPT-5.2, GPT-5.1, GPT-5, GPT-4.1, O4-Mini, O3 (via OpenAI API)
- **Anthropic**: Claude Opus 4.5, Sonnet 4.5, Opus 4.1, Haiku 4.5 (via Anthropic API)
- **OpenAI**: GPT-5.2, GPT-5.1, GPT-5, GPT-4.1, O3 (via OpenAI API)
- **Anthropic**: Claude Opus 4.8, Opus 4.5, Sonnet 4.5, Opus 4.1, Haiku 4.5 (via Anthropic API)
- **HuggingFace**: Llama 4 Scout/Maverick, Qwen3 235B (via HuggingFace API)

## 🧪 Development

### Running Tests
```bash
# Run all tests (102 tests)
# Run all tests
uv run pytest

# Run with verbose output
Expand Down
11 changes: 9 additions & 2 deletions agentic_internet/agents/internet_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(
self.model = self._initialize_model(model_id)

# Initialize tools
self.tools = tools or self._get_default_tools()
self.tools = self._get_default_tools() if tools is None else tools

# Create the appropriate agent type
self.agent = self._create_agent()
Expand Down Expand Up @@ -92,6 +92,7 @@ def _initialize_model(self, model_id: str | None = None) -> Any:

def _create_agent(self):
"""Create the appropriate agent based on agent_type."""
planning_interval = 1 if self.planning_enabled else None
if self.agent_type == "code":
# CodeAgent can execute Python code and use tools
default_imports = [
Expand All @@ -112,11 +113,17 @@ def _create_agent(self):
tools=self.tools,
model=self.model,
max_steps=self.max_iterations,
planning_interval=planning_interval,
additional_authorized_imports=default_imports + self.additional_authorized_imports,
)
else:
# Default to ToolCallingAgent
return ToolCallingAgent(tools=self.tools, model=self.model)
return ToolCallingAgent(
tools=self.tools,
model=self.model,
max_steps=self.max_iterations,
planning_interval=planning_interval,
)

def _get_default_tools(self) -> list[Tool]:
"""Get the default set of tools for the agent."""
Expand Down
56 changes: 56 additions & 0 deletions agentic_internet/agents/multi_model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"""Focused modules for multi-model SerpAPI orchestration."""

from .context import (
NON_REUSABLE_SEARCH_PARAMS,
AgentMemory,
ContextEngineeringMixin,
ContextWindow,
TaskContext,
)
from .model_manager import LiteLLMModel, ModelManager
from .schemas import ImageResult, LocalResult, NewsResult, ScholarResult, SearchResult, ShoppingResult
from .system import CodeAgent, MultiModelSerpAPISystem, Tool, ToolCallingAgent
from .tools import (
AgentTool,
BaiduSearch,
BingSearch,
GoogleMapsLocalTool,
GoogleScholarSearch,
GoogleScholarTool,
GoogleSearch,
GoogleSearchTool,
GoogleShoppingTool,
MultiEngineSearchTool,
YahooSearch,
)

__all__ = [
"NON_REUSABLE_SEARCH_PARAMS",
"AgentMemory",
"AgentTool",
"BaiduSearch",
"BingSearch",
"CodeAgent",
"ContextEngineeringMixin",
"ContextWindow",
"GoogleMapsLocalTool",
"GoogleScholarSearch",
"GoogleScholarTool",
"GoogleSearch",
"GoogleSearchTool",
"GoogleShoppingTool",
"ImageResult",
"LiteLLMModel",
"LocalResult",
"ModelManager",
"MultiEngineSearchTool",
"MultiModelSerpAPISystem",
"NewsResult",
"ScholarResult",
"SearchResult",
"ShoppingResult",
"TaskContext",
"Tool",
"ToolCallingAgent",
"YahooSearch",
]
Loading
Loading