autogen-scavio 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,26 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ id-token: write
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.12"
18
+
19
+ - name: Install build tools
20
+ run: pip install build
21
+
22
+ - name: Build package
23
+ run: python -m build
24
+
25
+ - name: Publish to PyPI
26
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .venv/
10
+ .env
11
+ .pytest_cache/
12
+ .ruff_cache/
13
+ .mypy_cache/
14
+ .claude/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Scavio
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,121 @@
1
+ Metadata-Version: 2.4
2
+ Name: autogen-scavio
3
+ Version: 0.1.0
4
+ Summary: AutoGen integration for Scavio Search API -- real-time Google, Amazon, Walmart, YouTube, Reddit, and TikTok search tools for AI agents
5
+ Project-URL: Homepage, https://scavio.dev
6
+ Project-URL: Repository, https://github.com/scavio-ai/autogen-scavio
7
+ Project-URL: Documentation, https://scavio.dev/docs/autogen
8
+ Author: Scavio
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: ag2,agents,ai,amazon-search,autogen,reddit-search,scavio,search,tiktok-search,walmart-search,web-search,youtube-search
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.10
18
+ Requires-Dist: autogen-core>=0.4.0
19
+ Requires-Dist: scavio>=0.1.1
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
22
+ Requires-Dist: pytest>=7.4; extra == 'dev'
23
+ Requires-Dist: ruff>=0.5; extra == 'dev'
24
+ Description-Content-Type: text/markdown
25
+
26
+ # autogen-scavio
27
+
28
+ AutoGen integration for the [Scavio Search API](https://scavio.dev). Provides 20 search tools across Google, Amazon, Walmart, YouTube, Reddit, and TikTok for use with AutoGen AI agents.
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install autogen-scavio
34
+ ```
35
+
36
+ ## Setup
37
+
38
+ Get a free API key at [dashboard.scavio.dev](https://dashboard.scavio.dev) and set it as an environment variable:
39
+
40
+ ```bash
41
+ export SCAVIO_API_KEY="sk_live_..."
42
+ ```
43
+
44
+ ## Quick Start
45
+
46
+ ```python
47
+ import asyncio
48
+ from autogen_agentchat.agents import AssistantAgent
49
+ from autogen_ext.models.openai import OpenAIChatCompletionClient
50
+ from autogen_scavio import create_scavio_tools
51
+
52
+ tools = create_scavio_tools()
53
+
54
+ agent = AssistantAgent(
55
+ name="researcher",
56
+ model_client=OpenAIChatCompletionClient(model="gpt-5.5"),
57
+ tools=tools,
58
+ system_message="You are a research assistant with access to search tools.",
59
+ )
60
+
61
+ async def main():
62
+ result = await agent.run(task="What are the top AI agent frameworks in 2026?")
63
+ print(result.messages[-1].content)
64
+
65
+ asyncio.run(main())
66
+ ```
67
+
68
+ ## Selective Tool Loading
69
+
70
+ Load only the providers you need:
71
+
72
+ ```python
73
+ # Only Google and Amazon tools
74
+ tools = create_scavio_tools(providers=["google", "amazon"])
75
+
76
+ # Only YouTube
77
+ tools = create_scavio_tools(providers=["youtube"])
78
+
79
+ # Individual tool factories
80
+ from autogen_scavio import create_web_search_tool, create_amazon_search_tool
81
+
82
+ web_tool = create_web_search_tool(max_results=10)
83
+ amazon_tool = create_amazon_search_tool(max_results=5)
84
+ ```
85
+
86
+ ## Available Tools
87
+
88
+ | Provider | Tool | Description |
89
+ |----------|------|-------------|
90
+ | Google | `scavio_web_search` | Web search with knowledge graphs and related questions |
91
+ | Amazon | `scavio_amazon_search` | Product search across 20+ marketplaces |
92
+ | Amazon | `scavio_amazon_product` | Product details by ASIN |
93
+ | YouTube | `scavio_youtube_search` | Video search with filters |
94
+ | YouTube | `scavio_youtube_metadata` | Video metadata by ID |
95
+ | Walmart | `scavio_walmart_search` | Product search with price/fulfillment filters |
96
+ | Walmart | `scavio_walmart_product` | Product details by ID |
97
+ | Reddit | `scavio_reddit_search` | Post and comment search |
98
+ | Reddit | `scavio_reddit_post` | Post metadata and comments by URL |
99
+ | TikTok | `scavio_tiktok_profile` | User profile lookup |
100
+ | TikTok | `scavio_tiktok_user_posts` | User's posted videos |
101
+ | TikTok | `scavio_tiktok_video` | Video details |
102
+ | TikTok | `scavio_tiktok_video_comments` | Video comments |
103
+ | TikTok | `scavio_tiktok_comment_replies` | Comment replies |
104
+ | TikTok | `scavio_tiktok_search_videos` | Video search by keyword |
105
+ | TikTok | `scavio_tiktok_search_users` | User search by keyword |
106
+ | TikTok | `scavio_tiktok_hashtag` | Hashtag info |
107
+ | TikTok | `scavio_tiktok_hashtag_videos` | Videos by hashtag |
108
+ | TikTok | `scavio_tiktok_user_followers` | User's followers |
109
+ | TikTok | `scavio_tiktok_user_followings` | User's followings |
110
+
111
+ ## Configuration
112
+
113
+ ```python
114
+ from autogen_scavio import configure
115
+
116
+ # Set API key programmatically
117
+ configure(api_key="sk_live_...")
118
+
119
+ # Or pass to factory
120
+ tools = create_scavio_tools(api_key="sk_live_...", max_results=10)
121
+ ```
@@ -0,0 +1,96 @@
1
+ # autogen-scavio
2
+
3
+ AutoGen integration for the [Scavio Search API](https://scavio.dev). Provides 20 search tools across Google, Amazon, Walmart, YouTube, Reddit, and TikTok for use with AutoGen AI agents.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install autogen-scavio
9
+ ```
10
+
11
+ ## Setup
12
+
13
+ Get a free API key at [dashboard.scavio.dev](https://dashboard.scavio.dev) and set it as an environment variable:
14
+
15
+ ```bash
16
+ export SCAVIO_API_KEY="sk_live_..."
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ```python
22
+ import asyncio
23
+ from autogen_agentchat.agents import AssistantAgent
24
+ from autogen_ext.models.openai import OpenAIChatCompletionClient
25
+ from autogen_scavio import create_scavio_tools
26
+
27
+ tools = create_scavio_tools()
28
+
29
+ agent = AssistantAgent(
30
+ name="researcher",
31
+ model_client=OpenAIChatCompletionClient(model="gpt-5.5"),
32
+ tools=tools,
33
+ system_message="You are a research assistant with access to search tools.",
34
+ )
35
+
36
+ async def main():
37
+ result = await agent.run(task="What are the top AI agent frameworks in 2026?")
38
+ print(result.messages[-1].content)
39
+
40
+ asyncio.run(main())
41
+ ```
42
+
43
+ ## Selective Tool Loading
44
+
45
+ Load only the providers you need:
46
+
47
+ ```python
48
+ # Only Google and Amazon tools
49
+ tools = create_scavio_tools(providers=["google", "amazon"])
50
+
51
+ # Only YouTube
52
+ tools = create_scavio_tools(providers=["youtube"])
53
+
54
+ # Individual tool factories
55
+ from autogen_scavio import create_web_search_tool, create_amazon_search_tool
56
+
57
+ web_tool = create_web_search_tool(max_results=10)
58
+ amazon_tool = create_amazon_search_tool(max_results=5)
59
+ ```
60
+
61
+ ## Available Tools
62
+
63
+ | Provider | Tool | Description |
64
+ |----------|------|-------------|
65
+ | Google | `scavio_web_search` | Web search with knowledge graphs and related questions |
66
+ | Amazon | `scavio_amazon_search` | Product search across 20+ marketplaces |
67
+ | Amazon | `scavio_amazon_product` | Product details by ASIN |
68
+ | YouTube | `scavio_youtube_search` | Video search with filters |
69
+ | YouTube | `scavio_youtube_metadata` | Video metadata by ID |
70
+ | Walmart | `scavio_walmart_search` | Product search with price/fulfillment filters |
71
+ | Walmart | `scavio_walmart_product` | Product details by ID |
72
+ | Reddit | `scavio_reddit_search` | Post and comment search |
73
+ | Reddit | `scavio_reddit_post` | Post metadata and comments by URL |
74
+ | TikTok | `scavio_tiktok_profile` | User profile lookup |
75
+ | TikTok | `scavio_tiktok_user_posts` | User's posted videos |
76
+ | TikTok | `scavio_tiktok_video` | Video details |
77
+ | TikTok | `scavio_tiktok_video_comments` | Video comments |
78
+ | TikTok | `scavio_tiktok_comment_replies` | Comment replies |
79
+ | TikTok | `scavio_tiktok_search_videos` | Video search by keyword |
80
+ | TikTok | `scavio_tiktok_search_users` | User search by keyword |
81
+ | TikTok | `scavio_tiktok_hashtag` | Hashtag info |
82
+ | TikTok | `scavio_tiktok_hashtag_videos` | Videos by hashtag |
83
+ | TikTok | `scavio_tiktok_user_followers` | User's followers |
84
+ | TikTok | `scavio_tiktok_user_followings` | User's followings |
85
+
86
+ ## Configuration
87
+
88
+ ```python
89
+ from autogen_scavio import configure
90
+
91
+ # Set API key programmatically
92
+ configure(api_key="sk_live_...")
93
+
94
+ # Or pass to factory
95
+ tools = create_scavio_tools(api_key="sk_live_...", max_results=10)
96
+ ```
@@ -0,0 +1,115 @@
1
+ """AutoGen integration for Scavio Search API."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from autogen_core.tools import FunctionTool
6
+
7
+ from autogen_scavio._client import configure
8
+ from autogen_scavio.tools.amazon import create_amazon_product_tool, create_amazon_search_tool
9
+ from autogen_scavio.tools.google import create_web_search_tool
10
+ from autogen_scavio.tools.reddit import create_reddit_post_tool, create_reddit_search_tool
11
+ from autogen_scavio.tools.tiktok import (
12
+ create_tiktok_comment_replies_tool,
13
+ create_tiktok_hashtag_tool,
14
+ create_tiktok_hashtag_videos_tool,
15
+ create_tiktok_profile_tool,
16
+ create_tiktok_search_users_tool,
17
+ create_tiktok_search_videos_tool,
18
+ create_tiktok_user_followers_tool,
19
+ create_tiktok_user_followings_tool,
20
+ create_tiktok_user_posts_tool,
21
+ create_tiktok_video_comments_tool,
22
+ create_tiktok_video_tool,
23
+ )
24
+ from autogen_scavio.tools.walmart import create_walmart_product_tool, create_walmart_search_tool
25
+ from autogen_scavio.tools.youtube import create_youtube_metadata_tool, create_youtube_search_tool
26
+
27
+ __version__ = "0.1.0"
28
+
29
+ _PROVIDER_MAP: dict[str, list] = {
30
+ "google": [create_web_search_tool],
31
+ "amazon": [create_amazon_search_tool, create_amazon_product_tool],
32
+ "youtube": [create_youtube_search_tool, create_youtube_metadata_tool],
33
+ "walmart": [create_walmart_search_tool, create_walmart_product_tool],
34
+ "reddit": [create_reddit_search_tool, create_reddit_post_tool],
35
+ "tiktok": [
36
+ create_tiktok_profile_tool,
37
+ create_tiktok_user_posts_tool,
38
+ create_tiktok_video_tool,
39
+ create_tiktok_video_comments_tool,
40
+ create_tiktok_comment_replies_tool,
41
+ create_tiktok_search_videos_tool,
42
+ create_tiktok_search_users_tool,
43
+ create_tiktok_hashtag_tool,
44
+ create_tiktok_hashtag_videos_tool,
45
+ create_tiktok_user_followers_tool,
46
+ create_tiktok_user_followings_tool,
47
+ ],
48
+ }
49
+
50
+
51
+ def create_scavio_tools(
52
+ api_key: str | None = None,
53
+ max_results: int = 5,
54
+ providers: list[str] | None = None,
55
+ ) -> list[FunctionTool]:
56
+ """Create Scavio search tools for AutoGen agents.
57
+
58
+ Args:
59
+ api_key: Scavio API key. If None, reads from SCAVIO_API_KEY env var.
60
+ max_results: Default maximum results for search tools.
61
+ providers: List of providers to include (e.g. ["google", "amazon"]).
62
+ Defaults to all providers.
63
+
64
+ Returns:
65
+ List of FunctionTool instances ready for use with AutoGen agents.
66
+ """
67
+ configure(api_key)
68
+
69
+ selected = providers or list(_PROVIDER_MAP.keys())
70
+ tools: list[FunctionTool] = []
71
+
72
+ for provider in selected:
73
+ factories = _PROVIDER_MAP.get(provider)
74
+ if not factories:
75
+ raise ValueError(
76
+ f"Unknown provider '{provider}'. "
77
+ f"Available: {', '.join(_PROVIDER_MAP.keys())}"
78
+ )
79
+ for factory in factories:
80
+ import inspect
81
+
82
+ sig = inspect.signature(factory)
83
+ kwargs: dict = {}
84
+ if "max_results" in sig.parameters:
85
+ kwargs["max_results"] = max_results
86
+ tools.append(factory(**kwargs))
87
+
88
+ return tools
89
+
90
+
91
+ __all__ = [
92
+ "__version__",
93
+ "configure",
94
+ "create_scavio_tools",
95
+ "create_web_search_tool",
96
+ "create_amazon_search_tool",
97
+ "create_amazon_product_tool",
98
+ "create_youtube_search_tool",
99
+ "create_youtube_metadata_tool",
100
+ "create_walmart_search_tool",
101
+ "create_walmart_product_tool",
102
+ "create_reddit_search_tool",
103
+ "create_reddit_post_tool",
104
+ "create_tiktok_profile_tool",
105
+ "create_tiktok_user_posts_tool",
106
+ "create_tiktok_video_tool",
107
+ "create_tiktok_video_comments_tool",
108
+ "create_tiktok_comment_replies_tool",
109
+ "create_tiktok_search_videos_tool",
110
+ "create_tiktok_search_users_tool",
111
+ "create_tiktok_hashtag_tool",
112
+ "create_tiktok_hashtag_videos_tool",
113
+ "create_tiktok_user_followers_tool",
114
+ "create_tiktok_user_followings_tool",
115
+ ]
@@ -0,0 +1,61 @@
1
+ """Scavio API client management for AutoGen tools."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import os
7
+ from typing import Any
8
+
9
+ from scavio import AsyncScavioClient
10
+
11
+ _async_client: AsyncScavioClient | None = None
12
+ _configured_api_key: str | None = None
13
+
14
+
15
+ def configure(api_key: str | None = None) -> None:
16
+ """Set the Scavio API key and reset cached clients."""
17
+ global _configured_api_key, _async_client
18
+ _configured_api_key = api_key
19
+ _async_client = None
20
+
21
+
22
+ def get_async_client() -> AsyncScavioClient:
23
+ """Return a cached AsyncScavioClient, creating one if needed."""
24
+ global _async_client
25
+ if _async_client is None:
26
+ key = _configured_api_key or os.getenv("SCAVIO_API_KEY")
27
+ if not key:
28
+ raise ValueError(
29
+ "A Scavio API key is required. Provide it via "
30
+ "configure(api_key=...) or set the SCAVIO_API_KEY "
31
+ "environment variable. Get a free key at "
32
+ "https://dashboard.scavio.dev"
33
+ )
34
+ _async_client = AsyncScavioClient(api_key=key)
35
+ return _async_client
36
+
37
+
38
+ def truncate_list(
39
+ raw: dict[str, Any],
40
+ path: list[str],
41
+ max_results: int,
42
+ ) -> dict[str, Any]:
43
+ """Truncate a nested list in the response dict.
44
+
45
+ path is a list of keys to traverse, e.g. ["data", "products"].
46
+ """
47
+ obj = raw
48
+ for key in path[:-1]:
49
+ obj = obj.get(key, {})
50
+ if not isinstance(obj, dict):
51
+ return raw
52
+ last = path[-1]
53
+ items = obj.get(last)
54
+ if isinstance(items, list) and len(items) > max_results:
55
+ obj[last] = items[:max_results]
56
+ return raw
57
+
58
+
59
+ def format_response(raw: dict[str, Any]) -> str:
60
+ """Serialize a response dict to a JSON string."""
61
+ return json.dumps(raw, indent=2)
File without changes
@@ -0,0 +1 @@
1
+ """Scavio tool implementations for AutoGen."""
@@ -0,0 +1,142 @@
1
+ """Scavio Amazon tools for AutoGen."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from autogen_core.tools import FunctionTool
6
+
7
+ from autogen_scavio._client import format_response, get_async_client, truncate_list
8
+
9
+
10
+ def create_amazon_search_tool(
11
+ max_results: int = 5,
12
+ pages: int | None = None,
13
+ autoselect_variant: bool | None = None,
14
+ ) -> FunctionTool:
15
+ """Create an Amazon search tool with the given configuration."""
16
+
17
+ async def scavio_amazon_search(
18
+ query: str,
19
+ domain: str = "com",
20
+ sort_by: str | None = None,
21
+ start_page: int | None = None,
22
+ category_id: str | None = None,
23
+ merchant_id: str | None = None,
24
+ language: str | None = None,
25
+ currency: str | None = None,
26
+ device: str | None = None,
27
+ zip_code: str | None = None,
28
+ ) -> str:
29
+ """Search Amazon product listings using the Scavio API.
30
+
31
+ Args:
32
+ query: The product search query.
33
+ domain: Amazon domain suffix (e.g. "com", "co.uk", "de").
34
+ sort_by: Sort order for results.
35
+ start_page: Page number to start from.
36
+ category_id: Filter by Amazon category ID.
37
+ merchant_id: Filter by merchant/seller ID.
38
+ language: Language code for results.
39
+ currency: Currency code for prices.
40
+ device: Device type for the request.
41
+ zip_code: ZIP code for localized pricing/availability.
42
+
43
+ Returns:
44
+ JSON string with product names, prices, ratings, ASINs,
45
+ and availability.
46
+ """
47
+ client = get_async_client()
48
+
49
+ params: dict = {
50
+ "query": query,
51
+ "domain": domain,
52
+ }
53
+ if sort_by is not None:
54
+ params["sort_by"] = sort_by
55
+ if start_page is not None:
56
+ params["start_page"] = start_page
57
+ if pages is not None:
58
+ params["pages"] = pages
59
+ if category_id is not None:
60
+ params["category_id"] = category_id
61
+ if merchant_id is not None:
62
+ params["merchant_id"] = merchant_id
63
+ if language is not None:
64
+ params["language"] = language
65
+ if currency is not None:
66
+ params["currency"] = currency
67
+ if device is not None:
68
+ params["device"] = device
69
+ if zip_code is not None:
70
+ params["zip_code"] = zip_code
71
+ if autoselect_variant is not None:
72
+ params["autoselect_variant"] = autoselect_variant
73
+
74
+ raw = await client.amazon.search(**params)
75
+
76
+ truncate_list(raw, ["data", "products"], max_results)
77
+
78
+ return format_response(raw)
79
+
80
+ return FunctionTool(
81
+ scavio_amazon_search,
82
+ description=(
83
+ "Search Amazon product listings. Returns product names, "
84
+ "prices, ratings, ASINs, and availability."
85
+ ),
86
+ )
87
+
88
+
89
+ def create_amazon_product_tool() -> FunctionTool:
90
+ """Create an Amazon product detail tool."""
91
+
92
+ async def scavio_amazon_product(
93
+ asin: str,
94
+ domain: str = "com",
95
+ language: str | None = None,
96
+ currency: str | None = None,
97
+ device: str | None = None,
98
+ zip_code: str | None = None,
99
+ autoselect_variant: bool | None = None,
100
+ ) -> str:
101
+ """Fetch full details for a specific Amazon product by ASIN code.
102
+
103
+ Args:
104
+ asin: The Amazon Standard Identification Number for the product.
105
+ domain: Amazon domain suffix (e.g. "com", "co.uk", "de").
106
+ language: Language code for the response.
107
+ currency: Currency code for prices.
108
+ device: Device type for the request.
109
+ zip_code: ZIP code for localized pricing/availability.
110
+ autoselect_variant: Whether to auto-select the default variant.
111
+
112
+ Returns:
113
+ JSON string with full product details including title,
114
+ description, pricing, images, and specifications.
115
+ """
116
+ client = get_async_client()
117
+
118
+ params: dict = {
119
+ "asin": asin,
120
+ "domain": domain,
121
+ }
122
+ if language is not None:
123
+ params["language"] = language
124
+ if currency is not None:
125
+ params["currency"] = currency
126
+ if device is not None:
127
+ params["device"] = device
128
+ if zip_code is not None:
129
+ params["zip_code"] = zip_code
130
+ if autoselect_variant is not None:
131
+ params["autoselect_variant"] = autoselect_variant
132
+
133
+ raw = await client.amazon.product(**params)
134
+
135
+ return format_response(raw)
136
+
137
+ return FunctionTool(
138
+ scavio_amazon_product,
139
+ description=(
140
+ "Fetch full details for a specific Amazon product by ASIN code."
141
+ ),
142
+ )