curl --request POST \
--url https://api.mnemom.ai/v1/agent/sessions/{conversationId}/contract \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contract": {
"statement": "<string>",
"requirements": [
"<string>"
],
"allowed_paths": [
"<string>"
],
"forbidden_paths": [
"<string>"
],
"goal_id": "<string>",
"max_turns": 123,
"budget_usd": 123,
"stall_turns": 123,
"time_limit_s": 2
},
"expected_hash": "<string>",
"expected_version": 123
}
'import requests
url = "https://api.mnemom.ai/v1/agent/sessions/{conversationId}/contract"
payload = {
"contract": {
"statement": "<string>",
"requirements": ["<string>"],
"allowed_paths": ["<string>"],
"forbidden_paths": ["<string>"],
"goal_id": "<string>",
"max_turns": 123,
"budget_usd": 123,
"stall_turns": 123,
"time_limit_s": 2
},
"expected_hash": "<string>",
"expected_version": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contract: {
statement: '<string>',
requirements: ['<string>'],
allowed_paths: ['<string>'],
forbidden_paths: ['<string>'],
goal_id: '<string>',
max_turns: 123,
budget_usd: 123,
stall_turns: 123,
time_limit_s: 2
},
expected_hash: '<string>',
expected_version: 123
})
};
fetch('https://api.mnemom.ai/v1/agent/sessions/{conversationId}/contract', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mnemom.ai/v1/agent/sessions/{conversationId}/contract",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contract' => [
'statement' => '<string>',
'requirements' => [
'<string>'
],
'allowed_paths' => [
'<string>'
],
'forbidden_paths' => [
'<string>'
],
'goal_id' => '<string>',
'max_turns' => 123,
'budget_usd' => 123,
'stall_turns' => 123,
'time_limit_s' => 2
],
'expected_hash' => '<string>',
'expected_version' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mnemom.ai/v1/agent/sessions/{conversationId}/contract"
payload := strings.NewReader("{\n \"contract\": {\n \"statement\": \"<string>\",\n \"requirements\": [\n \"<string>\"\n ],\n \"allowed_paths\": [\n \"<string>\"\n ],\n \"forbidden_paths\": [\n \"<string>\"\n ],\n \"goal_id\": \"<string>\",\n \"max_turns\": 123,\n \"budget_usd\": 123,\n \"stall_turns\": 123,\n \"time_limit_s\": 2\n },\n \"expected_hash\": \"<string>\",\n \"expected_version\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mnemom.ai/v1/agent/sessions/{conversationId}/contract")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contract\": {\n \"statement\": \"<string>\",\n \"requirements\": [\n \"<string>\"\n ],\n \"allowed_paths\": [\n \"<string>\"\n ],\n \"forbidden_paths\": [\n \"<string>\"\n ],\n \"goal_id\": \"<string>\",\n \"max_turns\": 123,\n \"budget_usd\": 123,\n \"stall_turns\": 123,\n \"time_limit_s\": 2\n },\n \"expected_hash\": \"<string>\",\n \"expected_version\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mnemom.ai/v1/agent/sessions/{conversationId}/contract")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contract\": {\n \"statement\": \"<string>\",\n \"requirements\": [\n \"<string>\"\n ],\n \"allowed_paths\": [\n \"<string>\"\n ],\n \"forbidden_paths\": [\n \"<string>\"\n ],\n \"goal_id\": \"<string>\",\n \"max_turns\": 123,\n \"budget_usd\": 123,\n \"stall_turns\": 123,\n \"time_limit_s\": 2\n },\n \"expected_hash\": \"<string>\",\n \"expected_version\": 123\n}"
response = http.request(request)
puts response.read_body{
"conversation_id": "<string>",
"agent": {
"id": "<string>",
"name": "<string>"
},
"org_id": "<string>",
"contract": "<unknown>",
"version": 123,
"hash": "<string>",
"previous_hash": "<string>",
"sealed_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}Owner/admin update of a live Mnemom Agent session's goal contract
Writes a NEW contract version under the SAME goal id into the gateway’s sealed-contract record for conversationId (POST /internal/goal/contract), returning t…
curl --request POST \
--url https://api.mnemom.ai/v1/agent/sessions/{conversationId}/contract \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contract": {
"statement": "<string>",
"requirements": [
"<string>"
],
"allowed_paths": [
"<string>"
],
"forbidden_paths": [
"<string>"
],
"goal_id": "<string>",
"max_turns": 123,
"budget_usd": 123,
"stall_turns": 123,
"time_limit_s": 2
},
"expected_hash": "<string>",
"expected_version": 123
}
'import requests
url = "https://api.mnemom.ai/v1/agent/sessions/{conversationId}/contract"
payload = {
"contract": {
"statement": "<string>",
"requirements": ["<string>"],
"allowed_paths": ["<string>"],
"forbidden_paths": ["<string>"],
"goal_id": "<string>",
"max_turns": 123,
"budget_usd": 123,
"stall_turns": 123,
"time_limit_s": 2
},
"expected_hash": "<string>",
"expected_version": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contract: {
statement: '<string>',
requirements: ['<string>'],
allowed_paths: ['<string>'],
forbidden_paths: ['<string>'],
goal_id: '<string>',
max_turns: 123,
budget_usd: 123,
stall_turns: 123,
time_limit_s: 2
},
expected_hash: '<string>',
expected_version: 123
})
};
fetch('https://api.mnemom.ai/v1/agent/sessions/{conversationId}/contract', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mnemom.ai/v1/agent/sessions/{conversationId}/contract",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contract' => [
'statement' => '<string>',
'requirements' => [
'<string>'
],
'allowed_paths' => [
'<string>'
],
'forbidden_paths' => [
'<string>'
],
'goal_id' => '<string>',
'max_turns' => 123,
'budget_usd' => 123,
'stall_turns' => 123,
'time_limit_s' => 2
],
'expected_hash' => '<string>',
'expected_version' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mnemom.ai/v1/agent/sessions/{conversationId}/contract"
payload := strings.NewReader("{\n \"contract\": {\n \"statement\": \"<string>\",\n \"requirements\": [\n \"<string>\"\n ],\n \"allowed_paths\": [\n \"<string>\"\n ],\n \"forbidden_paths\": [\n \"<string>\"\n ],\n \"goal_id\": \"<string>\",\n \"max_turns\": 123,\n \"budget_usd\": 123,\n \"stall_turns\": 123,\n \"time_limit_s\": 2\n },\n \"expected_hash\": \"<string>\",\n \"expected_version\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mnemom.ai/v1/agent/sessions/{conversationId}/contract")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contract\": {\n \"statement\": \"<string>\",\n \"requirements\": [\n \"<string>\"\n ],\n \"allowed_paths\": [\n \"<string>\"\n ],\n \"forbidden_paths\": [\n \"<string>\"\n ],\n \"goal_id\": \"<string>\",\n \"max_turns\": 123,\n \"budget_usd\": 123,\n \"stall_turns\": 123,\n \"time_limit_s\": 2\n },\n \"expected_hash\": \"<string>\",\n \"expected_version\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mnemom.ai/v1/agent/sessions/{conversationId}/contract")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contract\": {\n \"statement\": \"<string>\",\n \"requirements\": [\n \"<string>\"\n ],\n \"allowed_paths\": [\n \"<string>\"\n ],\n \"forbidden_paths\": [\n \"<string>\"\n ],\n \"goal_id\": \"<string>\",\n \"max_turns\": 123,\n \"budget_usd\": 123,\n \"stall_turns\": 123,\n \"time_limit_s\": 2\n },\n \"expected_hash\": \"<string>\",\n \"expected_version\": 123\n}"
response = http.request(request)
puts response.read_body{
"conversation_id": "<string>",
"agent": {
"id": "<string>",
"name": "<string>"
},
"org_id": "<string>",
"contract": "<unknown>",
"version": 123,
"hash": "<string>",
"previous_hash": "<string>",
"sealed_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}Authorizations
Supabase JWT token in Authorization: Bearer header
Path Parameters
The conversation id the CLI launched the session with.
Query Parameters
The agent record id (agents.id) the session ran as.
Target organization (defaults to the caller's primary org).
Body
The full new goal contract (replaces the live one under the same goal id). Every ceiling (max_turns, budget_usd, stall_turns, time_limit_s) follows replace semantics: one omitted here is removed, not kept. Only mode carries over when omitted.
Show child attributes
Show child attributes
Optimistic-concurrency guard: the hash the caller last read. A live contract that has moved past it is a 409 version_conflict.
Optimistic-concurrency guard: the version the caller last read (alternative to expected_hash).
Response
The contract was updated. Returns the new version and both hashes.
Show child attributes
Show child attributes
The new contract exactly as the gateway normalised and stored it.
The new contract version.
The new contract's hash.
The prior version's hash (updated_from).