Skip to main content

langchain-alphai

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

Every article on the AlphAI 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 AlphAI 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

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

Release files for langchain-alphai 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-alphai 0.1.1
File Size Uploaded
langchain_alphai-0.1.1.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-alphai 0.1.1
File Interpreter ABI Platform
langchain_alphai-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.4 kB

Release files / langchain_alphai-0.1.1.tar.gz

Download URL langchain_alphai-0.1.1.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f9a736ef73c9b42071e14fe28998b39045f7a113fd904d4e3146a93e00f5ac95
BLAKE2b-256 checksum
How to use checksums
5f06f482626597c641a68f7099b44a2cb36bbdbf362c497a2773d42a5ff70b9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.

Transparency log

Release files / langchain_alphai-0.1.1-py3-none-any.whl

Download URL langchain_alphai-0.1.1-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4429f1e71cc17b16b209a4c01ed221227d0979b293e22f40420fa801d8d29ad8
BLAKE2b-256 checksum
How to use checksums
1d324512102a92af2e847ef645a0b62a66f70e9e2601f5c09498a0fbee3c426c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page