Class CustomAgentConfig

java.lang.Object
com.github.copilot.sdk.json.CustomAgentConfig

public class CustomAgentConfig extends Object
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 @agent-name mention syntax.

Example Usage


 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));
 
Since:
1.0.0
See Also:
  • Constructor Details

    • CustomAgentConfig

      public CustomAgentConfig()
  • Method Details

    • getName

      public String getName()
      Gets the unique identifier name for this agent.
      Returns:
      the agent name used for @mentions
    • setName

      public CustomAgentConfig setName(String name)
      Sets the unique identifier name for this agent.

      This name is used to mention the agent in messages (e.g., @code-reviewer).

      Parameters:
      name - the agent identifier (alphanumeric and hyphens)
      Returns:
      this config for method chaining
    • getDisplayName

      public String getDisplayName()
      Gets the human-readable display name.
      Returns:
      the display name shown to users
    • setDisplayName

      public CustomAgentConfig setDisplayName(String displayName)
      Sets the human-readable display name.
      Parameters:
      displayName - the friendly name for the agent
      Returns:
      this config for method chaining
    • getDescription

      public String getDescription()
      Gets the agent description.
      Returns:
      the description of what this agent does
    • setDescription

      public CustomAgentConfig setDescription(String description)
      Sets a description of the agent's capabilities.

      This helps users understand when to use this agent.

      Parameters:
      description - the agent description
      Returns:
      this config for method chaining
    • getTools

      public List<String> getTools()
      Gets the list of tool names available to this agent.
      Returns:
      the list of tool identifiers
    • setTools

      public CustomAgentConfig setTools(List<String> tools)
      Sets the tools available to this agent.

      These can reference both built-in tools and custom tools registered in the session.

      Parameters:
      tools - the list of tool names
      Returns:
      this config for method chaining
    • getPrompt

      public String getPrompt()
      Gets the system prompt for this agent.
      Returns:
      the agent's system prompt
    • setPrompt

      public CustomAgentConfig setPrompt(String prompt)
      Sets the system prompt that defines this agent's behavior.

      This prompt is used to customize the agent's responses and capabilities.

      Parameters:
      prompt - the system prompt
      Returns:
      this config for method chaining
    • getMcpServers

      public Map<String,McpServerConfig> getMcpServers()
      Gets the MCP server configurations for this agent.
      Returns:
      the MCP servers map
    • setMcpServers

      public CustomAgentConfig setMcpServers(Map<String,McpServerConfig> mcpServers)
      Sets MCP (Model Context Protocol) servers available to this agent.
      Parameters:
      mcpServers - the MCP server configurations
      Returns:
      this config for method chaining
    • getInfer

      public Boolean getInfer()
      Gets whether inference mode is enabled.
      Returns:
      the infer flag, or null if not set
    • setInfer

      public CustomAgentConfig setInfer(Boolean infer)
      Sets whether to enable inference mode for this agent.
      Parameters:
      infer - true to enable inference mode
      Returns:
      this config for method chaining
    • getSkills

      public List<String> getSkills()
      Gets the list of skill names to preload into this agent's context.
      Returns:
      the list of skill names, or null if not set
    • setSkills

      public CustomAgentConfig setSkills(List<String> skills)
      Sets the list of skill names to preload into this agent's context.

      When set, the full content of each listed skill is eagerly injected into the agent's context at startup. Skills are resolved by name from the session's configured skill directories (SessionConfig.setSkillDirectories(List)). When omitted, no skills are injected (opt-in model).

      Parameters:
      skills - the list of skill names to preload
      Returns:
      this config for method chaining