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-signerorself-hosted) - Set name (signed)
- Refresh public attestation
- Full attestation issue for registered platform
- Human-in-the-loop upgrades (
L1email magic link,L2social 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, mode0600) - 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-url 为 http://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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47662e00c3f335fa45743546aeb0e8cd8e792edd6bb5e8ff4c589d5114b050a5
|
|
| MD5 |
8ce887e2d375fcfd69f6b935d3354d61
|
|
| BLAKE2b-256 |
27854d2f7959a505f6f48c747ac5a07a8e1f88e3f3c10bcc90b8ee875ff39010
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rare_agent_sdk-0.1.0.tar.gz -
Subject digest:
47662e00c3f335fa45743546aeb0e8cd8e792edd6bb5e8ff4c589d5114b050a5 - Sigstore transparency entry: 1057501058
- Sigstore integration time:
-
Permalink:
Rare-Sors/Rare@d6148997cdeeb2fae2dfbb2266de159f8fc7e0f3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Rare-Sors
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-packages.yml@d6148997cdeeb2fae2dfbb2266de159f8fc7e0f3 -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
525b882031d734d687f5121e36170715fcf3a5f9adb59cae902468aa0fc7fe79
|
|
| MD5 |
7eea7096fec8344dd057301f275bbb4a
|
|
| BLAKE2b-256 |
a32fabf44447389e613c986ebf5292bc0a01215a9004d88e27914c3fc6853fe0
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rare_agent_sdk-0.1.0-py3-none-any.whl -
Subject digest:
525b882031d734d687f5121e36170715fcf3a5f9adb59cae902468aa0fc7fe79 - Sigstore transparency entry: 1057501062
- Sigstore integration time:
-
Permalink:
Rare-Sors/Rare@d6148997cdeeb2fae2dfbb2266de159f8fc7e0f3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Rare-Sors
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-packages.yml@d6148997cdeeb2fae2dfbb2266de159f8fc7e0f3 -
Trigger Event:
workflow_dispatch
-
Statement type: