LangChain

langchain-arche gives a LangChain agent Arche's SEC financial data as four tools. It is built on the Python SDK, so the tools call the same public routes and return the same fields.

Install

pip install langchain-arche

Create the tools

arche_tools returns a list of LangChain StructuredTool objects. Pass an API key, or any other ArcheClient argument:

import os

from langchain_arche import arche_tools

tools = arche_tools(api_key=os.environ["ARCHE_API_KEY"])

Create a key in the developer portal. To share one connection pool with code that already uses the SDK, pass the client instead: arche_tools(client=client).

The tools

  • Name
    arche_resolve_company
    Type
    tool
    Description

    Resolve a ticker to the CIK of the SEC registrant it named, now or on a past date given as as_of.

  • Name
    arche_statements
    Type
    tool
    Description

    List a company's normalized income statements, balance sheets or cash flows, one statement_type at a time, newest first, with each figure's filing. Takes a CIK or ticker, and optionally from_date, to_date and page_size.

  • Name
    arche_as_of_financials
    Type
    tool
    Description

    Return a company's statements exactly as they were known on as_of_date, with no later restatement, plus a hash and URL to verify the snapshot.

  • Name
    arche_verify_replay
    Type
    tool
    Description

    Check that an earlier Arche answer, named by its replay_token, is reproduced from the same SEC data today.

Use them in an agent

The tools work with any LangChain chat model that supports tool calling:

import os

from langchain.agents import create_agent
from langchain_arche import arche_tools

agent = create_agent(
    "anthropic:claude-sonnet-5-5",
    tools=arche_tools(api_key=os.environ["ARCHE_API_KEY"]),
)

result = agent.invoke(
    {"messages": [{"role": "user", "content": "What was Apple's revenue as known on 2024-03-31?"}]}
)
print(result["messages"][-1].content)

Verify an answer

A replay token names one Arche query at one point in time. It comes from the MCP as-of tool or from POST /v1/query/execute; see Deterministic replay. Give the agent a token and arche_verify_replay says whether the same SEC data still returns the same answer. The Verifiable agent answers guide covers having an agent quote the token beside each figure.

Was this page helpful?