Skip to main content

licos-platform-sdk

LICOS 项目服务端 SDK,提供项目数据库、对象存储、企业知识库、本体和 OAuth 等平台能力。

当前使用者信息(0.6.1 起)

from licos_platform_sdk import get_current_user

# token 是当前请求的用户 Bearer Token,不包含 "Bearer " 前缀。
sys_user = get_current_user(user_token=token)
print(sys_user["displayName"])
print(sys_user["departments"])
print(sys_user["primaryPosition"])

返回对象与低代码系统变量 sys_user 相同,保留平台的 camelCase 字段名: id、username、displayName、avatarUrl、tenantId、tenantName、 primaryDepartment、departments、organizationAssignments、primaryPosition、primaryJobTitle。 部门包含 ID、名称、组织路径、ID 路径及主部门标志;组织任职包含岗位、职务和部门负责人标志。

SDK 自动读取 LICOS_PLATFORM_API_BASE_URL、LICOS_AI_AGENT_TOKEN 和项目工作空间。 workspace_id 可由服务端指定执行工作空间;默认依次读取 LICOS_WORKSPACE_ID、 LICOS_OWNER_WORKSPACE_ID、AGENT_WORKSPACE_ID。企业按执行工作空间确定,与低代码一致。 无企业时企业字段为 None;未加入执行企业的使用者,部门和任职为空,不能返回项目所有者的信息。

多用户服务每次传入当前请求的 Token。智能体/工作流可传 ctx.identity.user_token; 在异步节点中使用 await asyncio.to_thread(get_current_user, user_token=token)。 结果不做全局缓存。Token 无效时直接报错,由调用方处理登录失效。

从 0.7.0 起必须显式传入 user_token。LICOS_CURRENT_USER_ID 只是容器初始化用户,不能代表网页登录者。 本接口仅供服务端使用;LICOS_AI_AGENT_TOKEN 不得发送到浏览器。

身份选择(0.7.0 起)

企业知识库所有方法以及本体 search_tools、resolve_tool、invoke_tool、subscribe_realtime 必须传 user_token=token。普通 knowledge 方法可选传该参数,不传时使用项目身份。数据库、对象存储、OAuth 应用管理继续使用项目身份。

from licos_platform_sdk import enterprise_knowledge, knowledge, ontology

resources = enterprise_knowledge.tree(user_token=token)
catalog = ontology.search_tools('设备状态', user_token=token)
result = knowledge.search('资料', user_token=token)

Token 失效直接返回鉴权错误,由调用方更新登录凭证。实时订阅用原 Token 重连并重新检查权限,401/403 终止。独立 CLI 才按 LICOS_CURRENT_USER_ID 换 Token,SDK 不自动选择容器用户。完整接口分类见仓库 tools/IDENTITY.md。

Metadata

Release files for licos-platform-sdk 0.7.0

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

Source distribution (sdist)

Source distribution for licos-platform-sdk 0.7.0
File Size Uploaded
licos_platform_sdk-0.7.0.tar.gz 46.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for licos-platform-sdk 0.7.0
File Interpreter ABI Platform
licos_platform_sdk-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 87.2 kB

Release files / licos_platform_sdk-0.7.0.tar.gz

Download URL licos_platform_sdk-0.7.0.tar.gz
Size 46.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ae97305de405cb53a61598c4fe6f5596482027251051259dece63b2756bb89e0
BLAKE2b-256 checksum
How to use checksums
45131743cfabc589dcf252c9aa8443c345c71d86e2e00395f37f3025ef6f8668
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / licos_platform_sdk-0.7.0-py3-none-any.whl

Download URL licos_platform_sdk-0.7.0-py3-none-any.whl
Size 41.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1802d00b979ae8f771bb0d0e370f3d9f9b2a35be1116808ab503a9e836943d2a
BLAKE2b-256 checksum
How to use checksums
bbda07f63d5d66314a6ee42ead609f67d2eb618e2b596ec27a5ef7e55d519752
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

This release

0.7.0 This release

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.0

2 release files

0.1.0

2 release files

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