# Interface AgentLoader

All Known Implementing Classes:
  `AgentStaticLoader, CompiledAgentLoader, ConfigAgentLoader`

@ThreadSafe public interface AgentLoader
Interface for loading agents to the ADK Web Server.

Users implement this interface to register their agents with ADK Web Server.

Thread Safety: Implementation must be thread-safe as it will be used as Spring singleton beans and accessed concurrently by multiple HTTP requests.

Example usage:

    public class MyAgentLoader implements AgentLoader {
      @Override
      public ImmutableList<String> listAgents() {
        return ImmutableList.of("chat_bot", "code_assistant");
      }

      @Override
      public BaseAgent loadAgent(String name) {
        switch (name) {
          case "chat_bot": return createChatBot();
          case "code_assistant": return createCodeAssistant();
          default: throw new java.util.NoSuchElementException("Agent not found: " + name);
        }
      }
    }

Then use with Maven plugin:

    mvn google-adk:web -Dagents=com.acme.MyAgentLoader

- ## Method Summary

  Modifier and Type
  Method
  Description
  `com.google.common.collect.ImmutableList<String>`
  `listAgents()`
  Returns a list of available agent names.
  `BaseAgent`
  `loadAgent(String name)`
  Loads the BaseAgent instance for the specified agent name.

- ## Method Details

  - ### listAgents

    @Nonnull com.google.common.collect.ImmutableList<String> listAgents()
    Returns a list of available agent names.
    Returns:
      ImmutableList of agent names. Must not return null - return an empty list if no agents are available.

  - ### loadAgent

    BaseAgent loadAgent(String name)
    Loads the BaseAgent instance for the specified agent name.
    Parameters:
      `name` - the name of the agent to load
    Returns:
      BaseAgent instance for the given name
    Throws:
      `NoSuchElementException` - if the agent doesn't exist
      `IllegalStateException` - if the agent exists but fails to load