用治理视角检查租约
对您发送的数据运行已安装的视角,读取其发现,并保留带摘要的已存储结果。
lenses.run
对您发送的数据运行已安装的视角,读取其发现,并保留带摘要的已存储结果。
lenses.run您有租约、授权或一些文本,想对它们应用一条固定规则。视角是确定性的,不使用模型,只看到您发送的数据。
代码从 INTRAMEDIAL_KEY 读取密钥。请把它放在您的 shell 或密钥存储中,切勿放进要提交的文件。需要已登录用户的调用不能使用密钥:这些调用由控制台发起。
发送 installId 和 input;对 lease_overlap 来说,它是一个租约列表。
lenses.runlenses-runcurl -sS -X POST https://api.intramedial.com/api/v1/acp/lenses/run \
-H "Authorization: Bearer $INTRAMEDIAL_KEY" \
-H "Content-Type: application/json" \
-d '{
"installId": "install_7c2e",
"input": {
"leases": [
{
"id": "l1",
"resource": "repo:payments/main",
"holder": "did:web:acme.example:agent:billing",
"start": "2026-11-01T09:00:00Z",
"end": "2026-11-01T10:00:00Z"
},
{
"id": "l2",
"resource": "repo:payments/main",
"holder": "did:web:acme.example:agent:refunds",
"start": "2026-11-01T09:30:00Z",
"end": "2026-11-01T10:30:00Z"
}
]
}
}'const res = await fetch("https://api.intramedial.com/api/v1/acp/lenses/run", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.INTRAMEDIAL_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
installId: "install_7c2e",
input: {
leases: [
{
id: "l1",
resource: "repo:payments/main",
holder: "did:web:acme.example:agent:billing",
start: "2026-11-01T09:00:00Z",
end: "2026-11-01T10:00:00Z",
},
{
id: "l2",
resource: "repo:payments/main",
holder: "did:web:acme.example:agent:refunds",
start: "2026-11-01T09:30:00Z",
end: "2026-11-01T10:30:00Z",
},
],
},
}),
});
console.log(res.status, await res.json());import os, requests
res = requests.post(
"https://api.intramedial.com/api/v1/acp/lenses/run",
headers={"Authorization": "Bearer " + os.environ["INTRAMEDIAL_KEY"]},
json={
"installId": "install_7c2e",
"input": {
"leases": [
{
"id": "l1",
"resource": "repo:payments/main",
"holder": "did:web:acme.example:agent:billing",
"start": "2026-11-01T09:00:00Z",
"end": "2026-11-01T10:00:00Z",
},
{
"id": "l2",
"resource": "repo:payments/main",
"holder": "did:web:acme.example:agent:refunds",
"start": "2026-11-01T09:30:00Z",
"end": "2026-11-01T10:30:00Z",
},
],
},
},
timeout=30,
)
print(res.status_code, res.json())无发现时 status 为 pass,否则为 fail。每个发现都有 code、message 和 path,证据会指明两个租约。同一规则作用于同一输入,得到同一 digest。
{
"result": {
"id": "result_3f9a",
"installId": "install_7c2e",
"definitionId": "lens_builtin_lease_overlap",
"version": 1,
"definitionDigest": "sha256:5b1d0c9e7a42",
"inputDigest": "sha256:e07a93b1c6d8",
"status": "fail",
"findings": [{ "code": "lease.overlap", "message": "overlapping leases for repo:payments/main", "path": "$.leases" }],
"evidence": [{ "kind": "lease_overlap", "path": "$.leases", "detail": { "resource": "repo:payments/main", "left": "l1", "right": "l2" } }],
"digest": "sha256:a2c4e8f016b3",
"executedAt": "2026-11-01T09:12:00.000Z"
}
}结果会被存储。results 按 resultId 返回它,或列出某个安装的所有结果。
内容复制自: /docs/lenses-run
账本仅可追加,并封存在 Merkle 根之下。条目上的时间取自 Intramedial 自己的时钟,签名包可用已发布的公钥离线核查。
/docs/detection-run用 apply: false 编译授权,读取它将产生的授予内容及其 previewDigest,然后精确应用您所预览的内容。
mandates.compile列出检测器,运行 lease-overlap,读取它所引用的冲突及其证据,然后读取它为审查而提交的案件。
detection.run用 coordination.lease 对某个资源获取独占租约,查看持有者,并在用完后释放。
coordination.lease当我们向实用示例中添加新示例时,会发送一封简短的邮件。不会发送其他任何邮件,而且您可以从任意一封邮件中退订。
完全无需账户:在 7 天之内可以在各个 attest 路由上调用 35 次,所生成的回执都会被标记为测试回执。当您想继续使用时,再注册账户即可。