Skip to main content

atlanai

Python SDK for the Atlan Agent Gateway: manage agents, skills, sessions, and workspaces, and optionally trace what your agents do.

Install

pip install atlanai

Tracing is a separate extra — it pulls in OpenTelemetry, which a management-only install doesn't need:

pip install 'atlanai[tracing]'

Quickstart

from atlanai import AtlanClient

client = AtlanClient(
    "https://<your-gateway-host>",
    bearer_token="<your-api-token>",
)

agent = client.agents.create({
    "name": "support-triage",
    "workspace_id": "workspace_01example",
})

page = client.agents.list(limit=10)
print(f"{len(page.items)} agents")

Methods read as client.<resource>.<action>client.agents.get(agent_id), client.sessions.messages.create(session_id, {...}), and so on. Every public Agent Gateway operation is reachable this way; nothing requires reaching into a generated client directly.

Pass a default workspace once instead of repeating it on every call:

client = AtlanClient(gateway_url, bearer_token=token, workspace="workspace_01example")

Run an eval

Eval() executes the task and scorers, creates the Registry experiment, emits one trace per case, uploads trace-linked results, and finalizes the run. Registry derives the durable score summary during that finalization:

from atlanai import Eval


def accuracy(*, output: str, expected: str, **_):
    return float(output == expected)


result = Eval(
    "Anthropic Evaluation",
    data=lambda: [
        {"input": "What is 2+2?", "expected": "4"},
        {"input": "What is the capital of France?", "expected": "Paris"},
    ],
    task=call_model,
    scores=[accuracy],
)

print(result.experiment_id)

Set ATLAN_API_KEY and ATLAN_WORKSPACE_ID. Use await async_eval(...) in an async application. Replace inline data with dataset="dataset_..." or one exact Registry dataset name. After flushing, the runner reads every case trace back through the experiment filter before it uploads results; a missing trace marks the experiment failed.

Control an eval lifecycle directly

Resolve an existing dataset by artifact ID or exact name, then create the Registry experiment before another runner emits any traces:

from atlanai import ContextItem, ContextManifest, start_experiment

context = ContextManifest([
    ContextItem(
        kind="file",
        name="CLAUDE.md",
        version="git:0123456789abcdef0123456789abcdef01234567",
        digest="sha256:" + "0" * 64,
    ),
])

run = start_experiment(
    client,
    "conversational-studio-daily",  # exact name, or dataset_... ID
    {"name": "candidate-run", "config": {"model": "example-model"}},
    context_manifest=context,
)

with run.trace():
    output = existing_runner()

run.experiment is the generated create response and run.id is its experiment_id. The helper pins the resolved dataset version and context manifest in the immutable experiment config. run.trace() stamps the experiment join and context-manifest digest on spans. Use it when another harness owns execution, result upload, and finalization.

Tracing

from atlanai.tracing import auto_instrument, current_span, init_logger, traced

auto_instrument()
logger = init_logger(project="support-agent")


@traced(name="handle-request", type="task")
def handle_request(input: str):
    output = call_model(input)
    current_span().log(input=input, output=output)
    return output


handle_request("hello")
logger.flush()

auto_instrument() discovers installed AI OpenTelemetry instrumentors. Call it before importing provider clients. Tracing has its own lifecycle and does not reuse the management client's transport.

See evals and tracing for framework setup, context manifests, async delivery, and the tested integration matrix.

Errors

Every non-2xx response raises AtlanAPIError, with .status, .code, and (where the gateway includes one) .trace_id:

from atlanai import AtlanAPIError

try:
    client.agents.get("agent_does_not_exist")
except AtlanAPIError as error:
    print(error.status, error.code)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atlanai-0.2.2.tar.gz (693.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

atlanai-0.2.2-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

File details

Details for the file atlanai-0.2.2.tar.gz.

File metadata

  • Download URL: atlanai-0.2.2.tar.gz
  • Upload date:
  • Size: 693.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for atlanai-0.2.2.tar.gz
Algorithm Hash digest
SHA256 d2911c3a50983e8ef79a901cca5bed4fd930cdb9845da45dbe63492053394f1d
MD5 a3666b2aba242860f6e77116b6991667
BLAKE2b-256 2d9b591ffc90afd1ee8f4d6e6079c8e362e9be1b0c911bafc753aee65e085527

See more details on using hashes here.

File details

Details for the file atlanai-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: atlanai-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for atlanai-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1ea3934b5348eda1834a187e550d7ee959551e1edf7794f9504f00b32d5b545f
MD5 aff3d37f81dadeeeee96c1cda3cc077a
BLAKE2b-256 ca70817780f9ad88b3687e1200bf91efa8532c3565653f8cfc4aae88b12ac1bd

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.3

2 files

This release

0.2.2 This release

2 files

0.2.1

2 files

0.1.1

2 files

0.1.0

2 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