# Call Archie From Your Own Code

> Call Archie from your own code with the heyarchie Python SDK or TypeScript client: typed skill methods, typed errors and framework adapters.

Use the Python SDK or the TypeScript client to call Archie from your own code. Both speak to the same Archie your clients already talk to, over the same Connect API.

The per-skill surface is generated from the canonical skill registry, so it tracks the live catalogue. Prefer nothing to install? The REST API and the OpenAPI 3.1 spec reach every skill from any language.

Install

## Install the Client

Python needs 3.10 or newer and ships on PyPI as heyarchie, with the archie CLI in the same package. The TypeScript client needs Node 20 or newer and ships on npm as heyarchie too. It is an ES module, so use import, not require.

```
python3 -m venv .venv
source .venv/bin/activate
pip install heyarchie
```

```
npm install heyarchie
```

Release status

Current releases: heyarchie 2.1.0 on PyPI (the Python SDK and the archie CLI) and heyarchie 3.1.0 on npm (the TypeScript client).

Authenticate

## Create a Client

Pass your key: api_key in Python, apiKey in TypeScript. Keys start with sk_. The TypeScript client also reads ARCHIE_API_KEY from the environment; the Python client does not, so pass the key yourself. Then name your region: environment="uk" in Python, environment: "uk" in TypeScript, or ARCHIE_ENVIRONMENT=uk for either. A full address works too: base_url in Python, baseURL in TypeScript, or ARCHIE_API_URL. There is no default address, so with none of these both clients stop with an error that lists the regions.

```
from heyarchie import Archie

archie = Archie(api_key="sk_...", environment="uk")
# or give the address:
archie = Archie(api_key="sk_...", base_url="https://uk.heyarchie.com")
# or set ARCHIE_ENVIRONMENT=uk (or ARCHIE_API_URL) and pass only the key
```

```
import { Archie } from "heyarchie";

const archie = new Archie({
  apiKey: "sk_...",     // or set ARCHIE_API_KEY and omit
  environment: "uk",    // or baseURL: "https://uk.heyarchie.com"; or set ARCHIE_ENVIRONMENT or ARCHIE_API_URL and omit
});
```

Configuration

## Client Options

apiKey / api_key

string

Your Connect key (sk_*). TypeScript falls back to the ARCHIE_API_KEY environment variable. Python requires it.

baseURL

string · optional

Your region's address, such as https://uk.heyarchie.com. There is no default: without baseURL or environment the client reads ARCHIE_API_URL, then ARCHIE_ENVIRONMENT, and throws if neither is set. Note the capital URL: an unknown key such as baseUrl is silently ignored.

environment

string · optional

Your region's name: uk, us, au or ca, used instead of baseURL. Passing both throws. Falls back to ARCHIE_ENVIRONMENT.

timeoutMs

number · optional

Per-request timeout in milliseconds. Defaults to 920000.

fetch

function · optional

Overrides the global fetch, for tests or custom retry.

Typed skill methods

## One Method per Skill

Every public skill is a typed method: on client.skills in Python, and on archie.skills.generated in TypeScript as camelCase of the slug. Each delegates to skills.invoke(), so the wire format is unchanged, and skills.invoke() still calls any skill by slug.

```
from heyarchie import Archie

client = Archie(api_key="sk_...", base_url="https://uk.heyarchie.com")

# List topics: typed kwargs, no JSON body to assemble
topics = client.skills.topic_list(limit=5)

# Create one
client.skills.topic_create(name="FY26 audit, Acme", type="client")

# Advisory skills are typed too
advice = client.skills.advise_tax(
    topic="CGT discount on an active asset",
    jurisdiction="AU",
)
```

```
// One typed method per skill — camelCase of the slug
const topics = await archie.skills.generated.topicList({ limit: 5 });

await archie.skills.generated.topicCreate({
  name: "FY26 audit — Acme",
  type: "client",
});

const advice = await archie.skills.generated.adviseTax({
  topic: "CGT discount on an active asset",
  jurisdiction: "AU",
});
```

Errors

## Handle Errors by Type

Non-2xx responses raise typed errors decoded from the canonical error envelope, each with a request id. Both clients retry a 429 once on their own: Python waits for Retry-After (one second if it is missing, never more than 60), and TypeScript retries only when Retry-After is 60 seconds or less.

