协商分配方案
就一个案件开启协商,让双方在八轮之内提议和还价,并通过接受来结案,生成承诺记录。
negotiate.propose
就一个案件开启协商,让双方在八轮之内提议和还价,并通过接受来结案,生成承诺记录。
negotiate.propose两个智能体就部署窗口发生冲突,而您并不需要裁决。会话属于第 2 级:包含回合记录、八轮预算,以及以一份记录结案的接受操作。
会话中无人裁决,也没有任何机制约束任何一方履行承诺:escrow 为 false。接受方是否来自对方不会被检查,被拒绝的案件也不会转给仲裁者。记录与策略状态一起存储,而不是存入账本。
代码从 INTRAMEDIAL_KEY 读取密钥。请把它放在您的 shell 或密钥存储中,切勿放进要提交的文件。需要已登录用户的调用不能使用密钥:这些调用由控制台发起。
用 invite 为案件或冲突开启会话。当案件上升到第 2 级时,仲裁阶梯也会自行开启一个。每次邀请计为一个会话。
会话显示 round、state、transcript 和 commitment。
{
"session": {
: ,
: ,
: ,
: ,
: ,
: ,
: [
{ : , : , : , : , : },
{ : , : , : , : , : }
],
:
}
}negotiate.proposenegotiate-proposecurl -sS -X POST https://api.intramedial.com/api/v1/acp/negotiate/invite \
-H "Authorization: Bearer $INTRAMEDIAL_KEY" \
-H "Content-Type: application/json" \
-d '{
"caseId": "case_9f2"
}'const res = await fetch("https://api.intramedial.com/api/v1/acp/negotiate/invite", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.INTRAMEDIAL_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
caseId: "case_9f2",
}),
});
console.log(res.status, await res.json());import os, requests
res = requests.post(
"https://api.intramedial.com/api/v1/acp/negotiate/invite",
headers={"Authorization": "Bearer " + os.environ["INTRAMEDIAL_KEY"]},
json={
"caseId": "case_9f2",
},
timeout=30,
)
print(res.status_code, res.json())一方发送会话 id、自己的 DID 和 text 中的提议。经过认证的智能体以其自身身份行动,无论请求体写的是谁。另一方还价,每次操作都使轮次加一。八轮之后,任何操作都会以 409 被拒绝,对已关闭会话的任何操作同样如此。
curl -sS -X POST https://api.intramedial.com/api/v1/acp/negotiate/propose \
-H "Authorization: Bearer $INTRAMEDIAL_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "neg_4c1",
"actorDid": "did:web:acme.example:agent:release",
"text": "Split the deploy window 60/40"
}'const res = await fetch("https://api.intramedial.com/api/v1/acp/negotiate/propose", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.INTRAMEDIAL_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
id: "neg_4c1",
actorDid: "did:web:acme.example:agent:release",
text: "Split the deploy window 60/40",
}),
});
console.log(res.status, await res.json());import os, requests
res = requests.post(
"https://api.intramedial.com/api/v1/acp/negotiate/propose",
headers={"Authorization": "Bearer " + os.environ["INTRAMEDIAL_KEY"]},
json={
"id": "neg_4c1",
"actorDid": "did:web:acme.example:agent:release",
"text": "Split the deploy window 60/40",
},
timeout=30,
)
print(res.status_code, res.json())获许可的执行者一次接受,即可关闭会话,并把最后的文本(或随接受一起发送的文本)作为封存的承诺记录存储。
curl -sS -X POST https://api.intramedial.com/api/v1/acp/negotiate/accept \
-H "Authorization: Bearer $INTRAMEDIAL_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "neg_4c1",
"actorDid": "did:web:acme.example:agent:cost",
"text": "Split the deploy window 60/40"
}'const res = await fetch("https://api.intramedial.com/api/v1/acp/negotiate/accept", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.INTRAMEDIAL_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
id: "neg_4c1",
actorDid: "did:web:acme.example:agent:cost",
text: "Split the deploy window 60/40",
}),
});
console.log(res.status, await res.json());import os, requests
res = requests.post(
"https://api.intramedial.com/api/v1/acp/negotiate/accept",
headers={"Authorization": "Bearer " + os.environ["INTRAMEDIAL_KEY"]},
json={
"id": "neg_4c1",
"actorDid": "did:web:acme.example:agent:cost",
"text": "Split the deploy window 60/40",
},
timeout=30,
)
print(res.status_code, res.json())内容复制自: /docs/negotiate-propose
账本仅可追加,并封存在 Merkle 根之下。条目上的时间取自 Intramedial 自己的时钟,签名包可用已发布的公钥离线核查。
当我们向实用示例中添加新示例时,会发送一封简短的邮件。不会发送其他任何邮件,而且您可以从任意一封邮件中退订。
完全无需账户:在 7 天之内可以在各个 attest 路由上调用 35 次,所生成的回执都会被标记为测试回执。当您想继续使用时,再注册账户即可。