Register your agent
Tell Sess where your agent runs and what it needs to start. Then prove the address is yours.
On this page
Before you start
- A Sess API key. Create one in your developer account.
- An HTTPS address for your agent, on a site where you can publish one small file.
- A terminal with
curlandjq.
export SESS_API="https://api.sess.si"
read -rs SESS_API_KEY && export SESS_API_KEY # paste the key, then press Enter
1. Register
Describe your agent: where Sess sends each run, what it needs to start, which websites may start it, and how much it can take on.
cat > target.json <<'JSON'
{
"type": "http",
"endpoint": "https://agent.example.com/sess",
"capability": {
"name": "weekend.plan",
"version": "1",
"input_schema": {
"type": "object",
"properties": { "city": { "type": "string", "maxLength": 80 } },
"required": ["city"],
"additionalProperties": false
}
},
"grant": { "audiences": ["https://agent.example.com"], "lifetime_seconds": 3600 },
"budget": { "max_concurrent": 5, "max_starts_per_day": 100 }
}
JSON
endpoint: where Sess sends each run. Anhttps://address on the standard port. It cannot change later; register again for a new address.capability: a name for what your agent does, and the JSON Schema of what it needs to start.grant: the websites allowed to start your agent, and how long each permission to start lasts, in seconds.budget: how many runs at once, and how many starts a day.
curl -sS -X POST "$SESS_API/v1/targets" \
-H "Authorization: Bearer $SESS_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @target.json \
-o registered.json -w '%{http_code}\n'
export TARGET_ID="$(jq -r .id registered.json)"
Expected result: 201. Your agent is registered, but no one can start it until you prove the address is yours.
2. Prove the address is yours
The answer tells you which file to publish and where:
jq .verification registered.json
{
"status": "pending",
"token": "sess_tv_…",
"well_known_url": "https://agent.example.com/.well-known/sess-target/tgt_….json",
"verified_at": null,
"expires_at": null
}
Publish a JSON file with your target ID and the token at that exact address:
jq '{target_id: .id, token: .verification.token}' registered.json > "$TARGET_ID.json"
The token is not a secret: anyone can read this file. When it is online, ask Sess to check it:
curl -sS -X POST "$SESS_API/v1/targets/$TARGET_ID/verify" \
-H "Authorization: Bearer $SESS_API_KEY" \
-o verified.json -w '%{http_code}\n'
jq -r .verification.status verified.json
Expected result: 200, then verified. Sess only reads that file; it does not call your agent to check.
Verification lasts 30 days. Verify again before then, with the same file, to keep it. If it lapses, no one can start your agent until you verify again.
3. Read and change it
Read one agent, or all of yours:
curl -sS "$SESS_API/v1/targets/$TARGET_ID" -H "Authorization: Bearer $SESS_API_KEY"
curl -sS "$SESS_API/v1/targets" -H "Authorization: Bearer $SESS_API_KEY"
Send only what you want to change. This raises the budget:
curl -sS -X PATCH "$SESS_API/v1/targets/$TARGET_ID" \
-H "Authorization: Bearer $SESS_API_KEY" \
-H "Content-Type: application/json" \
--data-binary '{"budget": {"max_concurrent": 10, "max_starts_per_day": 500}}'
To pause your agent, send {"enabled": false}; to turn it back on, {"enabled": true}. While it is paused, no one can start it, and runs still waiting to be sent to your agent are stopped. A run already being sent to your agent, or already running, may still arrive or carry on.
Every start is tied to the settings your agent had when permission to start was given. When you change what it needs to start, which websites may start it, or its budget, earlier permissions can no longer start new runs, and runs still waiting to be sent are stopped. A run already being sent to your agent, or already running, may still arrive or carry on under the earlier settings.
Sharing
Coming soon One link to share your agent, so anyone can start it.
How it works
Versions, checks and error codes
- Each agent has a
version, starting at 1. A change tocapability,grantorbudgetadds one;enabledanddefault_expires_indo not. A start grant is issued for one version: a start with a grant from an older version is refused with409 TARGET_VERSION_CONFLICT, and runs still in statusadmittedfail with reasonstale_binding(pausing fails them withtarget_disabled). The check happens when Sess claims a run for sending; a run already claimed (statusdispatchingor later) is sent as it was admitted, and an API call already sent may reach your endpoint after the change. - Start grants:
POST /v1/targets/{id}/grantswith anaudiencefromgrant.audiencesreturns the grant secret once. It answers409 ACTION_NOT_ALLOWEDwith reasonunverifiedordisableduntil the agent is verified and on. See the API reference. - Present the grant secret as
Authorization: BeareronPOST /v1/invocationsfrom the grant's audience origin. - When your agent creates a Session for a run, send the run's
invocation_idwithPOST /v1/sessions. The run must be in your workspace and still open: an unknown run answers422 VALIDATION_FAILED(reasonunknown_invocation), and a run that has ended answers409 INVOCATION_TERMINAL. Without it, the Session is not tied to a run. - Verification: one
GETofwell_known_url, which is/.well-known/sess-target/<target id>.jsonon your endpoint's origin. HTTPS on port 443, public addresses only, no redirects followed, a 10-second timeout. It passes on a 2xx answer of at most 4,096 bytes whose JSON has the exacttarget_idandtoken; other fields are ignored. Verifying again renews it for 30 days from then; the token stays the same. - A failed check answers
422 TARGET_VERIFICATION_FAILEDwith areason:redirect,rejected(not a 2xx answer),bad_answer(too large, not JSON or not matching),timeout,connection,dnsoregress_refused. - Registration refuses an endpoint it cannot use with
400 TARGET_INVALID_URL, and an input schema outside the supported subset with400 TARGET_INVALID_CAPABILITY. Both carry areason. - Registering takes an optional
Idempotency-Key. If you cannot tell whether a register call went through, send it again with the same key and body: you get the agent you registered, not a second one. Changes take noIf-Match. default_expires_inis optional: the link lifetime your agent is asked to give the Sessions it creates for a run. See the API reference.default_expires_inis copied into each admitted run and sent in the dispatch message aslimits.expires_in. An agent that sets its ownexpires_in, calls the API directly or uses an SDK that does not apply it is not governed by it, and creating the Session checks the value against the creating key's plan again. It is not part of the versioned binding: changing it changes no version and leaves grants and admitted runs as they are.
Where next
- API reference: every field, limit and error code for agents, grants and starts.
- Concepts: what a request is, revisions, results and receipts.