```
from heyarchie import (
    ArchieAuthError,         # 401, invalid or revoked key
    ArchiePermissionError,   # 403, key lacks permission
    ArchieRateLimitError,    # 429, includes retry_after (seconds, or None)
    ArchieNotFoundError,     # 404
    ArchieAPIError,          # 5xx
)

try:
    reply = archie.skills.invoke("ask_archie", query="...")
except ArchieRateLimitError as e:
    time.sleep(e.retry_after or 60)
except ArchieAPIError as e:
    log.exception("archie call failed", extra={"request_id": e.request_id})
```

```
import {
  ArchieAuthError,         // 401, invalid or revoked key
  ArchiePermissionError,   // 403, key lacks permission
  ArchieNotFoundError,     // 404
  ArchieIdempotencyError,  // 409, idempotency conflict
  ArchieRateLimitError,    // 429, check detail.retry_after_seconds
  ArchieAPIError,          // 5xx
  ArchieError,             // base class
} from "heyarchie";

try {
  await archie.skills.invoke("ask_archie", { query: "..." });
} catch (err) {
  if (err instanceof ArchieRateLimitError) {
    const wait = err.detail.retry_after_seconds ?? 60;
    // back off
  } else if (err instanceof ArchieError) {
    console.error(err.detail.code, err.detail.message, err.requestId);
  } else {
    throw err;
  }
}
```

Resources

## What the Client Covers

WorkStreams are run through the workstream skills and the Python command line.

Skills

Invoke any skill in the registry, generic or typed, including search, drafting, document analysis, standards research and reports.

Messages

A convenience alias for the ask_archie skill.

Conversations

List and read conversations. TypeScript can also start one.

Files

Upload a file for a skill to analyse. Python and TypeScript.

Keys

Create, rotate and revoke your own API keys. Python only.

Triggers

List, create and manage triggers. Python and TypeScript.

Framework adapters

## Use Archie Skills as Agent Tools

One line turns Archie skills into native tools in LangGraph, LangChain or the OpenAI Agents SDK. The adapter fetches the live registry at call time, and scope= filters to skills whose permission prefix matches, the same names as API key permissions, such as ask:execute.

```
from heyarchie.adapters.langgraph import as_langgraph_tools
from langchain_anthropic import ChatAnthropic

# Standalone function
tools = as_langgraph_tools(api_key="sk_...", base_url="https://uk.heyarchie.com", scope="ask:execute")
model = ChatAnthropic(model="claude-sonnet-5-5").bind_tools(tools)

from heyarchie import Archie

# Or via the client
archie = Archie(api_key="sk_...", base_url="https://uk.heyarchie.com")
tools = archie.skills.as_langgraph_tools(scope="ask:execute")
```

```
from heyarchie.adapters.openai_agents import as_openai_tools
from agents import Agent, Runner

tools = as_openai_tools(api_key="sk_...", base_url="https://uk.heyarchie.com", scope="ask:execute")
agent = Agent(
    name="Archie Tax Advisor",
    instructions="Expert accounting assistant.",
    tools=tools,
)
result = Runner.run_sync(agent, "What is the BAS for Q1 2026?")
print(result.final_output)
```

Next

### API Reference

Every endpoint the SDKs call under the hood.

### CLI

The archie command line, installed on your PATH.

### Tool Catalogue

Everything Archie can run, marked read-only or write.

### Quickstart

Connect a client and make your first call.

On this page

[Install the Client](https://heyarchie.com/en-gb/developers/sdk/#s-install)[Create a Client](https://heyarchie.com/en-gb/developers/sdk/#s-authenticate)[Client Options](https://heyarchie.com/en-gb/developers/sdk/#s-configuration)[One Method per Skill](https://heyarchie.com/en-gb/developers/sdk/#s-typed-skill-methods)[Handle Errors by Type](https://heyarchie.com/en-gb/developers/sdk/#s-errors)[What the Client Covers](https://heyarchie.com/en-gb/developers/sdk/#s-resources)[Use Archie Skills as Agent Tools](https://heyarchie.com/en-gb/developers/sdk/#s-framework-adapters)
