Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

langchain-finic

Community-maintained LangChain integration for Finic Grayson, by Suprep Labs. Typed decisions, LCEL composition, LangGraph nodes, structured tools, and optional agent middleware. This alpha is not endorsed by Finic or LangChain.

Documentation · Source · PyPI · MIT license

Install

Python 3.11 or newer. Install the alpha release:

pip install langchain-finic==0.1.0a4
export FINIC_API_KEY=your_key
# Optional; defaults to grayson-1:
export FINIC_MODEL=grayson-1

Make a typed decision

from langchain_finic import Choice, DecisionRequest, FinicClassifier, Noul

request = DecisionRequest(
    state={"events": ["New device", "Transfer to an unfamiliar recipient"]},
    questions={
        "takeover": Noul(instructions="Does this evidence suggest account takeover?"),
        "route": Choice(
            instructions="Choose a review queue.",
            criteria={"standard": "Routine review", "urgent": "Urgent investigation"},
        ),
    },
)

with FinicClassifier() as classifier:
    decision = classifier.invoke(request)
    print(decision.nouls["takeover"].noul)
    print(decision.choices["route"].choice)
    print(decision.request_id)

Noul, Choice, MultiChoice, and Score have typed answers. Responses retain probabilities, usage, and request metadata. Finic evaluates decisions; it does not generate chat messages or text tokens.

Compose with LangChain and LangGraph

# request is defined above.
with FinicClassifier() as classifier:
    route_chain = classifier | (lambda result: result.choices["route"].choice)
    route = route_chain.invoke(request, config={"tags": ["risk-review"]})
    tool = classifier.as_tool()
    print(tool.name)  # finic_decide; pass it to create_agent or ToolNode
import asyncio

async def review():
    async with FinicClassifier() as classifier:
        return await classifier.abatch([request], config={"max_concurrency": 1})

results = asyncio.run(review())

Batching makes individual API requests; concurrency is controlled by Runnable config. Streaming yields one complete decision. A chat-provider model can call the Finic tool through create_agent; the Finic integration itself is a decision Runnable.

Optional middleware

pip install 'langchain-finic[middleware]==0.1.0a4'

ModelRouterMiddleware selects among host chat models. AutoModeMiddleware screens specified tools before execution. See the complete middleware example and configuration guide. Tool screening is probabilistic; application authorization remains necessary.

Configuration and data

Use FINIC_API_KEY, FINIC_MODEL, FINIC_TIMEOUT_SECONDS, and FINIC_MAX_ATTEMPTS, or constructor options. The library does not load .env. The host controls optional LangSmith tracing, which can record request data and responses. Default timeout is 60 seconds, with up to three attempts; retries can incur additional charges. Use context managers to reuse and close owned HTTP clients. Injected clients remain caller-owned. Read the usage guide for precedence, serialization, resource lifetimes, and error handling.

Development

uv sync --locked --group dev --extra middleware
make check

Default tests use mocked HTTP with network disabled. Opt-in live tests spend Finic credits. See contributing and security reporting.

References: Finic API, LangChain integration guidelines.

Metadata

Release files for langchain-finic 0.1.0a4

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-finic 0.1.0a4
File Size Uploaded Provenance
langchain_finic-0.1.0a4.tar.gz 222.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-finic 0.1.0a4
File Interpreter ABI Platform
langchain_finic-0.1.0a4-py3-none-any.whl Python 3 none any Details

Total release size: 238.8 kB

Release files / langchain_finic-0.1.0a4.tar.gz

Download URL langchain_finic-0.1.0a4.tar.gz
Size 222.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9be80eb425e1df952fd70a632efc9ba2bdf2fb71737238dfe8dcb5b3d6c2425d
BLAKE2b-256 checksum
How to use checksums
b9b3cced36eda473e6c6518185702291fb0d7c6818fe90994134b069758a0ff5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Release files / langchain_finic-0.1.0a4-py3-none-any.whl

Download URL langchain_finic-0.1.0a4-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
21776e3ba94717caeab65271f7f8622c746980db35069db1c4076545071f9b57
BLAKE2b-256 checksum
How to use checksums
d10047abd9b86bfe7cfd3c1a9a89b36190d2ae80ddcdfe610295622da8bf26f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Security for langchain-finic 0.1.0a4

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for langchain_finic-0.1.0a4.tar.gz

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 Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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