Skip to main content

Official Python SDK for Arkna: AI agent evidence

Project description

arkna

Official Python SDK for Arkna, AI agent evidence: the independent, tamper-evident record of what your AI agents did.

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.2.tar.gz (42.5 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.2-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: arkna-4.0.2.tar.gz
  • Upload date:
  • Size: 42.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.8

File hashes

Hashes for arkna-4.0.2.tar.gz
Algorithm Hash digest
SHA256 4488da0b8afd8755adf0b9a87c793a920b8b8b713c0a8a5b97ff6caca3934a66
MD5 52eecf8ab2eaad7eff5bc5cc6fa15079
BLAKE2b-256 c808934aa69ff945740e73ef5f409a89535f987345b21a34b15702e6d843676f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: arkna-4.0.2-py3-none-any.whl
  • Upload date:
  • Size: 40.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.8

File hashes

Hashes for arkna-4.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 131c5b03cc49606289486a8963e4b85764bccffe492ac52a9b2df1ab135a08ec
MD5 538eafbffccc51bb0eccec605c1f3fc8
BLAKE2b-256 7b13c8cfbc8db98ef1c5c10481e9cfa498f4dec05ae9edec8290be8e6709e1ab

See more details on using hashes here.

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