Events, Questions and Results
curl --request POST \
--url https://win.oneshotagent.com/v1/compute/{goalId}/eventsimport requests
url = "https://win.oneshotagent.com/v1/compute/{goalId}/events"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://win.oneshotagent.com/v1/compute/{goalId}/events', 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://win.oneshotagent.com/v1/compute/{goalId}/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://win.oneshotagent.com/v1/compute/{goalId}/events"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://win.oneshotagent.com/v1/compute/{goalId}/events")
.asString();require 'uri'
require 'net/http'
url = URI("https://win.oneshotagent.com/v1/compute/{goalId}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyWorking with a goal
Events, Questions and Results
Send an event to a case, have a case ask a named person and wait, and receive its result at your own address
POST
/
v1
/
compute
/
{goalId}
/
events
Events, Questions and Results
curl --request POST \
--url https://win.oneshotagent.com/v1/compute/{goalId}/eventsimport requests
url = "https://win.oneshotagent.com/v1/compute/{goalId}/events"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://win.oneshotagent.com/v1/compute/{goalId}/events', 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://win.oneshotagent.com/v1/compute/{goalId}/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://win.oneshotagent.com/v1/compute/{goalId}/events"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://win.oneshotagent.com/v1/compute/{goalId}/events")
.asString();require 'uri'
require 'net/http'
url = URI("https://win.oneshotagent.com/v1/compute/{goalId}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyOverview
All wallets use the agent loop.
Send an event
POST /v1/compute/{goalId}/events with a signed write proof or an access token (Authentication schemes).
{ "event_id": "inv-1001", "case_key": "SHIPMENT-8841", "task": "Freight invoice 1001: 1,240.00 USD for shipment 8841" }
event_id: your id for the event. Sending the same id twice is one event.case_key: the case it is about. It is opened, woken if open, or reopened if finished. Leave it out to send the event to the goal’s root.task: what happened.facts: optional object, up to 16,000 bytes, withcase_key: the case’s fields; later facts merge in. Invalid:400 invalid_facts.budget_usdc,step_limit: for a case this event opens.
202 with { "target": "case" | "root", "case_key", "outcome": "created" | "already_open" | "reopened" | "sent_to_root" }.
Replies reach the case that asked
Replies wake their sending session. Unmatched mail goes to the newest goal’s root.A case asks a named person
ask_person takes a name, address, question and kind:
answer: email requires aligned DMARC or verified DKIM for the From domain. Failed/missing verification holds it for owner review; the question stays open.approval: anything that releases an action. The person is sent a signed, single-use link that expires. Only the click counts. A reply to the same email is told to the case and releases nothing. The click is written on the record with who, when,via: "link"and what the person was shown (shown,shown_hash).
chase_after_seconds, up to three reminders) and has a deadline (deadline_seconds, default 7 days) at which the case is told to escalate. A used, expired or altered link is refused.
Goal email and ask_person obey domain sending limits.
Results out
Give the goal an address or people to email at creation:{ "params": { "result_webhook_url": "https://example.com/oneshot/results", "result_recipients": ["[email protected]"] } }
{ "event": "case.result", "goal_id": "…", "case": "SHIPMENT-8841", "session_id": "…", "result": { "amount_usd": 1180 }, "approval": { "ask_id": "…", "who": "Rae", "when": "…", "via": "link" }, "delivery_id": "…", "attempt": 1 }
X-OneShot-Signature (t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<body>">). Read the secret at GET /v1/compute/{goalId}/result-webhook.
If the case asked for an approval, only a result equal to the approved one is sent; anything else is withheld. A failed delivery is retried with a growing delay, up to six attempts, each shown on the case.
Regulated webhooks send IDs, status, timestamps and a content-read path.
Read a case
GET /v1/compute/{goalId}/cases/{key} returns the case’s record, facts, outputs, recorded, wait_until, decisions, asks (each with status, chases, deadline_at, escalated_at) and deliveries (each with status, attempts, last_error, next_attempt_at).
Declared params.cases.value_field requires a finite result number before delivery. Case reads add value and actual_usdc. Case settings declare person_actions; outcomes report value, spend and owners.