curl --request POST \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"instructions": "instructions",
"agentOptimizationVersion": 0,
"iteration": 6,
"runId": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"userInput": "userInput",
"parameters": {
"key": ""
}
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results"
payload = {
"instructions": "instructions",
"agentOptimizationVersion": 0,
"iteration": 6,
"runId": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"userInput": "userInput",
"parameters": { "key": "" }
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
instructions: 'instructions',
agentOptimizationVersion: 0,
iteration: 6,
runId: '046b6c7f-0b8a-43b9-b35d-6489e6daee91',
userInput: 'userInput',
parameters: {key: ''}
})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results', 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://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results",
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([
'instructions' => 'instructions',
'agentOptimizationVersion' => 0,
'iteration' => 6,
'runId' => '046b6c7f-0b8a-43b9-b35d-6489e6daee91',
'userInput' => 'userInput',
'parameters' => [
'key' => ''
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results"
payload := strings.NewReader("{\n \"instructions\": \"instructions\",\n \"agentOptimizationVersion\": 0,\n \"iteration\": 6,\n \"runId\": \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"userInput\": \"userInput\",\n \"parameters\": {\n \"key\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"instructions\": \"instructions\",\n \"agentOptimizationVersion\": 0,\n \"iteration\": 6,\n \"runId\": \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"userInput\": \"userInput\",\n \"parameters\": {\n \"key\": \"\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"instructions\": \"instructions\",\n \"agentOptimizationVersion\": 0,\n \"iteration\": 6,\n \"runId\": \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"userInput\": \"userInput\",\n \"parameters\": {\n \"key\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body{
"instructions": "instructions",
"generationTokens": {
"key": ""
},
"completedAt": 5,
"activity": "PENDING",
"_links": {
"parent": {
"href": "href",
"type": "type"
},
"self": {
"href": "href",
"type": "type"
}
},
"scores": {
"key": ""
},
"variation": {
"key": ""
},
"evaluationLatencies": {
"key": ""
},
"createdVariationKey": "createdVariationKey",
"evaluationTokens": {
"key": ""
},
"createdAt": 5,
"agentOptimizationId": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"generationLatency": 1,
"_access": {
"allowed": [
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
}
],
"denied": [
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
}
]
},
"agentOptimizationVersion": 0,
"completionResponse": "completionResponse",
"iteration": 6,
"id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"runId": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"userInput": "userInput",
"parameters": {
"key": ""
},
"status": "RUNNING",
"updatedAt": 2
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}Create agent optimization result
Create a new result for an agent optimization run.
curl --request POST \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"instructions": "instructions",
"agentOptimizationVersion": 0,
"iteration": 6,
"runId": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"userInput": "userInput",
"parameters": {
"key": ""
}
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results"
payload = {
"instructions": "instructions",
"agentOptimizationVersion": 0,
"iteration": 6,
"runId": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"userInput": "userInput",
"parameters": { "key": "" }
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
instructions: 'instructions',
agentOptimizationVersion: 0,
iteration: 6,
runId: '046b6c7f-0b8a-43b9-b35d-6489e6daee91',
userInput: 'userInput',
parameters: {key: ''}
})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results', 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://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results",
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([
'instructions' => 'instructions',
'agentOptimizationVersion' => 0,
'iteration' => 6,
'runId' => '046b6c7f-0b8a-43b9-b35d-6489e6daee91',
'userInput' => 'userInput',
'parameters' => [
'key' => ''
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results"
payload := strings.NewReader("{\n \"instructions\": \"instructions\",\n \"agentOptimizationVersion\": 0,\n \"iteration\": 6,\n \"runId\": \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"userInput\": \"userInput\",\n \"parameters\": {\n \"key\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"instructions\": \"instructions\",\n \"agentOptimizationVersion\": 0,\n \"iteration\": 6,\n \"runId\": \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"userInput\": \"userInput\",\n \"parameters\": {\n \"key\": \"\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"instructions\": \"instructions\",\n \"agentOptimizationVersion\": 0,\n \"iteration\": 6,\n \"runId\": \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"userInput\": \"userInput\",\n \"parameters\": {\n \"key\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body{
"instructions": "instructions",
"generationTokens": {
"key": ""
},
"completedAt": 5,
"activity": "PENDING",
"_links": {
"parent": {
"href": "href",
"type": "type"
},
"self": {
"href": "href",
"type": "type"
}
},
"scores": {
"key": ""
},
"variation": {
"key": ""
},
"evaluationLatencies": {
"key": ""
},
"createdVariationKey": "createdVariationKey",
"evaluationTokens": {
"key": ""
},
"createdAt": 5,
"agentOptimizationId": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"generationLatency": 1,
"_access": {
"allowed": [
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
}
],
"denied": [
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
}
]
},
"agentOptimizationVersion": 0,
"completionResponse": "completionResponse",
"iteration": 6,
"id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"runId": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"userInput": "userInput",
"parameters": {
"key": ""
},
"status": "RUNNING",
"updatedAt": 2
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}Authorizations
Path Parameters
The project key
The agent optimization key
Body
Agent optimization result to create
The ID of the run this result belongs to
The version of the agent optimization used
The iteration number within the run
The instructions used for this attempt
The user input used for this attempt
The model parameters used for this attempt
Response
Agent optimization result created
The result ID
The ID of the run this result belongs to
The agent optimization ID
The version of the agent optimization used
RUNNING, PASSED, FAILED, ERRORED PENDING, GENERATING, EVALUATING, GENERATING_VARIATION, VALIDATING, COMPLETED The iteration number within the run
The instructions used for this attempt
The user input used for this attempt
When this resource was created, in Unix milliseconds
When this resource was last updated, in Unix milliseconds
Show child attributes
Show child attributes
{
"allowed": [
{
"reason": {
"role_name": "role_name",
"notActions": [null, null],
"notResources": ["notResources", "notResources"],
"effect": "allow",
"resources": ["proj/*:env/*;qa_*:/flag/*"],
"actions": ["*"]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [null, null],
"notResources": ["notResources", "notResources"],
"effect": "allow",
"resources": ["proj/*:env/*;qa_*:/flag/*"],
"actions": ["*"]
},
"action": "action"
}
],
"denied": [
{
"reason": {
"role_name": "role_name",
"notActions": [null, null],
"notResources": ["notResources", "notResources"],
"effect": "allow",
"resources": ["proj/*:env/*;qa_*:/flag/*"],
"actions": ["*"]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [null, null],
"notResources": ["notResources", "notResources"],
"effect": "allow",
"resources": ["proj/*:env/*;qa_*:/flag/*"],
"actions": ["*"]
},
"action": "action"
}
]
}
The location and content type of related resources
Show child attributes
Show child attributes
{
"parent": { "href": "href", "type": "type" },
"self": { "href": "href", "type": "type" }
}
The model parameters used for this attempt
The model response
The variation that was tested
The scores for the response
Token usage for generating the response
Token usage for judging the response
How long the response took to generate
How long each evaluation took
When this finished, in Unix milliseconds
The key of the variation created from this result