aiconfig-create

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Create AI Config

创建AI Config

You're using a skill that will guide you through setting up AI configuration in your application. Your job is to explore the codebase to understand the use case and stack, choose agent vs completion mode, create the config following the right path, and verify it works.
你正在使用一个能引导你在应用中设置AI配置的skill。你的任务是探索代码库以了解使用场景和技术栈,选择Agent模式或Completion模式,遵循正确流程创建配置,并验证其是否可用。

Prerequisites

前提条件

  • LaunchDarkly API access token with
    ai-configs:write
    permission or MCP server
  • LaunchDarkly project (use
    aiconfig-projects
    skill if needed)
  • 拥有
    ai-configs:write
    权限的LaunchDarkly API访问令牌,或MCP服务器
  • LaunchDarkly项目(如有需要,使用
    aiconfig-projects
    skill)

Core Principles

核心原则

  1. Understand the Use Case First: Know what you're building before choosing a mode
  2. Choose the Right Mode: Agent mode vs completion mode depends on your framework and needs
  3. Two-Step Creation: Create config first, then create variations (model, prompts, parameters)
  4. Verify via API: The agent fetches the config to confirm it was created correctly
  1. 先理解使用场景:在选择模式前,明确你要构建的内容
  2. 选择合适的模式:Agent模式与Completion模式的选择取决于你的框架和需求
  3. 两步创建法:先创建配置,再创建变体(模型、提示词、参数)
  4. 通过API验证:Agent会获取配置以确认其已正确创建

API Key Detection

API密钥检测

  1. Check environment variables
    LAUNCHDARKLY_API_KEY
    ,
    LAUNCHDARKLY_API_TOKEN
    ,
    LD_API_KEY
  2. Check MCP config — Claude:
    ~/.claude/config.json
    mcpServers.launchdarkly.env.LAUNCHDARKLY_API_KEY
  3. Prompt user — Only if detection fails
  1. 检查环境变量
    LAUNCHDARKLY_API_KEY
    LAUNCHDARKLY_API_TOKEN
    LD_API_KEY
  2. 检查MCP配置 — Claude:
    ~/.claude/config.json
    mcpServers.launchdarkly.env.LAUNCHDARKLY_API_KEY
  3. 提示用户 — 仅当检测失败时执行

Workflow

工作流程

Step 1: Understand Your Use Case

步骤1:理解你的使用场景

Before creating, identify what you're building:
  • What framework? LangGraph, LangChain, CrewAI, OpenAI SDK, Anthropic SDK, custom
  • What does the AI need? Just text, or tools/function calling?
  • Agent or completion? See decision below
创建前,明确你要构建的内容:
  • 使用什么框架? LangGraph、LangChain、CrewAI、OpenAI SDK、Anthropic SDK、自定义框架
  • AI需要实现什么功能? 仅生成文本,还是需要工具/函数调用?
  • 选择Agent模式还是Completion模式? 参考下方决策指南

Step 2: Choose Agent vs Completion Mode

步骤2:选择Agent模式与Completion模式

Your NeedMode
Persistent instructions across interactionsAgent
LangGraph, CrewAI, AutoGenAgent
Direct OpenAI/Anthropic API callsCompletion
Full control of message structureCompletion
One-off text generationCompletion
Both modes support tools. Agent mode: single
instructions
string. Completion mode: full
messages
array.
你的需求模式
交互过程中保留持久化指令Agent
使用LangGraph、CrewAI、AutoGenAgent
直接调用OpenAI/Anthropic APICompletion
完全控制消息结构Completion
一次性文本生成Completion
两种模式均支持工具调用。Agent模式:使用单个
instructions
字符串;Completion模式:使用完整的
messages
数组。

Step 3: Create the Config

步骤3:创建配置

Follow API Quick Start for curl examples:
  1. Create config
    POST /projects/{projectKey}/ai-configs
    (key, name, mode)
  2. Create variation
    POST /projects/{projectKey}/ai-configs/{configKey}/variations
    (instructions or messages, modelConfigKey, model.parameters)
  3. Attach tools — After creation, PATCH variation to add tools (see
    aiconfig-tools
    skill)
参考API快速入门中的curl示例:
  1. 创建配置
    POST /projects/{projectKey}/ai-configs
    (参数包括key、name、mode)
  2. 创建变体
    POST /projects/{projectKey}/ai-configs/{configKey}/variations
    (参数包括instructions或messages、modelConfigKey、model.parameters)
  3. 关联工具 — 创建完成后,通过PATCH请求为变体关联工具(参考
    aiconfig-tools
    skill)

Step 4: Verify

步骤4:验证

After creation, verify the config:
  1. Fetch via API:
    bash
    curl -X GET "https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}" \
      -H "Authorization: {api_token}" -H "LD-API-Version: beta"
  2. Confirm:
    • Config exists with correct mode
    • Variations have model names (not "NO MODEL")
    • modelConfigKey is set
    • Parameters are present
  3. Report results:
    • ✓ Config created with correct structure
    • ✓ Variations have models assigned
    • ⚠️ Flag any missing model or parameters
    • Provide config URL:
      https://app.launchdarkly.com/projects/{projectKey}/ai-configs/{configKey}
创建完成后,验证配置:
  1. 通过API获取配置
    bash
    curl -X GET "https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}" \
      -H "Authorization: {api_token}" -H "LD-API-Version: beta"
  2. 确认内容
    • 配置已存在且模式正确
    • 变体已分配模型名称(而非“NO MODEL”)
    • modelConfigKey已设置
    • 参数已配置
  3. 反馈结果
    • ✓ 配置已创建且结构正确
    • ✓ 变体已分配模型
    • ⚠️ 标记任何缺失的模型或参数
    • 提供配置URL:
      https://app.launchdarkly.com/projects/{projectKey}/ai-configs/{configKey}

Important Notes

重要提示

  • modelConfigKey must be
    {Provider}.{model-id}
    (e.g.,
    OpenAI.gpt-4o
    ) for models to show in UI
  • Tools must be created first (
    aiconfig-tools
    skill), then attached via PATCH
  • Tools endpoint is
    /ai-tools
    , NOT
    /ai-configs/tools
  • modelConfigKey必须为
    {Provider}.{model-id}
    格式(例如
    OpenAI.gpt-4o
    ),这样模型才能在UI中显示
  • 工具必须先创建(使用
    aiconfig-tools
    skill),再通过PATCH请求关联
  • 工具端点
    /ai-tools
    ,而非
    /ai-configs/tools

Edge Cases

边缘情况处理

SituationAction
Config already existsAsk if user wants to update instead
Variation shows "NO MODEL"PATCH variation with modelConfigKey and model
Invalid modelConfigKeyUse values from model-configs API
场景操作
配置已存在询问用户是否需要更新配置
变体显示“NO MODEL”通过PATCH请求为变体添加modelConfigKey和模型信息
无效的modelConfigKey使用model-configs API返回的有效值

What NOT to Do

相关Skill

  • Don't create configs without understanding the use case
  • Don't skip the two-step process (config then variation)
  • Don't try to attach tools during initial creation
  • Don't forget modelConfigKey (models won't show)
  • aiconfig-tools
    — 关联工具前先创建工具
  • aiconfig-variations
    — 添加更多变体用于实验
  • aiconfig-update
    — 根据经验修改配置

Related Skills

参考资料

  • aiconfig-tools
    — Create tools before attaching
  • aiconfig-variations
    — Add more variations for experimentation
  • aiconfig-update
    — Modify configs based on learnings

References