Skip to content

feat: modernize langchain integration social tools#30

Draft
daveomri wants to merge 63 commits intofeat/modernize-langchain-integrationfrom
feat/modernize-langchain-integration-social-tools
Draft

feat: modernize langchain integration social tools#30
daveomri wants to merge 63 commits intofeat/modernize-langchain-integrationfrom
feat/modernize-langchain-integration-social-tools

Conversation

@daveomri
Copy link
Copy Markdown
Collaborator

Third PR on feat/modernize-langchain-integration. Depends on core tools and native components. Adds seven social media Actor tools.

~545 lines of new code, ~570 lines of tests.


New tools (_actor_tools.py)

  • ApifyInstagramScraperTool
    • wraps apify/instagram-scraper; search_type: user, hashtag, post, comments; optional date filter via only_posts_newer_than
  • ApifyLinkedInProfilePostsTool
    • wraps apimaestro/linkedin-profile-posts; takes a profile URL or username
  • ApifyLinkedInProfileSearchTool
    • wraps harvestapi/linkedin-profile-search; free-text keyword search over profiles
  • ApifyLinkedInProfileDetailTool
    • wraps apimaestro/linkedin-profile-detail; optional include_email
  • ApifyTwitterScraperTool
    • wraps apidojo/twitter-scraper-lite; search_mode: search, user, replies; optional ISO date bounds
  • ApifyTikTokScraperTool
    • wraps clockworks/tiktok-scraper; search_type: search, user, hashtag
  • ApifyFacebookPostsScraperTool
    • wraps apify/facebook-posts-scraper; public pages only; optional date filter

All seven subclass _ApifyGenericTool: handle_tool_error=True, _clamp_timeout/_clamp_items ceilings, APIFY_API_TOKEN env fallback, sync-only _run.

ApifyToolsClient additions (_client.py)

Seven new methods

  • instagram_scrape, linkedin_profile_posts, linkedin_profile_search, linkedin_profile_detail, twitter_scrape, tiktok_scrape, facebook_posts_scrape
  • each mapping simplified params to the Actor's input schema and reusing run_actor_and_get_items + _list_items_or_raise.

Exports (__init__.py)

APIFY_SOCIAL_TOOLS list added alongside APIFY_CORE_TOOLS and APIFY_ACTOR_TOOLS. Bind only the group(s) you need; loading all at once bloats the LLM context.

No breaking changes. All additions are additive; existing ApifyActorsTool, ApifyDatasetLoader, and ApifyWrapper behavior is unchanged.

Tests

  • test_actor_tools.py (~330 lines): happy path, param mapping, max_results clamping, RuntimeError/ValueError -> ToolException, empty results, parametrized handle_tool_error check across all seven tools
  • test_client.py (~240 lines): input mapping for all seven new client methods, unsupported-mode ValueErrors

Suggested reading order: _client.py -> _actor_tools.py -> __init__.py → tests

Merge target: feat/modernize-langchain-integration, not main. Rebase after [#28](#28) and [#29](#29) land. Docs and notebooks follow in a separate PR.

daveomri added 30 commits April 20, 2026 16:12
…and maintability; update test cases for better formatting and error handling
@daveomri daveomri self-assigned this Apr 27, 2026
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.

2 participants