agents
Create Agent Run
Create a new agent run.
Creates and initiates a long-running agent process based on the provided prompt. The process will complete asynchronously, and the response contains the agent run ID which can be used to check the status later. The requesting user must be a member of the specified organization.
This endpoint accepts both a text prompt and an optional image file upload.
Rate limit: 10 requests per minute.
POST
/
v1
/
organizations
/
{org_id}
/
agent
/
run
Create Agent Run
curl --request POST \
--url https://api.codegen.com/v1/organizations/{org_id}/agent/run \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"images": [
"<string>"
]
}
'import requests
url = "https://api.codegen.com/v1/organizations/{org_id}/agent/run"
payload = {
"prompt": "<string>",
"images": ["<string>"]
}
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({prompt: '<string>', images: ['<string>']})
};
fetch('https://api.codegen.com/v1/organizations/{org_id}/agent/run', 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.codegen.com/v1/organizations/{org_id}/agent/run",
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([
'prompt' => '<string>',
'images' => [
'<string>'
]
]),
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.codegen.com/v1/organizations/{org_id}/agent/run"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"images\": [\n \"<string>\"\n ]\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.codegen.com/v1/organizations/{org_id}/agent/run")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"images\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.codegen.com/v1/organizations/{org_id}/agent/run")
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 \"prompt\": \"<string>\",\n \"images\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"organization_id": 123,
"status": "<string>",
"created_at": "<string>",
"web_url": "<string>",
"result": "<string>"
}{
"message": "Alloted agent runs for the current billing plan have been reached. Please upgrade your plan to continue.",
"status_code": 402
}{
"message": "You do not have access to this organization.",
"status_code": 403
}{
"message": "No repos found in the organization. Please add some repos and try again.",
"status_code": 404
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"message": "Rate limit exceeded. Please try again later.",
"status_code": 429
}Headers
Path Parameters
Body
application/json
Was this page helpful?
⌘I
Create Agent Run
curl --request POST \
--url https://api.codegen.com/v1/organizations/{org_id}/agent/run \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"images": [
"<string>"
]
}
'import requests
url = "https://api.codegen.com/v1/organizations/{org_id}/agent/run"
payload = {
"prompt": "<string>",
"images": ["<string>"]
}
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({prompt: '<string>', images: ['<string>']})
};
fetch('https://api.codegen.com/v1/organizations/{org_id}/agent/run', 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.codegen.com/v1/organizations/{org_id}/agent/run",
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([
'prompt' => '<string>',
'images' => [
'<string>'
]
]),
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.codegen.com/v1/organizations/{org_id}/agent/run"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"images\": [\n \"<string>\"\n ]\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.codegen.com/v1/organizations/{org_id}/agent/run")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"images\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.codegen.com/v1/organizations/{org_id}/agent/run")
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 \"prompt\": \"<string>\",\n \"images\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"organization_id": 123,
"status": "<string>",
"created_at": "<string>",
"web_url": "<string>",
"result": "<string>"
}{
"message": "Alloted agent runs for the current billing plan have been reached. Please upgrade your plan to continue.",
"status_code": 402
}{
"message": "You do not have access to this organization.",
"status_code": 403
}{
"message": "No repos found in the organization. Please add some repos and try again.",
"status_code": 404
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"message": "Rate limit exceeded. Please try again later.",
"status_code": 429
}