Skip to main content

langchain-alphai

LangChain tools and a retriever for AlphaAI — AI-scored, ticker-linked financial news and SEC Form 4 insider events, built for AI agents and trading bots.

Every article on the AlphaAI feed is enriched before you see it: per-ticker impact analysis, one of 14 categories, and a 1-10 market-relevance score. The components here fetch and filter that feed — no scraping, no scoring of your own.

  • AlphaAINewsSearch — the scored news feed with ticker / category / relevance filters
  • AlphaAIInsiderNews — SEC Form 4 insider events with a structured who-sold-what block
  • AlphaAITickerSentiment — 7-day bullish/neutral/bearish rollup for one ticker
  • AlphaAIInsiderSummary — 30-day insider buy/sell rollup for one ticker
  • AlphaAINewsRetriever — the feed as LangChain Documents for RAG pipelines

Install

pip install langchain-alphai

Requires Python 3.10+.

Authentication

Create an API key at alphai.io/developers — the free tier works without a card. Export it as ALPHAI_API_KEY, or pass api_key=... to any component.

export ALPHAI_API_KEY="ak_live_..."

Use the tools in an agent

from langchain.agents import create_agent

from langchain_alphai import (
    AlphaAIInsiderNews,
    AlphaAIInsiderSummary,
    AlphaAINewsSearch,
    AlphaAITickerSentiment,
)

agent = create_agent(
    model="claude-sonnet-4-5",
    tools=[
        AlphaAINewsSearch(),
        AlphaAIInsiderNews(),
        AlphaAITickerSentiment(),
        AlphaAIInsiderSummary(),
    ],
)

agent.invoke({"messages": [("user", "Are NVDA insiders selling, and does the news explain why?")]})

Each tool also works standalone:

from langchain_alphai import AlphaAINewsSearch

tool = AlphaAINewsSearch(min_relevance=7)  # instance defaults, overridable per call
tool.invoke({"symbol": "NVDA", "max_results": 5})
{
    "results": [
        {
            "uid": "788e477c66f3849b",
            "url": "https://...",
            "title": "Nvidia beats on data-center revenue",
            "summary": "Q2 revenue came in above consensus...",
            "source": "Example Wire",
            "source_domain": "example.com",
            "published_at": "2026-08-14T12:30:00+00:00",
            "tickers": ["NVDA"],
            "category": "earnings",
            "relevance_score": 8,
        }
    ]
}

Insider events add a structured insider block — side, shares, average price, total dollar value, who traded, and whether the sale was a pre-planned 10b5-1:

from langchain_alphai import AlphaAIInsiderNews

AlphaAIInsiderNews().invoke({"symbol": "NVDA", "min_relevance": 7})

On the insider feed the relevance score is deterministic from the event's summed dollar value, so min_relevance works as an "only large trades" dial.

Use the retriever for RAG

The query is a ticker symbol (crypto uses BTC-USD, foreign listings the Yahoo suffix, e.g. VOD.L); an empty query returns the market-wide feed.

from langchain_alphai import AlphaAINewsRetriever

retriever = AlphaAINewsRetriever(min_relevance=7, k=5)
docs = retriever.invoke("NVDA")

docs[0].page_content  # title + summary
docs[0].metadata  # tickers, category, relevance_score, url, source, ...

Filters

Parameter Where Meaning
symbol news + insider tools One ticker; share-class siblings included on the insider feed
category news tool, retriever One of 14: earnings, mergers_acquisitions, regulation, macro_economy, sector_analysis, market_movers, technology, commodities, crypto, ipo, geopolitics, insider, corporate_actions, other
min_relevance news + insider tools, retriever 1-10 floor; 7+ keeps only high-signal articles
collapse_stories news tool, retriever (constructor) Collapse syndicated same-story coverage into one item
max_results / k all Cap on returned items
include_analysis news tool (constructor) Add per-ticker AI sentiment + impact summary to each result

Async

Every tool implements ainvoke, and the retriever _aget_relevant_documents, over the SDK's native async client:

await AlphaAINewsSearch().ainvoke({"symbol": "NVDA"})

Rate limits

Limits are per AlphaAI account, two-layer (per-minute burst + per-day volume): Free 20/min · 100/day, Basic 60/min · 10,000/day, Pro 150/min · 100,000/day. News-archive depth is tiered too (30/90 days / full archive). The underlying alphai-sdk retries 429s with backoff automatically.

Links

AlphaAI output is AI-generated financial information for research, not investment advice — see alphai.io/terms.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_alphai-0.1.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_alphai-0.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file langchain_alphai-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_alphai-0.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for langchain_alphai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4daa2d25b0303902af1bd0b080ff3232fabb9f0b1965b963e6dacf68fbf38e45
MD5 852bc169a4ea425520d2532fabe34638
BLAKE2b-256 2e05705a9a0b94cb5e4af223a8dab3700f1fdf858186992b66c4a08224a8111d

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_alphai-0.1.0.tar.gz:

Publisher: release.yml on makeev/langchain-alphai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langchain_alphai-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_alphai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16da38427f05d675e5b0596d5a4e978d23592f92eb5aeb908d0aca5a9eb72eb8
MD5 a9c14341d2d5f892b3c2f9a54867ca8e
BLAKE2b-256 be810eb761cf79be5f1e43a9fdbbc9ad6b925a43ee276b9fc5c415760f6b3e68

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_alphai-0.1.0-py3-none-any.whl:

Publisher: release.yml on makeev/langchain-alphai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page