Skip to main content
POST
/
projects
/
{project_id}
/
agents
/
{agent_id}
/
logs
Create Agent Log
curl --request POST \
  --url https://api.example.com/projects/{project_id}/agents/{agent_id}/logs \
  --header 'Content-Type: application/json' \
  --data '
{
  "message": "<string>",
  "instance_id": "<string>",
  "metadata": {}
}
'
import requests

url = "https://api.example.com/projects/{project_id}/agents/{agent_id}/logs"

payload = {
    "message": "<string>",
    "instance_id": "<string>",
    "metadata": {}
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({message: '<string>', instance_id: '<string>', metadata: {}})
};

fetch('https://api.example.com/projects/{project_id}/agents/{agent_id}/logs', 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.example.com/projects/{project_id}/agents/{agent_id}/logs",
  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([
    'message' => '<string>',
    'instance_id' => '<string>',
    'metadata' => [
        
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "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.example.com/projects/{project_id}/agents/{agent_id}/logs"

	payload := strings.NewReader("{\n  \"message\": \"<string>\",\n  \"instance_id\": \"<string>\",\n  \"metadata\": {}\n}")

	req, _ := http.NewRequest("POST", url, payload)

	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.example.com/projects/{project_id}/agents/{agent_id}/logs")
  .header("Content-Type", "application/json")
  .body("{\n  \"message\": \"<string>\",\n  \"instance_id\": \"<string>\",\n  \"metadata\": {}\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/projects/{project_id}/agents/{agent_id}/logs")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"message\": \"<string>\",\n  \"instance_id\": \"<string>\",\n  \"metadata\": {}\n}"

response = http.request(request)
puts response.read_body
{
  "agent_resource_id": "<string>",
  "message": "<string>",
  "id": "<string>",
  "instance_id": "<string>",
  "metadata": {},
  "timestamp": "2023-11-07T05:31:56Z",
  "expires_at": "2023-11-07T05:31:56Z"
}
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>",
      "input": "<unknown>",
      "ctx": {}
    }
  ]
}

Path Parameters

agent_id
string
required
project_id
string
required

Body

application/json

Request body for creating an agent log entry.

Attributes: log_type: Category of this log entry. message: Human-readable description of what happened. instance_id: Agent instance that produced this log entry. metadata: Flexible payload (tool name, arguments, error details, etc.).

log_type
enum<string>
required

Types of agent log entries.

Available options:
trigger_fired,
agent_started,
agent_completed,
agent_error,
tool_call,
tool_result,
reasoning,
decision,
plan_created,
plan_updated,
step_started,
step_completed
message
string
required
instance_id
string | null
metadata
Metadata · object | null

Response

Successful Response

A recorded action or decision by an AI agent.

Agent logs live inside each organization's SurrealDB namespace — the namespace is the organization boundary, so no per-record organization_id field is carried on the row.

Attributes: id: SurrealDB record ID (populated by database). agent_resource_id: SurrealDB ID of the agent resource. instance_id: Agent instance that produced this log entry. log_type: Category of this log entry. message: Human-readable description of what happened. metadata: Flexible payload (tool name, arguments, error details, etc.). timestamp: When this action occurred. expires_at: When this log entry should be garbage collected.

agent_resource_id
string
required
log_type
enum<string>
required

Types of agent log entries.

Available options:
trigger_fired,
agent_started,
agent_completed,
agent_error,
tool_call,
tool_result,
reasoning,
decision,
plan_created,
plan_updated,
step_started,
step_completed
message
string
required
id
string | null
instance_id
string | null
metadata
Metadata · object | null
timestamp
string<date-time>
expires_at
string<date-time>