Skip to main content

Python SDK for Rare Identity agent flows

Project description

rare-agent-sdk-python

Python SDK and CLI for Agent identity flows on Rare.

当前 SDK 的本地 Python 依赖只包含 rare-identity-protocol,不再依赖整个 rare-identity-core 服务包。

Features

  • Self register (hosted-signer or self-hosted)
  • Set name (signed)
  • Refresh public attestation
  • Full attestation issue for registered platform
  • Human-in-the-loop upgrades (L1 email magic link, L2 social connect)
  • Challenge login via third-party platform
  • Delegation/session/action signing via hosted Rare signer or local self-hosted key
  • Self-hosted private key stored in separate key file (~/.config/rare/keys/<agent_id>.key, mode 0600)
  • Optional local signer daemon (rare-signer) so SDK process signs via IPC without loading private key

Install

pip install rare-agent-sdk

可复现依赖安装:

pip install -r requirements-test.lock
pip install -e .[test] --no-deps

工作区本地开发仍可使用:

(cd ../rare-identity-protocol-python && pip install -e .)
pip install -e .[test]

Local Run Prerequisite

先启动 core API:

(cd ../rare-identity-core && uvicorn rare_api.main:app --reload --host 127.0.0.1 --port 8000)

CLI 默认 --rare-urlhttp://127.0.0.1:8000(无需额外加 /rare 前缀)。

CLI

# terminal A: start local signer
rare-signer

# terminal B: self-hosted register/login via signer IPC
rare register --name alice
rare register --name alice --key-mode self-hosted
rare request-upgrade --level L1 --email alice@example.com
# send magic link (local stub returns token)
rare upgrade-status --request-id <request_id>
rare request-upgrade --level L2
rare start-social --request-id <request_id> --provider github
rare issue-full-attestation --aud platform
rare login --aud platform --platform-url http://127.0.0.1:8000/platform
rare login --aud platform --public-only
rare set-name --name alice-v2
rare refresh-attestation
rare show-state

SDK

from rare_agent_sdk import AgentClient, AgentState

state = AgentState()
client = AgentClient(state=state)
client.register(name="agent-1")
upg = client.request_upgrade_l1(email="owner@example.com")
sent = client.send_l1_upgrade_magic_link(request_id=upg["upgrade_request_id"])
client.verify_l1_upgrade_magic_link(token=sent["token"])
client.login(aud="platform")
signed = client.sign_platform_action(action="post", action_payload={"content": "hello"})

Test

pytest -q

Related Docs

  • 工作区总览:../Rare.md
  • RIP 文档索引:../rare-identity-core/docs/RIP_INDEX.md
  • 平台接入规范:../rare-identity-core/docs/rip-0005-platform-onboarding-and-events.md

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

rare_agent_sdk-0.1.0.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

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

rare_agent_sdk-0.1.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file rare_agent_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: rare_agent_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rare_agent_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 47662e00c3f335fa45743546aeb0e8cd8e792edd6bb5e8ff4c589d5114b050a5
MD5 8ce887e2d375fcfd69f6b935d3354d61
BLAKE2b-256 27854d2f7959a505f6f48c747ac5a07a8e1f88e3f3c10bcc90b8ee875ff39010

See more details on using hashes here.

Provenance

The following attestation bundles were made for rare_agent_sdk-0.1.0.tar.gz:

Publisher: publish-python-packages.yml on Rare-Sors/Rare

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

File details

Details for the file rare_agent_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rare_agent_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rare_agent_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 525b882031d734d687f5121e36170715fcf3a5f9adb59cae902468aa0fc7fe79
MD5 7eea7096fec8344dd057301f275bbb4a
BLAKE2b-256 a32fabf44447389e613c986ebf5292bc0a01215a9004d88e27914c3fc6853fe0

See more details on using hashes here.

Provenance

The following attestation bundles were made for rare_agent_sdk-0.1.0-py3-none-any.whl:

Publisher: publish-python-packages.yml on Rare-Sors/Rare

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