Skip to main content

Agents SDK Architecture

The main building blocks of the Agents SDK architecture are:

  1. Server Application: Enables communication between agents and external systems through transport protocols like HTTP.
  2. Chat Agents: Individual agents that implement the ChatAgent interface. The agents are plugins developed outside the SDK and registered with the ChatAgentFactory.
  3. Agent Dependencies: External dependencies that agents may require, such as services, APIs, or other configurable objects. The dependencies are plugins developed outside the SDK and registered with the AgentDependencyRegistry.

Components and Interaction

1. Transport Layer

The Transport Layer is responsible for handling external communication with the API server. This layer includes the HTTP Controller, which receives requests from clients and sends them commands to the service layer.

  • HTTP Controller: Receives incoming HTTP requests, parses the payload into the appropriate command format, and forwards the command to the Message Bus for processing. Later, it parses an HTTP payload from the Message Bus response and sends it back to the client.

2. Infrastructure

The Infrastructure layer includes various support services and registries that provide necessary context and dependencies for the application.

  • Bootstrap: Initializes the core dependencies of the application, which are injected into the handlers at runtime. The boostrap takes the following dependencies:

    • Agent Setup Retriever: Retrieves the configuration settings for agents. Configurations may come from different sources, including tenant settings or local environment files.

      • Types of Setup Retrievers:
        • AgentSetupRetrieverFromTenantSettings: Retrieves configurations from tenant settings within the Zeta Alpha platform.
        • LocalAgentSetupRetriever: Uses a local mapping of agent names to AgentSetup objects for local development.
        • AgentSetupRetrieverFromFile: Loads configuration mappings from a JSON file for local development.
    • Chat Agent Factory: Responsible for registering and creating instances of chat agents. Developers register their agent implementations with this factory.

    • Agent Dependency Registry: Manages the registration and creation of external dependencies for agents. Dependencies are specified as plugins and include services or other configurable objects.

    • Debug Backend: The chat agents include a debug method that can be used to log messages and debug information. The debug backend provides the infrastructure for this.

3. Service Layer

The Service Layer handles the flow of messages and commands between different parts of the application.

  • Message Bus: Acts as a central coordinator, forwarding commands from the transport layer to the appropriate handlers.

  • Handlers: Process the commands received from the Message Bus. Each handler is responsible for a specific type of command. Handlers retrieve the agent setup from the Agent Setup Retriever, initialize the agent dependencies from the Agent Dependency Registry, and create instances of chat agents using the Chat Agent Factory. The handlers then pass the conversation into agent instance and yield its response.

4. Application Domain

The Application Domain includes the core entities and business logic for agents.

  • Chat Agent: The main entity representing an agent's business logic. Developers implement the ChatAgent interface to create custom agents. These agents handle conversations and produce a Chat Message response based on the incoming conversation.