Skip to content

Feat: Strands social media Apify tools#2

Open
daveomri wants to merge 30 commits intomainfrom
feat/strands-social-media-actor-tools
Open

Feat: Strands social media Apify tools#2
daveomri wants to merge 30 commits intomainfrom
feat/strands-social-media-actor-tools

Conversation

@daveomri
Copy link
Copy Markdown
Collaborator

@daveomri daveomri commented Apr 1, 2026

Tester guides

link

Apify docs

link


Description

Part 3 of 3 — This PR builds on the core Apify tools introduced in feat/strands-core-apify-tools and should be reviewed after that PR is merged. A second PR (feat/strands-search-crawling-actor-tools) adds search & crawling tools. A separate strands docs PR will cover documentation for all three sets of tools (core, search & crawling, and social).

This PR extends the Apify integration (src/strands_tools/apify.py) with seven new social media tools that wrap popular Actors from Apify Store, giving agents structured access to Instagram, LinkedIn, Twitter/X, TikTok, and Facebook scraping.

New tools

Tool Underlying Actor Description
apify_instagram_scraper apify/instagram-scraper Scrape Instagram profiles, posts, reels, or hashtags — supports search by user, hashtag, or place
apify_linkedin_profile_posts apimaestro/linkedin-profile-posts Scrape recent posts from a LinkedIn profile
apify_linkedin_profile_search harvestapi/linkedin-profile-search Search for LinkedIn profiles by keywords, with optional location and job title filters
apify_linkedin_profile_detail apimaestro/linkedin-profile-detail Get detailed LinkedIn profile data (experience, education, skills)
apify_twitter_scraper apidojo/twitter-scraper-lite Scrape tweets by search query, handles, or direct URLs — supports advanced Twitter search syntax
apify_tiktok_scraper clockworks/tiktok-scraper Scrape TikTok videos by search, hashtag, profile, or direct post URL
apify_facebook_posts_scraper apify/facebook-posts-scraper Scrape posts from Facebook pages or profiles with optional date filtering

All tools share the existing ApifyToolClient, error handling, and Rich console output from the core module. A shared _social_media_result helper and a _extract_linkedin_username utility keep the implementations DRY.

Two new export lists are added:

  • APIFY_SOCIAL_TOOLS — the seven social media tools
  • APIFY_ALL_TOOLSAPIFY_CORE_TOOLS + APIFY_SOCIAL_TOOLS for convenience (with a warning that exposing all tools at once may overwhelm the LLM)

Files changed

File Change
src/strands_tools/apify.py 7 new @tool-decorated functions, _social_media_result and _extract_linkedin_username helpers, Actor ID constants, validation constants, APIFY_SOCIAL_TOOLS and APIFY_ALL_TOOLS exports
tests/test_apify.py 35+ new test cases covering all seven tools plus the LinkedIn username extraction helper
docs/apify_tool.md Social Media section with usage examples and parameter reference tables
README.md Tool table entries and usage examples for social media tools

PR series

# Branch Scope Status
1 feat/strands-core-apify-tools Core tools: apify_run_actor, apify_get_dataset_items, apify_run_actor_and_get_dataset, apify_run_task, apify_run_task_and_get_dataset, apify_scrape_url Review first
2 feat/strands-search-crawling-actor-tools Search & crawling tools: Google Search, Google Maps, YouTube, website crawler, e-commerce Review after #1 merges
3 feat/strands-social-media-actor-tools Social media tools (this PR) Review after #1 merges
strands docs repo Documentation for all three tool sets Link TBD

Related Issues

#1
#3

Documentation PR

apify/docs#1

Type of Change

New Tool

Testing

  • Added unit tests for all seven social media tools, including:

    • Instagram Scraper: search by keyword, direct URLs, URL auto-detection in search_query, results_type and search_type validation, missing params error
    • LinkedIn Profile Posts: success path, results limit capped at 100
    • LinkedIn Profile Search: basic search, optional filters (locations, job titles), invalid profile_scraper_mode validation
    • LinkedIn Profile Detail: profile URL, bare username, include_email flag
    • Twitter Scraper: search query, direct URLs, handles, sort + language params, invalid sort validation, missing params error
    • TikTok Scraper: search query, direct URLs, hashtags, profiles, missing params error
    • Facebook Posts Scraper: success path, only_posts_newer_than date filter
    • Cross-cutting: missing dependency, missing token, and Actor failure tests applied to social media tools
    • Helper: _extract_linkedin_username — URL parsing, trailing slash, bare username, non-profile URL fallback
  • Ran hatch run prepare locally — no warnings or lint issues.

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@daveomri daveomri self-assigned this Apr 1, 2026
@daveomri daveomri requested a review from jirispilka April 1, 2026 09:30
@daveomri daveomri mentioned this pull request Apr 1, 2026
7 tasks
Copy link
Copy Markdown

@jirispilka jirispilka left a comment

Choose a reason for hiding this comment

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

I just skimmed through this one 😊
I believe it is similar to the previous one with the search-scraper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants