Skip to main content

ArkClaw Invoke SDK

License Python a2a

English | 简体中文

Python client for a2a v0.3, the open JSON-RPC protocol for invoking remote agents.

The SDK is framework-neutral: it implements the wire protocol and nothing else. Any runtime that exposes an a2a endpoint (OpenClaw, VeADK, LangGraph, Pydantic AI, or a custom server) works without adapter code.

Installation

pip install arkclaw-sdk

Optional extras:

pip install "arkclaw-sdk[cli]"     # arkclaw command-line tool
pip install "arkclaw-sdk[otel]"    # OpenTelemetry tracing
pip install "arkclaw-sdk[all]"     # both

Requires Python 3.10 or later. Wire types are Pydantic v2 models; HTTP is handled by httpx.

Usage

import asyncio
from arkclaw import AsyncClient, APIKeyCredential

async def main() -> None:
    async with AsyncClient(
        endpoint="https://my-agent.example.com/a2a/jsonrpc",
        credentials=APIKeyCredential(api_key="ark-..."),
    ) as client:
        result = await client.invoke("Hello, agent!")
        print(result.text)

asyncio.run(main())

A synchronous Client exposes the same interface for code that cannot use asyncio. It shares the async implementation internally and also works when called from inside an already-running event loop.

Streaming

invoke_stream consumes the server's Server-Sent Events stream and yields typed events (Message, Task, TaskStatusUpdateEvent, TaskArtifactUpdateEvent):

async for event in client.invoke_stream("Summarize this repository"):
    ...

Responses and streaming events are validated against the a2a v0.3 wire format; arkclaw test-agent (below) runs the same checks against any endpoint.

Authentication

Credential Grant
APIKeyCredential static API key
OAuthJWTCredential caller-managed bearer token
ClientCredentials OAuth 2.0 client credentials (RFC 6749 §4.4)
AgentKitIdentityCredential OAuth 2.0 with refresh-token grant (RFC 6749 §6)

DefaultCredentialChain resolves credentials from environment variables, following the precedence model familiar from boto3.

For end-user (three-legged) login, arkclaw.auth.AuthorizationCodeFlow implements the OAuth 2.0 authorization-code flow with PKCE (RFC 6749 §4.1, RFC 7636) for integration into a BFF or web backend.

Retries and timeouts

Retry behaviour is configured with RetryConfig. 429, 5xx and network errors are retried with exponential backoff and jitter; authentication and other 4xx errors are not. For streaming, only connection establishment is retried: an open stream is never replayed, so the server cannot receive duplicate tasks.

TimeoutConfig maps to httpx's four timeout phases (connect, read, write, pool) and provides long_running() and disabled() factories.

Tracing

With the otel extra installed, spans follow the OpenTelemetry GenAI semantic conventions. Message content is not recorded unless explicitly enabled via environment variable.

Command-line tool

Installed with the [cli] extra:

arkclaw test-agent <endpoint>    run the a2a v0.3 compliance checks
arkclaw chat <endpoint>          interactive streaming chat
arkclaw login                    browser-based OAuth login (PKCE)
arkclaw whoami                   show the cached identity
arkclaw logout                   remove a cached profile
arkclaw config show|set|unset    manage ~/.arkclaw/credentials profiles
arkclaw version                  print the SDK version

Credentials resolve in order: the --api-key flag, the ARKCLAW_API_KEY environment variable, then the named profile in ~/.arkclaw/credentials.

Documentation

The documentation site is built from docs/ with mkdocs build --strict.

Development

pip install -e ".[dev]"

pytest
ruff check src/ tests/
mypy --strict src/arkclaw
pyright src/arkclaw
mkdocs build --strict

License

Apache 2.0. See LICENSE.

Metadata

Release files for arkclaw-sdk 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arkclaw-sdk 0.1.1
File Size Uploaded Provenance Actions
arkclaw_sdk-0.1.1.tar.gz 112.0 kB Without provenance Details for arkclaw_sdk-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for arkclaw-sdk 0.1.1
File Interpreter ABI Platform Actions
arkclaw_sdk-0.1.1-py3-none-any.whl Python 3 none any Details for arkclaw_sdk-0.1.1-py3-none-any.whl

Total release size: 182.9 kB

Release files / arkclaw_sdk-0.1.1.tar.gz

Download URL arkclaw_sdk-0.1.1.tar.gz
Size 112.0 kB
Tags Source
SHA-256 checksum
How to use checksums
597f2916a47e279cfb3df5d7a89dc10aab35bfd1890e057b2b65894579aeb0c3
BLAKE2b-256 checksum
How to use checksums
b97d4006ecebf7cdd062e96847ca858d6ad55c95f5239ca7fb6cd777bd5503b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Release files / arkclaw_sdk-0.1.1-py3-none-any.whl

Download URL arkclaw_sdk-0.1.1-py3-none-any.whl
Size 71.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23338b810a1cad66e73bcd25887ec5c69b3021bd21059e63c3e9fd80b971b18f
BLAKE2b-256 checksum
How to use checksums
8fef491c7f978d1d283adace472ee43e6fe0a0586b727213aea51175c3dd4ba2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Security for arkclaw-sdk 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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