ワンクリックで
aiconfig-update
Update and delete LaunchDarkly AI Configs. Learn how to modify existing AI Configs and manage their lifecycle.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Update and delete LaunchDarkly AI Configs. Learn how to modify existing AI Configs and manage their lifecycle.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Create a new LaunchDarkly AI Config with variations, model configurations, and targeting. Use this skill to programmatically create AI Configs for agent or completion mode.
Configure LaunchDarkly AI Config targeting rules via API to control which users receive specific variations. Enable A/B tests, percentage splits, segment targeting, and multi-context rules.
Create, manage, and attach tools (functions) to LaunchDarkly AI Configs. Tools enable AI agents to interact with external systems, APIs, and databases.
Manage AI Config variations - add, update, retrieve, and delete variations from existing configs. Test different models, prompts, parameters, and tools within a single AI Config.
Access LaunchDarkly AI Configs through the REST API. Learn how to authenticate and perform operations not available through SDKs.
Build safe, scalable contexts for LaunchDarkly AI Configs with cardinality controls, multi-context patterns, and agent graph attributes.
| name | aiconfig-update |
| description | Update and delete LaunchDarkly AI Configs. Learn how to modify existing AI Configs and manage their lifecycle. |
| compatibility | Requires LaunchDarkly project with AI Configs enabled and API access token. |
| metadata | {"author":"launchdarkly","version":"0.1.0"} |
Update existing LaunchDarkly AI Configs and manage their lifecycle. This skill covers updating config properties, archiving configs, and deleting them when no longer needed.
Note: The LaunchDarkly MCP server has
update-ai-configanddelete-ai-configtools for basic operations. Use the REST API below for full functionality. Seeaiconfig-apifor details.
Before prompting the user for an API key, try to detect it automatically:
~/.claude/config.json and look for mcpServers.launchdarkly.env.LAUNCHDARKLY_API_KEYLAUNCHDARKLY_API_KEY, LAUNCHDARKLY_API_TOKEN, or LD_API_KEYimport os
import json
from pathlib import Path
def get_launchdarkly_api_key():
"""Auto-detect LaunchDarkly API key from Claude config or environment."""
# 1. Check Claude MCP config
claude_config = Path.home() / ".claude" / "config.json"
if claude_config.exists():
try:
config = json.load(open(claude_config))
api_key = config.get("mcpServers", {}).get("launchdarkly", {}).get("env", {}).get("LAUNCHDARKLY_API_KEY")
if api_key:
return api_key
except (json.JSONDecodeError, IOError):
pass
# 2. Check environment variables
for var in ["LAUNCHDARKLY_API_KEY", "LAUNCHDARKLY_API_TOKEN", "LD_API_KEY"]:
if os.environ.get(var):
return os.environ[var]
return None
AI Config lifecycle management includes:
Update an existing AI Config's properties using a PATCH request:
import requests
import json
# Configuration
API_TOKEN = "your-api-token"
PROJECT_KEY = "your-project"
CONFIG_KEY = "your-config-key"
# Update config properties
url = f"https://app.launchdarkly.com/api/v2/projects/{PROJECT_KEY}/ai-configs/{CONFIG_KEY}"
headers = {
"Authorization": f"{API_TOKEN}",
"Content-Type": "application/json"
}
# Update data - simple object with fields to update
patch_data = {
"name": "Updated AI Config Name",
"description": "Updated description for the AI Config"
}
response = requests.patch(url, headers=headers, json=patch_data)
if response.status_code == 200:
print("[OK] AI Config updated successfully")
data = response.json()
print(f" Name: {data.get('name')}")
print(f" Description: {data.get('description')}")
else:
print(f"[ERROR] {response.status_code}: {response.text}")
Archiving temporarily disables an AI Config while preserving all its data:
def archive_config(project_key, config_key, api_token, archive=True):
"""Archive or unarchive an AI Config"""
url = f"https://app.launchdarkly.com/api/v2/projects/{project_key}/ai-configs/{config_key}"
headers = {
"Authorization": f"{api_token}",
"Content-Type": "application/json"
}
patch_data = {"archived": archive}
response = requests.patch(url, headers=headers, json=patch_data)
if response.status_code == 200:
status = "archived" if archive else "unarchived"
print(f"[OK] AI Config {status} successfully")
return response.json()
else:
print(f"[ERROR] {response.status_code}: {response.text}")
return None
# Archive a config
archive_config(PROJECT_KEY, CONFIG_KEY, API_TOKEN, archive=True)
# Unarchive a config
archive_config(PROJECT_KEY, CONFIG_KEY, API_TOKEN, archive=False)
Permanently delete an AI Config. This operation cannot be undone:
def delete_config(project_key, config_key, api_token, confirm=False):
"""Permanently delete an AI Config
Args:
confirm: Must be True to actually delete (safety check)
"""
url = f"https://app.launchdarkly.com/api/v2/projects/{project_key}/ai-configs/{config_key}"
headers = {
"Authorization": f"{api_token}"
}
if not confirm:
print(f"[WARNING] Delete skipped - set confirm=True to delete '{config_key}'")
return False
response = requests.delete(url, headers=headers)
if response.status_code == 204:
print(f"[OK] AI Config '{config_key}' deleted successfully")
return True
else:
print(f"[ERROR] deleting config: {response.status_code}")
print(response.text)
return False
# Delete a config (requires confirm=True)
delete_config(PROJECT_KEY, CONFIG_KEY, API_TOKEN, confirm=True)
Update multiple configs efficiently:
def batch_update_configs(project_key, updates, api_token):
"""Update multiple AI Configs"""
results = []
for config_key, patch_data in updates.items():
url = f"https://app.launchdarkly.com/api/v2/projects/{project_key}/ai-configs/{config_key}"
headers = {
"Authorization": f"{api_token}",
"Content-Type": "application/json"
}
response = requests.patch(url, headers=headers, json=patch_data)
results.append({
"config_key": config_key,
"success": response.status_code == 200,
"status_code": response.status_code
})
return results
# Example batch update
updates = {
"config-1": {"name": "Updated Config 1"},
"config-2": {"archived": True},
"config-3": {"description": "New description"}
}
results = batch_update_configs(PROJECT_KEY, updates, API_TOKEN)
for result in results:
print(f"{result['config_key']}: {'Success' if result['success'] else 'Failed'}")
The AI Config update endpoint accepts a simple object with fields to update:
| Field | Description | Value Type |
|---|---|---|
name | Config display name | string |
description | Config description | string |
archived | Archive status | boolean |
tags | Config tags | array of strings |
Handle common update and delete errors:
def safe_update_config(project_key, config_key, patch_data, api_token):
"""Update config with comprehensive error handling"""
url = f"https://app.launchdarkly.com/api/v2/projects/{project_key}/ai-configs/{config_key}"
headers = {
"Authorization": f"{api_token}",
"Content-Type": "application/json"
}
try:
response = requests.patch(url, headers=headers, json=patch_data)
if response.status_code == 200:
return {"success": True, "data": response.json()}
elif response.status_code == 400:
return {"success": False, "error": "Invalid request format"}
elif response.status_code == 404:
return {"success": False, "error": "AI Config not found"}
elif response.status_code == 409:
return {"success": False, "error": "Conflict - config may have been modified"}
else:
return {"success": False, "error": f"Unexpected error: {response.status_code}"}
except requests.exceptions.RequestException as e:
return {"success": False, "error": f"Request failed: {str(e)}"}
# Use with error handling
result = safe_update_config(
PROJECT_KEY,
CONFIG_KEY,
{"name": "New Name"},
API_TOKEN
)
if result["success"]:
print("[OK] Update successful")
else:
print(f"[ERROR] Update failed: {result['error']}")
Always export config data before deletion using the API to GET the config and save to a file.
Archive configs before deletion to ensure they're no longer needed:
Check the update object before applying - ensure it only contains valid fields (name, description, archived, tags).
Update, archive, and manage an AI Config lifecycle:
import requests
import json
class AIConfigManager:
def __init__(self, project_key, api_token):
self.project_key = project_key
self.api_token = api_token
self.base_url = f"https://app.launchdarkly.com/api/v2/projects/{project_key}"
self.headers = {
"Authorization": api_token,
"Content-Type": "application/json"
}
def update(self, config_key, patch_data):
"""Update an AI Config"""
url = f"{self.base_url}/ai-configs/{config_key}"
response = requests.patch(url, headers=self.headers, json=patch_data)
return response.status_code == 200, response
def archive(self, config_key):
"""Archive an AI Config"""
return self.update(config_key, {"archived": True})
def unarchive(self, config_key):
"""Unarchive an AI Config"""
return self.update(config_key, {"archived": False})
def delete(self, config_key):
"""Delete an AI Config"""
url = f"{self.base_url}/ai-configs/{config_key}"
response = requests.delete(url, headers={"Authorization": self.api_token})
return response.status_code == 204
# Usage
manager = AIConfigManager(PROJECT_KEY, API_TOKEN)
success, response = manager.update("test-config", {"description": "Updated via AIConfigManager"})
aiconfig-create - Create configs firstaiconfig-api - API reference for updatesaiconfig-variations - Update variationsaiconfig-tools - Update tool attachmentsaiconfig-targeting - Update targeting rulesaiconfig-experiments - Update experiment settings