/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. *--------------------------------------------------------------------------------------------*/ package com.github.copilot.sdk.json; import java.util.Collections; import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; /** * Configuration for a custom agent in a Copilot session. *
* Custom agents extend the capabilities of the base Copilot assistant with * specialized behavior, tools, and prompts. Each agent can be referenced in * messages using the {@code @agent-name} mention syntax. * *
{@code
* var agent = new CustomAgentConfig().setName("code-reviewer").setDisplayName("Code Reviewer")
* .setDescription("Reviews code for best practices").setPrompt("You are a code review expert...")
* .setTools(List.of("read_file", "search_code"));
*
* var config = new SessionConfig().setCustomAgents(List.of(agent));
* }
*
* @see SessionConfig#setCustomAgents(List)
* @since 1.0.0
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CustomAgentConfig {
@JsonProperty("name")
private String name;
@JsonProperty("displayName")
private String displayName;
@JsonProperty("description")
private String description;
@JsonProperty("tools")
private List* This name is used to mention the agent in messages (e.g., * {@code @code-reviewer}). * * @param name * the agent identifier (alphanumeric and hyphens) * @return this config for method chaining */ public CustomAgentConfig setName(String name) { this.name = name; return this; } /** * Gets the human-readable display name. * * @return the display name shown to users */ public String getDisplayName() { return displayName; } /** * Sets the human-readable display name. * * @param displayName * the friendly name for the agent * @return this config for method chaining */ public CustomAgentConfig setDisplayName(String displayName) { this.displayName = displayName; return this; } /** * Gets the agent description. * * @return the description of what this agent does */ public String getDescription() { return description; } /** * Sets a description of the agent's capabilities. *
* This helps users understand when to use this agent.
*
* @param description
* the agent description
* @return this config for method chaining
*/
public CustomAgentConfig setDescription(String description) {
this.description = description;
return this;
}
/**
* Gets the list of tool names available to this agent.
*
* @return the list of tool identifiers
*/
public List
* These can reference both built-in tools and custom tools registered in the
* session.
*
* @param tools
* the list of tool names
* @return this config for method chaining
*/
public CustomAgentConfig setTools(List
* This prompt is used to customize the agent's responses and capabilities.
*
* @param prompt
* the system prompt
* @return this config for method chaining
*/
public CustomAgentConfig setPrompt(String prompt) {
this.prompt = prompt;
return this;
}
/**
* Gets the MCP server configurations for this agent.
*
* @return the MCP servers map
*/
public Map