Register a custom agent transport
Message type agent_register. Body is a full Message envelope;
payload schema: AgentRegisterPayload.
POST
/
agents
/
register
Register a custom agent transport
curl --request POST \
--url http://127.0.0.1:4900/v1/agents/register \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "agent_register",
"version": 1,
"id": "msg-example",
"timestamp": 1720000000000,
"run_id": null,
"instance_id": null,
"payload": {}
}
'import requests
url = "http://127.0.0.1:4900/v1/agents/register"
payload = {
"type": "agent_register",
"version": 1,
"id": "msg-example",
"timestamp": 1720000000000,
"run_id": None,
"instance_id": None,
"payload": {}
}
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({
type: 'agent_register',
version: 1,
id: 'msg-example',
timestamp: 1720000000000,
run_id: null,
instance_id: null,
payload: {}
})
};
fetch('http://127.0.0.1:4900/v1/agents/register', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "4900",
CURLOPT_URL => "http://127.0.0.1:4900/v1/agents/register",
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([
'type' => 'agent_register',
'version' => 1,
'id' => 'msg-example',
'timestamp' => 1720000000000,
'run_id' => null,
'instance_id' => null,
'payload' => [
]
]),
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 := "http://127.0.0.1:4900/v1/agents/register"
payload := strings.NewReader("{\n \"type\": \"agent_register\",\n \"version\": 1,\n \"id\": \"msg-example\",\n \"timestamp\": 1720000000000,\n \"run_id\": null,\n \"instance_id\": null,\n \"payload\": {}\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("http://127.0.0.1:4900/v1/agents/register")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"agent_register\",\n \"version\": 1,\n \"id\": \"msg-example\",\n \"timestamp\": 1720000000000,\n \"run_id\": null,\n \"instance_id\": null,\n \"payload\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:4900/v1/agents/register")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"agent_register\",\n \"version\": 1,\n \"id\": \"msg-example\",\n \"timestamp\": 1720000000000,\n \"run_id\": null,\n \"instance_id\": null,\n \"payload\": {}\n}"
response = http.request(request)
puts response.read_body{
"type": "ok",
"version": 1,
"id": "reply-1",
"timestamp": 1720000000000,
"run_id": null,
"instance_id": null,
"payload": {
"data": {}
}
}Authorizations
Optional on loopback. Required for non-loopback when
CLIQ_DISPATCH_PUBLIC_KEY is configured (dispatch JWT).
Body
application/json
Base message envelope shared by nearly all daemon POSTs
Message type discriminator
Allowed value:
"agent_register"Wire protocol version
Minimum string length:
1Unix epoch milliseconds
Discriminated on transport
- Option 1
- Option 2
Show child attributes
Show child attributes
Response
200 - application/json
Reply envelope (ok or error)
- Option 1
- Option 2
Typical unary reply — prefer switching on type
Message type discriminator
Allowed value:
"ok"Wire protocol version
Minimum string length:
1Unix epoch milliseconds
Show child attributes
Show child attributes
⌘I
Register a custom agent transport
curl --request POST \
--url http://127.0.0.1:4900/v1/agents/register \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "agent_register",
"version": 1,
"id": "msg-example",
"timestamp": 1720000000000,
"run_id": null,
"instance_id": null,
"payload": {}
}
'import requests
url = "http://127.0.0.1:4900/v1/agents/register"
payload = {
"type": "agent_register",
"version": 1,
"id": "msg-example",
"timestamp": 1720000000000,
"run_id": None,
"instance_id": None,
"payload": {}
}
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({
type: 'agent_register',
version: 1,
id: 'msg-example',
timestamp: 1720000000000,
run_id: null,
instance_id: null,
payload: {}
})
};
fetch('http://127.0.0.1:4900/v1/agents/register', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "4900",
CURLOPT_URL => "http://127.0.0.1:4900/v1/agents/register",
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([
'type' => 'agent_register',
'version' => 1,
'id' => 'msg-example',
'timestamp' => 1720000000000,
'run_id' => null,
'instance_id' => null,
'payload' => [
]
]),
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 := "http://127.0.0.1:4900/v1/agents/register"
payload := strings.NewReader("{\n \"type\": \"agent_register\",\n \"version\": 1,\n \"id\": \"msg-example\",\n \"timestamp\": 1720000000000,\n \"run_id\": null,\n \"instance_id\": null,\n \"payload\": {}\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("http://127.0.0.1:4900/v1/agents/register")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"agent_register\",\n \"version\": 1,\n \"id\": \"msg-example\",\n \"timestamp\": 1720000000000,\n \"run_id\": null,\n \"instance_id\": null,\n \"payload\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:4900/v1/agents/register")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"agent_register\",\n \"version\": 1,\n \"id\": \"msg-example\",\n \"timestamp\": 1720000000000,\n \"run_id\": null,\n \"instance_id\": null,\n \"payload\": {}\n}"
response = http.request(request)
puts response.read_body{
"type": "ok",
"version": 1,
"id": "reply-1",
"timestamp": 1720000000000,
"run_id": null,
"instance_id": null,
"payload": {
"data": {}
}
}