Update an agent optimization result
curl --request PATCH \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results/{resultId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"evaluationTokens": {
"key": ""
},
"generationTokens": {
"key": ""
},
"generationLatency": 0,
"activity": "PENDING",
"scores": {
"key": ""
},
"completionResponse": "completionResponse",
"variation": {
"key": ""
},
"evaluationLatencies": {
"key": ""
},
"status": "RUNNING",
"createdVariationKey": "createdVariationKey"
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results/{resultId}"
payload = {
"evaluationTokens": { "key": "" },
"generationTokens": { "key": "" },
"generationLatency": 0,
"activity": "PENDING",
"scores": { "key": "" },
"completionResponse": "completionResponse",
"variation": { "key": "" },
"evaluationLatencies": { "key": "" },
"status": "RUNNING",
"createdVariationKey": "createdVariationKey"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
evaluationTokens: {key: ''},
generationTokens: {key: ''},
generationLatency: 0,
activity: 'PENDING',
scores: {key: ''},
completionResponse: 'completionResponse',
variation: {key: ''},
evaluationLatencies: {key: ''},
status: 'RUNNING',
createdVariationKey: 'createdVariationKey'
})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results/{resultId}', 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/{resultId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'evaluationTokens' => [
'key' => ''
],
'generationTokens' => [
'key' => ''
],
'generationLatency' => 0,
'activity' => 'PENDING',
'scores' => [
'key' => ''
],
'completionResponse' => 'completionResponse',
'variation' => [
'key' => ''
],
'evaluationLatencies' => [
'key' => ''
],
'status' => 'RUNNING',
'createdVariationKey' => 'createdVariationKey'
]),
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/{resultId}"
payload := strings.NewReader("{\n \"evaluationTokens\": {\n \"key\": \"\"\n },\n \"generationTokens\": {\n \"key\": \"\"\n },\n \"generationLatency\": 0,\n \"activity\": \"PENDING\",\n \"scores\": {\n \"key\": \"\"\n },\n \"completionResponse\": \"completionResponse\",\n \"variation\": {\n \"key\": \"\"\n },\n \"evaluationLatencies\": {\n \"key\": \"\"\n },\n \"status\": \"RUNNING\",\n \"createdVariationKey\": \"createdVariationKey\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results/{resultId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"evaluationTokens\": {\n \"key\": \"\"\n },\n \"generationTokens\": {\n \"key\": \"\"\n },\n \"generationLatency\": 0,\n \"activity\": \"PENDING\",\n \"scores\": {\n \"key\": \"\"\n },\n \"completionResponse\": \"completionResponse\",\n \"variation\": {\n \"key\": \"\"\n },\n \"evaluationLatencies\": {\n \"key\": \"\"\n },\n \"status\": \"RUNNING\",\n \"createdVariationKey\": \"createdVariationKey\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results/{resultId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"evaluationTokens\": {\n \"key\": \"\"\n },\n \"generationTokens\": {\n \"key\": \"\"\n },\n \"generationLatency\": 0,\n \"activity\": \"PENDING\",\n \"scores\": {\n \"key\": \"\"\n },\n \"completionResponse\": \"completionResponse\",\n \"variation\": {\n \"key\": \"\"\n },\n \"evaluationLatencies\": {\n \"key\": \"\"\n },\n \"status\": \"RUNNING\",\n \"createdVariationKey\": \"createdVariationKey\"\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"
}Update an agent optimization result
Update status, activity, and AI request metadata fields on an agent optimization result.
PATCH
/
api
/
v2
/
projects
/
{projectKey}
/
agent-optimizations
/
{optimizationKey}
/
results
/
{resultId}
Update an agent optimization result
curl --request PATCH \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results/{resultId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"evaluationTokens": {
"key": ""
},
"generationTokens": {
"key": ""
},
"generationLatency": 0,
"activity": "PENDING",
"scores": {
"key": ""
},
"completionResponse": "completionResponse",
"variation": {
"key": ""
},
"evaluationLatencies": {
"key": ""
},
"status": "RUNNING",
"createdVariationKey": "createdVariationKey"
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results/{resultId}"
payload = {
"evaluationTokens": { "key": "" },
"generationTokens": { "key": "" },
"generationLatency": 0,
"activity": "PENDING",
"scores": { "key": "" },
"completionResponse": "completionResponse",
"variation": { "key": "" },
"evaluationLatencies": { "key": "" },
"status": "RUNNING",
"createdVariationKey": "createdVariationKey"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
evaluationTokens: {key: ''},
generationTokens: {key: ''},
generationLatency: 0,
activity: 'PENDING',
scores: {key: ''},
completionResponse: 'completionResponse',
variation: {key: ''},
evaluationLatencies: {key: ''},
status: 'RUNNING',
createdVariationKey: 'createdVariationKey'
})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results/{resultId}', 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/{resultId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'evaluationTokens' => [
'key' => ''
],
'generationTokens' => [
'key' => ''
],
'generationLatency' => 0,
'activity' => 'PENDING',
'scores' => [
'key' => ''
],
'completionResponse' => 'completionResponse',
'variation' => [
'key' => ''
],
'evaluationLatencies' => [
'key' => ''
],
'status' => 'RUNNING',
'createdVariationKey' => 'createdVariationKey'
]),
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/{resultId}"
payload := strings.NewReader("{\n \"evaluationTokens\": {\n \"key\": \"\"\n },\n \"generationTokens\": {\n \"key\": \"\"\n },\n \"generationLatency\": 0,\n \"activity\": \"PENDING\",\n \"scores\": {\n \"key\": \"\"\n },\n \"completionResponse\": \"completionResponse\",\n \"variation\": {\n \"key\": \"\"\n },\n \"evaluationLatencies\": {\n \"key\": \"\"\n },\n \"status\": \"RUNNING\",\n \"createdVariationKey\": \"createdVariationKey\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results/{resultId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"evaluationTokens\": {\n \"key\": \"\"\n },\n \"generationTokens\": {\n \"key\": \"\"\n },\n \"generationLatency\": 0,\n \"activity\": \"PENDING\",\n \"scores\": {\n \"key\": \"\"\n },\n \"completionResponse\": \"completionResponse\",\n \"variation\": {\n \"key\": \"\"\n },\n \"evaluationLatencies\": {\n \"key\": \"\"\n },\n \"status\": \"RUNNING\",\n \"createdVariationKey\": \"createdVariationKey\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/agent-optimizations/{optimizationKey}/results/{resultId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"evaluationTokens\": {\n \"key\": \"\"\n },\n \"generationTokens\": {\n \"key\": \"\"\n },\n \"generationLatency\": 0,\n \"activity\": \"PENDING\",\n \"scores\": {\n \"key\": \"\"\n },\n \"completionResponse\": \"completionResponse\",\n \"variation\": {\n \"key\": \"\"\n },\n \"evaluationLatencies\": {\n \"key\": \"\"\n },\n \"status\": \"RUNNING\",\n \"createdVariationKey\": \"createdVariationKey\"\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"
}Authorizations
Body
application/json
Agent optimization result fields to update
Available options:
RUNNING, PASSED, FAILED, ERRORED Available options:
PENDING, GENERATING, EVALUATING, GENERATING_VARIATION, VALIDATING, COMPLETED Response
Agent optimization result updated
Available options:
RUNNING, PASSED, FAILED, ERRORED Available options:
PENDING, GENERATING, EVALUATING, GENERATING_VARIATION, VALIDATING, COMPLETED Show child attributes
Show child attributes
Example:
{
"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
Example:
{
"parent": { "href": "href", "type": "type" },
"self": { "href": "href", "type": "type" }
}