Python SDK
One package, heyarchie, gives you the Python SDK (import heyarchie) and the archie command line. It needs Python 3.11 or newer.
Install the Package
As a library, install it into your project's virtualenv. As a command line, install it on its own with pipx or uv. On macOS a bare pip install can stop at externally-managed-environment, because Homebrew guards the system Python; pipx and uv manage a virtualenv for you and avoid it.
pip install heyarchie pipx install heyarchie # brew install pipx first, if needed # or, with uv: uv tool install heyarchie
The Pre-Release Channel
Pre-release builds come from staging and are aimed at the staging API. --pre is required: they are published as pre-release versions so that a plain pip install heyarchie never picks one up by accident.
pip install --pre heyarchie
Name Your Region
There is no default host. Archie serves one hostname per region, so the client refuses to start until you name one; a default would quietly send your key and your data to whichever region it named. Name it by URL, or by region name with environment.
import heyarchie
from heyarchie.environments import api_url
archie = heyarchie.Archie(api_key="sk_...", base_url=api_url("uk"))How the Client Finds Its Host, Highest First
A URL, such as https://uk.heyarchie.com.
A region by name, such as "uk".
A URL. The archie command line reads it too.
A region by name.
With none of them, the client raises ArchieConfigError rather than guessing. Giving both base_url and environment raises it as well.
The Names Environment Takes
Each is https://<name>.heyarchie.com.
https://gcp.staging.heyarchie.com, for the pre-release channel.
A name that is not in the table, or a row that is not live, raises and says why. Nothing is sent.
Sign in Once With the Archie Command
archie auth login saves the host it resolved to ~/.archie/credentials.toml, and every later command reuses it. Its order, highest first: --api-url, --environment, ARCHIE_API_URL, ARCHIE_ENVIRONMENT, then the saved profile.
archie auth login --api-url https://<your-archie-host> archie auth login --environment uk # -> https://uk.heyarchie.com archie auth login --environment staging # -> https://gcp.staging.heyarchie.com export ARCHIE_API_URL=https://<your-archie-host> export ARCHIE_ENVIRONMENT=uk
Ask Archie a Question
Pass your key, your region and your workspace. A key that reaches several workspaces must name one, with workspace_id or ARCHIE_WORKSPACE_ID.
import heyarchie
archie = heyarchie.Archie(
api_key="sk_...",
base_url="https://uk.heyarchie.com", # or export ARCHIE_API_URL
workspace_id="ws_...", # or export ARCHIE_WORKSPACE_ID
)
message = archie.messages.create(
"Summarise the BAS for Q1 2026",
client_id="<client id>",
)
print(message.content)
if message.citations:
print(message.citations[0].standard)The Async Client
AsyncArchie takes the same arguments. Await the same methods.
import asyncio
import heyarchie
async def main():
async with heyarchie.AsyncArchie(
api_key="sk_...",
base_url="https://uk.heyarchie.com",
) as archie:
message = await archie.messages.create("Summarise BAS Q1 2026")
print(message.content)
asyncio.run(main())Name Your Workspace
The server refuses a signed-in request that names no workspace, so every call carries X-Workspace-ID. With neither workspace_id nor ARCHIE_WORKSPACE_ID, the client lists your workspaces once and uses the only one. With several, it raises ArchieConfigError naming them; it never guesses.
Archie(api_key=..., base_url=..., workspace_id="ws-1") # or export ARCHIE_WORKSPACE_ID
Documents, Journal Entries and Reports
Each of these is a skill, called as archie.skills.<name>(...). The call returns the server's reply as a dict, with the skill's result under output. To analyse a file, upload it first and pass the id it returns: a str is a path, and bytes take filename= so Archie can tell the type.
up = archie.files.upload("contract.pdf")
analysis = archie.skills.analyse_document(file_id=up.file_id, analysis_type="summarize")
pack = archie.skills.prepare_cfo_pack(client_id="<client id>", period="2026-06", output_format="pdf")
entry = archie.skills.record_journal_entry(
client_id="<client id>",
entries=[
{"account_code": "1000", "debit": "100.00", "credit": "0"},
{"account_code": "4000", "debit": "0", "credit": "100.00"},
],
entry_date="2026-06-30",
)
print(analysis["output"], pack["output"], entry["output"])Search, Standards and Drafts
These are skills too. Each call returns the skill's reply as a dict.
found = archie.skills.search_knowledge(query="ASC 606 lease", sources=["standards"], jurisdiction="US")
research = archie.skills.research_standards(
topic="revenue recognition",
standard_references=["ASC 606"],
jurisdiction="US",
mode="research",
)
draft = archie.skills.prepare_communication(
type="email",
recipients=["[email protected]"],
subject="Q1 BAS",
context="Remind about the BAS",
tone="professional",
)Beside messages, skills and files, the client has conversations, triggers, and keys, which lists, creates, updates, rotates and revokes your API keys. Calls wait up to 920 seconds by default; pass timeout= in seconds to change it.
Handle Errors by Type
A call that fails raises a typed error. Every one is an ArchieError carrying status and request_id; a rate limit carries retry_after, in seconds, from the Retry-After header.
import time
import heyarchie
try:
message = archie.messages.create("Summarise the BAS for Q1 2026")
except heyarchie.ArchieRateLimitError as err:
time.sleep(err.retry_after or 60)
except heyarchie.ArchieError as err:
print(err.status, err.request_id)Which Error, for Which Answer
The key is missing, wrong or revoked.
The key may not do this, or no workspace was named.
Nothing is there.
Too many calls. Wait retry_after seconds.
And the Rest
The request was refused as written.
It conflicts with the current state. ArchieIdempotencyError is the kind raised for an idempotency key still in use.
It has expired or been retired.
A failure on our side. Retry later.
ArchieConfigError means the client could not be set up: no host, both a host and a region, or no workspace it can choose. ArchieTimeoutError means a call waited longer than its timeout.
Use Archie Skills as Agent Tools
The client turns Archie's skills into native tools for LangGraph and LangChain, or the OpenAI Agents SDK. The tools call Archie with your key, name your workspace, and raise the same typed errors. scope= keeps only the skills whose permission matches. heyarchie.adapters.as_langchain_tools does the same for LangChain on its own.
import heyarchie archie = heyarchie.Archie(api_key="sk_...", base_url="https://uk.heyarchie.com") tools = archie.skills.as_langgraph_tools(scope="topics:read") # LangGraph and LangChain tools = archie.skills.as_openai_tools(scope="topics:read") # OpenAI Agents SDK
Archie answers a skill or a message with one complete reply, so there is no streaming call. messages.create(..., stream=True) raises ValueError.
sandbox=True raises ArchieConfigError: there is no sandbox. Isolation in Archie is per workspace. Create a throwaway workspace, issue a key scoped to it, and point the SDK at that key.