feat: add Apify platform core tools#456
Closed
daveomri wants to merge 27 commits into
Closed
Conversation
Made-with: Cursor
…ed details on input, usage, and examples.
fix: improve Apify tools docstrings with Apify context
Author
|
cc @drobnikj |
7 tasks
7 tasks
|
Hi @daveomri, thanks for creating this! We are encouraging the Strands community to vend a tool as package instead of placing it here. Please see the following user guides: Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds Apify platform integration as a new tool for Strands Agents (
src/strands_tools/apify.py), enabling agents to interact with the Apify Actor and task ecosystem for web scraping and automation tasks.Six new tools are introduced:
Actor Execution:
apify_run_actor: Run any Apify Actor by ID with arbitrary input and return run metadata (run ID, status, dataset ID, timestamps).apify_run_actor_and_get_dataset: Convenience tool that runs an Actor and fetches its default dataset results in a single call.Task Execution:
apify_run_task: Run a saved Apify task by ID with optional input overrides and return run metadata. Tasks are pre-configured Actor setups that can be rerun without redefining inputs.apify_run_task_and_get_dataset: Convenience tool that runs a task and fetches its default dataset results in a single call.Data Retrieval:
apify_get_dataset_items: Fetch items from an existing Apify dataset by ID, with pagination support.apify_scrape_url: Scrape a single URL using the Website Content Crawler Actor and return the page content as markdown.All tools share a common
ApifyToolClienthelper class, consistent error handling (with user-friendly messages for 401/404/429 API errors), URL validation, dependency checking, and Rich console output.All tools require
APIFY_API_TOKENto be set in the environment. Theapify-clientSDK is added as an optional dependency (pip install strands-agents-tools[apify]).Files Changed
src/strands_tools/apify.py@tool-decorated functions andApifyToolClienthelpertests/test_apify.pydocs/apify_tool.mdpyproject.tomlapifyoptional dependency group (apify-client>=2.5.0,<3.0.0), added to static-analysis and test env featuresREADME.mdRelated Issues
#457
#458
Documentation PR
strands-agents/docs#769
Type of Change
New Tool
Testing
Added comprehensive unit tests in
tests/test_apify.pycovering all six tools, including:apify-clientnot installed) fallback for every toolTaskClient.call(), input omission when not provided)Ran
hatch run preparelocally to verify no warnings or lint issues.I ran
hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.