Skip to main content

Official Python SDK for Arkna — AI agent evidence

Project description

arkna

Official Python SDK for ARKNA — AI agent observability and incident intelligence.

ARKNA records every run, step, and tool call your AI agents make, with full context and hash-chained integrity. When something goes wrong, replay the exact run and see what the agent knew at each step.

Installation

pip install arkna

With framework extras:

pip install arkna[langchain]    # LangChain integration
pip install arkna[crewai]       # CrewAI integration
pip install arkna[autogen]      # AutoGen integration

Quick Start

Auto-instrumentation (recommended)

Two lines. All OpenAI and Anthropic calls are captured automatically.

from arkna import init

init(api_key="ark_live_...", agent_name="my-agent")

# Your existing code — no changes needed
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello"}],
)
# ^ This call is automatically recorded by ARKNA

Or via environment variables (no code changes at all):

export ARKNA_API_KEY=ark_live_...
export ARKNA_AGENT_NAME=my-agent
from arkna import init
init()

Manual instrumentation

For full control over what gets recorded:

from arkna import ArknaClient

client = ArknaClient(api_key="ark_live_...", agent_name="my-agent")

run = client.start_run(trigger_type="api", input={"query": "refund policy"})

client.record_step(run["run_id"],
    step_type="reasoning",
    input="User asked about refund policy",
    output="Found 3 relevant documents",
)

client.record_tool_call(run["run_id"],
    tool_name="search_docs",
    input={"query": "refund"},
    output={"results": 3},
    status="success",
)

client.complete_run(run["run_id"], status="completed")

Framework Integrations

LangChain

from arkna import init, ArknaLangChainHandler

init(api_key="ark_live_...", agent_name="my-langchain-agent")
handler = ArknaLangChainHandler()

# Pass as callback to any LangChain chain/agent
result = chain.invoke({"input": "hello"}, config={"callbacks": [handler]})

CrewAI

from arkna import init, ArknaCrewAIHandler

init(api_key="ark_live_...", agent_name="my-crew")
handler = ArknaCrewAIHandler()

AutoGen

from arkna import init, ArknaAutoGenHandler

init(api_key="ark_live_...", agent_name="my-autogen-team")
handler = ArknaAutoGenHandler()

Configuration

Environment Variable Description
ARKNA_API_KEY API key (ark_live_...)
ARKNA_AGENT_NAME Agent name for identification
ARKNA_URL API endpoint (default: https://api.arkna.com.au)

Requirements

  • Python >= 3.9
  • requests >= 2.28

License

MIT

Project details


Download files

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

Source Distribution

arkna-4.0.0.tar.gz (36.9 kB view details)

Uploaded Source

Built Distribution

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

arkna-4.0.0-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file arkna-4.0.0.tar.gz.

File metadata

  • Download URL: arkna-4.0.0.tar.gz
  • Upload date:
  • Size: 36.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for arkna-4.0.0.tar.gz
Algorithm Hash digest
SHA256 97397937f1d5c7af5dbc7085344768d09adcad9e8369a00f46fd88ce4d1d359c
MD5 a8bf2f87134cc76d90104f0be47fae1a
BLAKE2b-256 d15ed062852b8037ed0b337ff0a4302dd6396db5c934c9ff56bcdf1d02436225

See more details on using hashes here.

Provenance

The following attestation bundles were made for arkna-4.0.0.tar.gz:

Publisher: publish-pypi.yml on chengwhk/arkna-local

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arkna-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: arkna-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 35.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for arkna-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f747eed556b1be9eb470ac3534c0bbef9a0731c02ad45777ffff484d898201bd
MD5 757343eadd5b378ac95a16a6ae06aa30
BLAKE2b-256 e7d15e3c30bbedfe8fef50b7d7c0f7dec57e69d29f86f910837f469fd9ff9e3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for arkna-4.0.0-py3-none-any.whl:

Publisher: publish-pypi.yml on chengwhk/arkna-local

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page