Skip to main content
POST
/
v1
/
agents
JavaScript
import Runloop from '@runloop/api-client';

const client = new Runloop({
  bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
});

const agentView = await client.agents.create({ name: 'name' });

console.log(agentView.id);
import os
from runloop_api_client import Runloop

client = Runloop(
    bearer_token=os.environ.get("RUNLOOP_API_KEY"),  # This is the default and can be omitted
)
agent_view = client.agents.create(
    name="name",
)
print(agent_view.id)
curl --request POST \
  --url https://api.runloop.ai/v1/agents \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "version": "<string>",
  "source": {
    "type": "<string>",
    "npm": {
      "package_name": "<string>",
      "registry_url": "<string>",
      "agent_setup": [
        "<string>"
      ]
    },
    "pip": {
      "package_name": "<string>",
      "registry_url": "<string>",
      "agent_setup": [
        "<string>"
      ]
    },
    "object": {
      "object_id": "<string>",
      "agent_setup": [
        "<string>"
      ]
    },
    "git": {
      "repository": "<string>",
      "ref": "<string>",
      "agent_setup": [
        "<string>"
      ]
    }
  }
}
'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.runloop.ai/v1/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([
    'name' => '<string>',
    'version' => '<string>',
    'source' => [
        'type' => '<string>',
        'npm' => [
                'package_name' => '<string>',
                'registry_url' => '<string>',
                'agent_setup' => [
                                '<string>'
                ]
        ],
        'pip' => [
                'package_name' => '<string>',
                'registry_url' => '<string>',
                'agent_setup' => [
                                '<string>'
                ]
        ],
        'object' => [
                'object_id' => '<string>',
                'agent_setup' => [
                                '<string>'
                ]
        ],
        'git' => [
                'repository' => '<string>',
                'ref' => '<string>',
                'agent_setup' => [
                                '<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;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runloop.ai/v1/agents"

	payload := strings.NewReader("{\n  \"name\": \"<string>\",\n  \"version\": \"<string>\",\n  \"source\": {\n    \"type\": \"<string>\",\n    \"npm\": {\n      \"package_name\": \"<string>\",\n      \"registry_url\": \"<string>\",\n      \"agent_setup\": [\n        \"<string>\"\n      ]\n    },\n    \"pip\": {\n      \"package_name\": \"<string>\",\n      \"registry_url\": \"<string>\",\n      \"agent_setup\": [\n        \"<string>\"\n      ]\n    },\n    \"object\": {\n      \"object_id\": \"<string>\",\n      \"agent_setup\": [\n        \"<string>\"\n      ]\n    },\n    \"git\": {\n      \"repository\": \"<string>\",\n      \"ref\": \"<string>\",\n      \"agent_setup\": [\n        \"<string>\"\n      ]\n    }\n  }\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("https://api.runloop.ai/v1/agents")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"<string>\",\n  \"version\": \"<string>\",\n  \"source\": {\n    \"type\": \"<string>\",\n    \"npm\": {\n      \"package_name\": \"<string>\",\n      \"registry_url\": \"<string>\",\n      \"agent_setup\": [\n        \"<string>\"\n      ]\n    },\n    \"pip\": {\n      \"package_name\": \"<string>\",\n      \"registry_url\": \"<string>\",\n      \"agent_setup\": [\n        \"<string>\"\n      ]\n    },\n    \"object\": {\n      \"object_id\": \"<string>\",\n      \"agent_setup\": [\n        \"<string>\"\n      ]\n    },\n    \"git\": {\n      \"repository\": \"<string>\",\n      \"ref\": \"<string>\",\n      \"agent_setup\": [\n        \"<string>\"\n      ]\n    }\n  }\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.runloop.ai/v1/agents")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"<string>\",\n  \"version\": \"<string>\",\n  \"source\": {\n    \"type\": \"<string>\",\n    \"npm\": {\n      \"package_name\": \"<string>\",\n      \"registry_url\": \"<string>\",\n      \"agent_setup\": [\n        \"<string>\"\n      ]\n    },\n    \"pip\": {\n      \"package_name\": \"<string>\",\n      \"registry_url\": \"<string>\",\n      \"agent_setup\": [\n        \"<string>\"\n      ]\n    },\n    \"object\": {\n      \"object_id\": \"<string>\",\n      \"agent_setup\": [\n        \"<string>\"\n      ]\n    },\n    \"git\": {\n      \"repository\": \"<string>\",\n      \"ref\": \"<string>\",\n      \"agent_setup\": [\n        \"<string>\"\n      ]\n    }\n  }\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "name": "<string>",
  "create_time_ms": 123,
  "is_public": true,
  "version": "<string>",
  "source": {
    "type": "<string>",
    "npm": {
      "package_name": "<string>",
      "registry_url": "<string>",
      "agent_setup": [
        "<string>"
      ]
    },
    "pip": {
      "package_name": "<string>",
      "registry_url": "<string>",
      "agent_setup": [
        "<string>"
      ]
    },
    "object": {
      "object_id": "<string>",
      "agent_setup": [
        "<string>"
      ]
    },
    "git": {
      "repository": "<string>",
      "ref": "<string>",
      "agent_setup": [
        "<string>"
      ]
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Parameters for creating a new Agent.

name
string
required

The name of the Agent.

version
string | null

Optional version identifier for the Agent. For npm/pip sources this is typically a semver string (e.g. '2.0.65'). For git sources it can be a branch or tag. Semantics are user-defined for object sources.

source
object | null

The source configuration for the Agent.

Response

Agent created successfully. Returns the Agent with metadata.

An Agent represents a registered AI agent entity.

id
string
required

The unique identifier of the Agent.

name
string
required

The name of the Agent.

create_time_ms
integer<int64>
required

The creation time of the Agent (Unix timestamp milliseconds).

is_public
boolean
required

Whether the Agent is publicly accessible.

version
string | null

Optional version identifier for the Agent. For npm/pip sources this is typically a semver string (e.g. '2.0.65'). For git sources it can be a branch or tag. Omitted for object sources or when not provided.

source
object | null

The source configuration for the Agent.