DEV Community

Cover image for Let your coding agent check live GitHub stats before it picks a library
Tim Zinin
Tim Zinin

Posted on

Let your coding agent check live GitHub stats before it picks a library

A coding agent without a search tool recommends libraries from memory. That memory has a cutoff date, so the agent cannot know that a project was archived last spring, changed its license, or was overtaken by a newer tool with three times the stars. The fix is boring and effective: before the agent suggests a dependency, it looks up the current numbers.

The GitHub Search API already has those numbers. I wrapped it in a small Actor, GitHub Repository Search, that takes a keyword and returns one clean row per repository: stars, forks, open issues, language, license, archived flag and the repository's updatedAt timestamp.

Where an agent uses it

  • Dependency choice. Before adding a browser automation or PDF library, the agent searches the keyword, drops archived projects and shows the top options with stars, license and open issues.
  • Landscape scans. "Which TypeScript MCP servers from organizations have the most stars right now?" becomes one call with term and language, answered from live data.
  • Due diligence in reviews. When a pull request adds a new dependency, a review bot can attach the repo's current stars, open issues and license to the comment.

A real run

Input of a successful run (gyMvTHK0uUxJK8lsn, November 11, 2026):

{
  "term": "playwright",
  "minStars": 100,
  "maxItems": 5,
  "sort": "stars"
}
Enter fullscreen mode Exit fullscreen mode

The first three rows, trimmed to the main fields (each row also carries found: true, repositoryUrl, source and retrievedAt):

[
  {
    "repository": "browser-use/browser-use",
    "stars": 120734,
    "forks": 13497,
    "openIssues": 617,
    "language": "Python",
    "license": "MIT",
    "archived": false,
    "updatedAt": "2026-11-11T21:39:34Z"
  },
  {
    "repository": "microsoft/playwright",
    "stars": 99890,
    "forks": 6849,
    "openIssues": 33,
    "language": "TypeScript",
    "license": "Apache-2.0",
    "archived": false,
    "updatedAt": "2026-11-11T21:50:53Z"
  },
  {
    "repository": "fastapi/full-stack-fastapi-template",
    "stars": 46232,
    "forks": 9220,
    "openIssues": 11,
    "language": "TypeScript",
    "license": "MIT",
    "archived": false,
    "updatedAt": "2026-11-11T19:55:00Z"
  }
]
Enter fullscreen mode Exit fullscreen mode

Rows from a successful GitHub Repository Search run

This small sample already shows why the check matters. The run sorts by stars, and the keyword match pulls in projects that only use Playwright: an AI browser agent outranks Playwright itself, and the third row is a FastAPI project template. An agent that reads these rows can point that out before it recommends anything.

Giving it to the agent

Expose one function as a tool and tell the model when to call it:

import os

import requests

URL = ("https://api.apify.com/v2/acts/zinin~github-repository-search-scraper"
       "/run-sync-get-dataset-items")

def search_repos(term, language=None, min_stars=100, limit=10):
    """Current GitHub stats for public organization repositories matching a keyword."""
    payload = {"term": term, "minStars": min_stars, "maxItems": limit, "sort": "stars"}
    if language:
        payload["language"] = language
    resp = requests.post(
        URL,
        json=payload,
        headers={"Authorization": f"Bearer {os.environ['APIFY_TOKEN']}"},
        timeout=120,
    )
    resp.raise_for_status()
    return [r for r in resp.json() if r.get("found") and not r.get("archived")]
Enter fullscreen mode Exit fullscreen mode

A system prompt line such as "Before recommending a new dependency, call search_repos and cite stars, license and archived status" is enough for most agents to use it.

GitHub Repository Search page in Apify Store

Price and limits

The Actor charges $2.20 per 1,000 repositories on the Free plan, down to $1.54 on higher plans, with no start fee. A ten-row lookup costs about two cents.

Read the limits before you build on it:

  • It returns public repositories owned by organizations. Projects under a personal account are not included, and some well-known tools live under personal accounts.
  • One call reads a single page of up to 30 candidates. Use it for lookups; a full crawl of GitHub needs a different tool.
  • Matches come from GitHub's keyword search, so unrelated repos that mention the term can appear. Rows deliberately carry no descriptions or README text, so open repositoryUrl before you trust a match.
  • GitHub limits search requests. Heavy use works better with your own token in the optional githubToken field.
  • updatedAt is GitHub's updated_at. It moves on any change to the repository record, new stars included: all five rows in the run above show a time within about two hours of the run. For commit activity, open the repository.
  • Stars measure attention. Report them as a sign that people use a project, and leave quality to the code and the issue tracker.

Try GitHub Repository Search with the next library your agent suggests and compare its answer with the live numbers.

Disclosure: I maintain this Actor. Drafted with AI assistance using the cited successful run. This article contains Apify affiliate links; I may earn a commission if you sign up for a paid plan through them.

Top comments (1)

Collapse
 
userxnom profile image
Abdullah Naseer •

The check itself is the part that matters — an agent recommending from memory is how you end up with a library that was archived last spring. I have been bitten by exactly that in Android projects.

One catch worth flagging: the org-only limit. A lot of the Android libraries I actually use live under personal accounts, not organizations. A check that silently excludes them would steer the agent toward the bigger org-owned option even when the personal-account one is better maintained. For my own use I would want the archived flag and the last release date next to the stars, since a repo with 40k stars and no release in two years is the dangerous one.

Do you find stars or the last-release date more predictive when you are picking between two close options? In my experience the release date tells the truth faster.