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 agent = await client.agents.create();
console.log(agent.id);import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
agent = client.agents.create()
print(agent.id)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"),
)
agent, err := client.Agents.New(context.TODO(), cercago.AgentNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", agent.ID)
}
require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
agent = cerca.agents.create
puts(agent)cerca agents create \
--api-key 'My API Key'curl --request POST \
--url https://api.cerca.dev/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"configuration": {
"approvals": {
"tools": {},
"timeoutMs": 123
},
"defaultModel": "<string>",
"instructions": "<string>",
"tools": [
"<string>"
]
},
"fleetId": "<string>",
"metadata": {
"project": "alpha"
},
"userId": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/agents",
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([
'configuration' => [
'approvals' => [
'tools' => [
],
'timeoutMs' => 123
],
'defaultModel' => '<string>',
'instructions' => '<string>',
'tools' => [
'<string>'
]
],
'fleetId' => '<string>',
'metadata' => [
'project' => 'alpha'
],
'userId' => '<string>'
]),
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;
}HttpResponse<String> response = Unirest.post("https://api.cerca.dev/agents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"configuration\": {\n \"approvals\": {\n \"tools\": {},\n \"timeoutMs\": 123\n },\n \"defaultModel\": \"<string>\",\n \"instructions\": \"<string>\",\n \"tools\": [\n \"<string>\"\n ]\n },\n \"fleetId\": \"<string>\",\n \"metadata\": {\n \"project\": \"alpha\"\n },\n \"userId\": \"<string>\"\n}")
.asString();{
"configuration": {
"approvals": {
"tools": {},
"timeoutMs": 123
},
"defaultModel": "<string>",
"instructions": "<string>",
"tools": [
"<string>"
]
},
"createdAt": "<string>",
"fleetId": "<string>",
"executionPrincipal": {
"kind": "user",
"userId": "<string>"
},
"id": "<string>",
"metadata": {
"project": "alpha"
},
"orgId": "<string>",
"updatedAt": "<string>",
"userId": "<string>",
"effective": {
"approvals": {
"tools": {},
"timeoutMs": 123
},
"approvalsWritableByAgent": true,
"defaultModel": "<string>",
"lockedByFleet": [],
"resolvedFromFleet": [],
"tools": [],
"instructions": "<string>"
}
}{
"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"
}Agents
Create agent
POST
/
agents
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 agent = await client.agents.create();
console.log(agent.id);import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
agent = client.agents.create()
print(agent.id)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"),
)
agent, err := client.Agents.New(context.TODO(), cercago.AgentNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", agent.ID)
}
require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
agent = cerca.agents.create
puts(agent)cerca agents create \
--api-key 'My API Key'curl --request POST \
--url https://api.cerca.dev/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"configuration": {
"approvals": {
"tools": {},
"timeoutMs": 123
},
"defaultModel": "<string>",
"instructions": "<string>",
"tools": [
"<string>"
]
},
"fleetId": "<string>",
"metadata": {
"project": "alpha"
},
"userId": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/agents",
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([
'configuration' => [
'approvals' => [
'tools' => [
],
'timeoutMs' => 123
],
'defaultModel' => '<string>',
'instructions' => '<string>',
'tools' => [
'<string>'
]
],
'fleetId' => '<string>',
'metadata' => [
'project' => 'alpha'
],
'userId' => '<string>'
]),
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;
}HttpResponse<String> response = Unirest.post("https://api.cerca.dev/agents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"configuration\": {\n \"approvals\": {\n \"tools\": {},\n \"timeoutMs\": 123\n },\n \"defaultModel\": \"<string>\",\n \"instructions\": \"<string>\",\n \"tools\": [\n \"<string>\"\n ]\n },\n \"fleetId\": \"<string>\",\n \"metadata\": {\n \"project\": \"alpha\"\n },\n \"userId\": \"<string>\"\n}")
.asString();{
"configuration": {
"approvals": {
"tools": {},
"timeoutMs": 123
},
"defaultModel": "<string>",
"instructions": "<string>",
"tools": [
"<string>"
]
},
"createdAt": "<string>",
"fleetId": "<string>",
"executionPrincipal": {
"kind": "user",
"userId": "<string>"
},
"id": "<string>",
"metadata": {
"project": "alpha"
},
"orgId": "<string>",
"updatedAt": "<string>",
"userId": "<string>",
"effective": {
"approvals": {
"tools": {},
"timeoutMs": 123
},
"approvalsWritableByAgent": true,
"defaultModel": "<string>",
"lockedByFleet": [],
"resolvedFromFleet": [],
"tools": [],
"instructions": "<string>"
}
}{
"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.
Body
application/json
Response
Agent created.
Show child attributes
Show child attributes
- UserExecutionPrincipal
- ApiKeyExecutionPrincipal
Show child attributes
Show child attributes
Arbitrary string metadata stored on an agent. Runtime enforces maximum key and value sizes.
Show child attributes
Show child attributes
Example:
{ "project": "alpha" }
Show child attributes
Show child attributes
⌘I