trigger_optimization
Start a new optimization process for an agent. Returns the optimization process ID.
IMPORTANT PREREQUISITES (optimization will fail without these):
RUNS REQUIRED: The agent must have run transcripts uploaded via create_run. Optimization analyzes real user/AI dialogues to improve the agent - it cannot run without them.
Business context (industry and/or objectives) must be set via sync_context_from_url or update_settings.
You can either:
Use an existing agent: provide agentId
Auto-create a new agent: provide prompt + agentName + llmModel
When auto-creating, the agent will be created and activated automatically before optimization starts. NOTE: Even with auto-create, you must still upload runs using create_run before triggering optimization.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Optimization mode: 'validation' for statistical rigor, 'exploratory' for faster iteration (default: exploratory) | |
| intent | No | Optional optimization intent to guide the process | |
| prompt | No | The agent's system prompt content to optimize. Required if agentId is not provided. | |
| agentId | No | The ID of an existing agent to optimize. If not provided, use prompt + agentName + llmModel to auto-create. | |
| llmModel | No | LLM model for the auto-created agent (e.g., 'gpt-4o', 'claude-sonnet-5-5', 'o1'). Required if using prompt content. | |
| agentName | No | Display name for the auto-created agent. Required if using prompt content instead of agentId. | |
| customerId | No | (Converra superadmin only) Target customer ID to act on behalf of | |
| personaIds | No | Specific persona IDs to test against (use list_personas to find IDs) | |
| variantCount | No | Number of variants to generate and test (default: 3, max: 5) | |
| customVariants | No | Custom variant content to test. Each variant needs either 'content' (full prompt) or 'diff' (unified diff patch applied to baseline). | |
| simulationType | No | Simulation policy override. Context-grounded modes require eligible runtime context for this exact agent prompt. | |
| agentDescription | No | Optional description for the auto-created agent. |