Repository navigation
feat: add People Search tools (1.1.0) - #3
Merged
Merged
Conversation
Add two LangChain tools for Desearch People Search: - PeopleSearchTool (people_search_tool) starts a billed search on x, linkedin, youtube or tiktok, waits up to `timeout` seconds and returns compact people (name, handle, url, platform, audience, location, score, why they matched, contacts, links). Called again with only task_id it keeps waiting on the same search without starting or billing a new one. Platform filters that the API would reject are refused before any call. - PeopleProfilesTool (people_profiles_tool) lists the free profiles library with the result filters (has, min/max_audience, min_score, location, verified) and sorting. Both are in a new people_tools group and kept out of search_tools, so the default agent never starts a billed search. The tools call the /desearch/people routes over HTTP with aiohttp because the People Search methods arrive in desearch-py 1.4.0, which is not on PyPI yet; the desearch-py requirement is unchanged. Tests run against a local aiohttp server, never the live API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 28, 2026
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.
What this adds
Two LangChain tools for Desearch People Search, in a new
people_toolsgroup. Both are also exported fromlangchain_desearch.PeopleSearchTool(people_search_tool)x,linkedin,youtubeortiktok(POST /desearch/people/search/{platform}), pollsGET /desearch/people/tasks/{task_id}and waits up totimeoutseconds (default 300, max 1800). It then reads every page ofGET .../results.why(the score summary), contacts, links and one evidence URL. Also verified/headline/company when present, plus task status and cost and anext_stepsentence.timeoutruns out, it returns the people found so far with thetask_id. Calling the tool again with onlytask_idkeeps waiting on that search: it is free and starts nothing new.count(5-200),min_score,exclude,idempotency_key(sent asIdempotency-Key; a replayed key is markedexisting_task), and the platform filters (min_followers,verified_only,min_subscribers,require_contact,countries,keywords, …).verified_onlyon LinkedIn) is rejected during input validation, before any request is sent, so nothing is billed.PeopleProfilesTool(people_profiles_tool)GET /desearch/people/profiles) for one platform:q,sort(score/recent/audience),limit,cursor, plus the result filtershas(email, website, x, linkedin, instagram, youtube, tiktok),min_audience,max_audience,min_score,locationandverified.total, compact people (withfound_by) andnext_cursor.people_toolsis kept out ofsearch_tools, socreate_search_agentnever starts a billed search. Both tools follow the existing conventions:_run/_arun,return_direct=True,DESEARCH_API_KEYfrom the environment, and errors returned as"An error occurred while calling Desearch: HTTP <status>: <detail>". The API key never appears in an error.Why direct HTTP instead of desearch-py
The tools call the
/desearch/peopleroutes directly with aiohttp (new filelangchain_desearch/people.py). They send the sameAuthorization: <api key>header as the SDK. The People Search methods are in desearch-py 1.4.0, which is merged on GitHub but not on PyPI yet (PyPI has 1.2.1). Thedesearch-py>=1.1.0,<2.0.0requirement is unchanged.aiohttp>=3.8,<4.0.0is now declared explicitly; desearch-py already installs it. Once desearch-py 1.4.0 is on PyPI, these tools can switch to the SDK methods (x_profile_search,wait_for_people_task,iter_people_results,list_people_profiles, …) andpeople.pycan be dropped.Version
1.0.7→1.1.0insetup.pyandpyproject.toml. The README has a new People Tools section with an example, a table of filters by platform, and a note on billing and timing.Tests
tests/unit_tests/test_people_tools.py(22 tests) runs the tools against a local aiohttp server and never calls the live API. It checks the URLs, theAuthorizationandIdempotency-Keyheaders, the request bodies and query encoding, polling, the timeout path, resuming withtask_id, results pagination, idempotent replay, platform filter rejection with no request sent, HTTP errors without the key, sync calls inside a running loop, andainvoke.Passes on Python 3.12 with langchain-core 1.6.12, Python 3.10 with langchain-core 0.3.51 / pydantic 2.11.3 (the
setup.pypins), and Python 3.9.Publishing
Merging ships this to PyPI. For this repo the Publish workflow runs when a GitHub release is published from
main. PyPI publishing is currently blocked for Desearch until the PyPI token is fixed, so hold the merge and release until then.🤖 Generated with Claude Code