JavaScript
import Cerca from '@cerca-dev/sdk';
const client = new Cerca({
apiKey: process.env['CERCA_API_KEY'], // This is the default and can be omitted
});
const subscriptionEvent = await client.events.streamForFleet('fleet_abc123');
console.log(subscriptionEvent.event);import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
for event in client.events.stream_for_fleet(
fleet_id="fleet_abc123",
):
print(event)package main
import (
"context"
"fmt"
"github.com/matrices/cerca-go"
"github.com/matrices/cerca-go/option"
)
func main() {
client := cercago.NewClient(
option.WithAPIKey("My API Key"),
)
stream := client.Events.StreamForFleetStreaming(
context.TODO(),
"fleet_abc123",
cercago.EventStreamForFleetParams{},
)
for stream.Next() {
fmt.Printf("%+v\n", stream.Current())
}
err := stream.Err()
if err != nil {
panic(err.Error())
}
}
require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
subscription_event = cerca.events.stream_for_fleet("fleet_abc123")
puts(subscription_event)cerca events stream-for-fleet \
--api-key 'My API Key' \
--fleet-id fleet_abc123curl --request GET \
--url https://api.cerca.dev/fleets/{fleetId}/events/stream \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/fleets/{fleetId}/events/stream",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.cerca.dev/fleets/{fleetId}/events/stream")
.header("Authorization", "Bearer <token>")
.asString();{
"event": {
"agentId": "<string>",
"fleetId": "<string>",
"id": "<string>",
"orgId": "<string>",
"threadId": "<string>",
"timestamp": "<string>",
"data": {
"agent": {
"configuration": {
"approvals": {
"tools": {},
"timeoutMs": 123
},
"defaultModel": "<string>",
"instructions": "<string>",
"tools": [
"sandbox.*"
]
},
"createdAt": "<string>",
"fleetId": "<string>",
"id": "<string>",
"metadata": {
"project": "alpha"
},
"orgId": "<string>",
"updatedAt": "<string>",
"userId": "<string>",
"effective": {
"approvals": {
"tools": {},
"timeoutMs": 123
},
"approvalsWritableByAgent": true,
"defaultModel": "<string>",
"lockedByFleet": [
"defaultModel"
],
"resolvedFromFleet": [
"defaultModel"
],
"tools": [
"get_time"
],
"instructions": "<string>"
}
}
},
"event": "agent.created"
},
"seq": 123
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}Events
Fleet event stream
Server-Sent Events stream. Each SSE data frame is JSON matching this response schema.
GET
/
fleets
/
{fleetId}
/
events
/
stream
JavaScript
import Cerca from '@cerca-dev/sdk';
const client = new Cerca({
apiKey: process.env['CERCA_API_KEY'], // This is the default and can be omitted
});
const subscriptionEvent = await client.events.streamForFleet('fleet_abc123');
console.log(subscriptionEvent.event);import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
for event in client.events.stream_for_fleet(
fleet_id="fleet_abc123",
):
print(event)package main
import (
"context"
"fmt"
"github.com/matrices/cerca-go"
"github.com/matrices/cerca-go/option"
)
func main() {
client := cercago.NewClient(
option.WithAPIKey("My API Key"),
)
stream := client.Events.StreamForFleetStreaming(
context.TODO(),
"fleet_abc123",
cercago.EventStreamForFleetParams{},
)
for stream.Next() {
fmt.Printf("%+v\n", stream.Current())
}
err := stream.Err()
if err != nil {
panic(err.Error())
}
}
require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
subscription_event = cerca.events.stream_for_fleet("fleet_abc123")
puts(subscription_event)cerca events stream-for-fleet \
--api-key 'My API Key' \
--fleet-id fleet_abc123curl --request GET \
--url https://api.cerca.dev/fleets/{fleetId}/events/stream \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/fleets/{fleetId}/events/stream",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.cerca.dev/fleets/{fleetId}/events/stream")
.header("Authorization", "Bearer <token>")
.asString();{
"event": {
"agentId": "<string>",
"fleetId": "<string>",
"id": "<string>",
"orgId": "<string>",
"threadId": "<string>",
"timestamp": "<string>",
"data": {
"agent": {
"configuration": {
"approvals": {
"tools": {},
"timeoutMs": 123
},
"defaultModel": "<string>",
"instructions": "<string>",
"tools": [
"sandbox.*"
]
},
"createdAt": "<string>",
"fleetId": "<string>",
"id": "<string>",
"metadata": {
"project": "alpha"
},
"orgId": "<string>",
"updatedAt": "<string>",
"userId": "<string>",
"effective": {
"approvals": {
"tools": {},
"timeoutMs": 123
},
"approvalsWritableByAgent": true,
"defaultModel": "<string>",
"lockedByFleet": [
"defaultModel"
],
"resolvedFromFleet": [
"defaultModel"
],
"tools": [
"get_time"
],
"instructions": "<string>"
}
}
},
"event": "agent.created"
},
"seq": 123
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Resume an event-log stream after the last received SSE event id.
Example:
"4711"
Path Parameters
Minimum string length:
1Example:
"fleet_abc123"
Query Parameters
Opaque pagination cursor returned by a previous request.
Example:
"cursor_abc123"
Comma-separated event type filter.
Example:
"thread.created,thread.completed"
When true, starts from the beginning of the retained buffer.
Available options:
true, false Example:
"true"
Response
Fleet event stream
- AgentCreatedWebhookEvent
- AgentUpdatedWebhookEvent
- AgentDeletedWebhookEvent
- ThreadCreatedWebhookEvent
- ThreadStatusChangedWebhookEvent
- ThreadCompletedWebhookEvent
- ThreadFailedWebhookEvent
- TurnCreatedWebhookEvent
- TurnCompletedWebhookEvent
- TurnFailedWebhookEvent
- MessageCreatedWebhookEvent
- ApprovalRequestedWebhookEvent
- ApprovalResolvedWebhookEvent
- ApprovalGrantedWebhookEvent
- ScheduleCreatedWebhookEvent
- ScheduleDeletedWebhookEvent
- ScheduleTriggeredWebhookEvent
- ConnectionAttachedWebhookEvent
- ConnectionDetachedWebhookEvent
- WebhookTestWebhookEvent
Show child attributes
Show child attributes