/ docs / docs / documentation / components / gateways.md
gateways.md
  1  ---
  2  title: Gateways
  3  sidebar_position: 260
  4  ---
  5  
  6  import NetworkAccessRequiredSomeFeatures from '@site/docs/partials/network-access-required-some-features.mdx';
  7  
  8  # Gateways
  9  
 10  Gateways are a crucial component of the Agent Mesh framework that expose the agent mesh to external systems through various protocols. Built on a common base gateway architecture, they provide the following functions:
 11  
 12  - serve as the primary interface between Agent Mesh and the outside world
 13  - manage the flow of information in and out of the system through the A2A protocol
 14  - handle authentication, user enrichment, and message processing
 15  - support multiple interface types including REST, HTTP SSE, webhooks, and event mesh connectivity
 16  
 17  :::tip[In one sentence]
 18  Gateways are the external interfaces that connect various systems to the A2A agent mesh through standardized protocols.
 19  :::
 20  
 21  <NetworkAccessRequiredSomeFeatures />
 22  
 23  ## Key Functions
 24  
 25  1. **Entry Points**: Gateways act as the entry points from the outside world and translate external requests into A2A protocol messages and route them through the Solace event mesh to appropriate agents.
 26  
 27  2. **Authentication & Authorization**: Common authentication and user enrichment flow across all gateway types, with pluggable identity providers.
 28  
 29  3. **Configurable System Purpose**: Each gateway has a configurable system purpose that sets the context for all stimuli entering Agent Mesh through that gateway. This design allows for tailored processing based on the specific use case or domain.
 30  
 31  4. **Customizable Output Formatting**: Gateways have a configurable output description that controls how stimuli responses are formatted when sent back to the outside world. This configurable output description ensures that the output meets the requirements of the receiving system or user interface.
 32  
 33  5. **Multiple Interface Types**: Gateways can have different interfaces to accommodate various communication protocols and systems. Some examples include REST APIs, event meshes, Slack integrations, browser-based interfaces, and so on.
 34  
 35  ## How Gateways Work
 36  
 37  The following diagram illustrates the complete flow of information through a gateway in Agent Mesh:
 38  
 39  ```mermaid
 40  sequenceDiagram
 41      participant External as External System/User
 42      participant Gateway
 43      participant Mesh as Agent Mesh
 44  
 45      rect rgba(234, 234, 234, 1)
 46          Note over External,Gateway: Authentication Phase [Optional]
 47          External->>Gateway: Send Request
 48          Gateway->> Gateway: Authenticate Request
 49          alt Authentication Failed
 50              Gateway-->>External: Return Error
 51          end
 52      end
 53  
 54      rect rgba(234, 234, 234, 1)
 55          Note over Gateway: Authorization Phase [Optional]
 56      end
 57  
 58      rect rgba(234, 234, 234, 1)
 59          Note over Gateway,Mesh: Processing Phase
 60          Gateway->>Gateway: Apply System Purpose
 61          Gateway->>Gateway: Attach Format Rules
 62          Gateway->>Gateway: Format Response
 63          Gateway->>Gateway: Transform to Stimulus
 64          Gateway->>Mesh: Send Stimulus
 65  
 66          alt Response Expected
 67              Mesh-->>Gateway: Return Response
 68              Gateway-->>External: Send Formatted Response
 69          end
 70      end
 71  
 72      %%{init: {
 73          'theme': 'base',
 74          'themeVariables': {
 75              'actorBkg': '#00C895',
 76              'actorBorder': '#00C895',
 77              'actorTextColor': '#000000',
 78              'noteBkgColor': '#FFF7C2',
 79              'noteTextColor': '#000000',
 80              'noteBorderColor': '#FFF7C2'
 81          }
 82      }}%%
 83  
 84  ```
 85  
 86  ## Available Gateways
 87  
 88  Agent Mesh comes with several built-in gateway types:
 89  
 90  ### Core Gateways
 91  
 92  1. **HTTP SSE Gateway**
 93     - Real-time web interface with streaming responses
 94     - Server-sent events for live updates
 95     - Agent discovery API
 96     - File upload and download handling
 97  
 98  2. **REST Gateway**
 99     - Task submission with immediate task ID return
100     - Polling-based result retrieval
101     - Authentication integration
102  
103  3. **Webhook Gateway**
104     - Handles incoming webhook requests
105     - Transforms webhook payloads to A2A messages
106  
107  ### Plugin Gateways
108  
109  Additional gateway types are available through the plugin ecosystem:
110  
111  - **Event Mesh Gateway**: External event mesh connectivity with message transformation
112  - **Slack Gateway**: Slack bot integration for team collaboration
113  - **Microsoft Teams Gateway** *(Enterprise)*: Teams bot integration with Azure AD authentication, file sharing, and real-time streaming responses (Docker deployment only)
114  - **Custom Gateways**: Create your own gateway implementations
115  
116  For more information about plugins and how to configure them, see [Plugins](./plugins.md).
117  
118  One of the official core plugin gateway interfaces is the [Solace Event Mesh Gateway](https://github.com/SolaceLabs/solace-agent-mesh-core-plugins/tree/main/sam-event-mesh-gateway), which enables communication with the event broker directly as an input interface.
119  
120  :::note
121  Each gateway type has its own configuration options and specific features. See the individual gateway documentation pages for detailed information on setup and usage.
122  :::
123  
124  ## Create a Gateway
125  
126  To create a gateway, you can either [use one of the pre-existing plugins](./plugins.md#use-a-plugin) or create yours from scratch.
127  
128  
129  ### Gateway from Scratch
130  
131  To create a gateway from scratch, you need to use the CLI `add gateway` command without any interfaces. This command creates a _python gateway template file_ which you can then customize to your needs.
132  
133  ```sh
134  sam add gateway my-interface
135  ```
136  
137  To learn more about creating your own gateway, see [Creating Custom Gateways](../developing/create-gateways.md).
138  
139  :::tip[Share and Reuse]
140  If you would like to share your custom gateway with the community or re-use it within other projects, you can create a plugin for it. For more information, see [Create Plugins](./plugins.md#create-a-plugin).
141  :::