Skip to main content

The Solace Agent Mesh (SAM) REST API Gateway provides a standard, robust, and secure HTTP-based entry point for programmatic and system-to-system integrations. It allows external clients to submit tasks to SAM agents, manage files, and discover agent capabilities using a familiar RESTful interface.

Project description

Rest Gateway SAM Plugin

About Solace Agent Mesh

Solace Agent Mesh (SAM) is an open-source framework for building event-driven, multi-agent AI systems where specialized agents collaborate on complex tasks. It provides a standardized way for agents to communicate, share data, and integrate with external systems while keeping components loosely coupled and production-ready.

SAM helps you:

  • Build event-driven multi-agent systems on Solace Event Mesh
  • Connect agents, tools, gateways, and services through a common runtime
  • Extend projects with installable plugins such as sam-rest-gateway

Learn more in the Solace Agent Mesh documentation and the main project repository.

Overview

The Solace Agent Mesh (SAM) REST API Gateway provides a standard, robust, and secure HTTP-based entry point for programmatic and system-to-system integrations. It allows external clients to submit tasks to SAM agents, manage files, and discover agent capabilities using a familiar RESTful interface.

The gateway is designed to be highly configurable and supports two distinct operational modes to cater to both modern, asynchronous workflows and legacy, synchronous systems.

Key Features

  • Dual API Versions: Supports both a modern asynchronous API (v2) and a deprecated synchronous API (v1) for backward compatibility.
  • Asynchronous by Default: The v2 API uses a "202 Accepted + Poll" pattern, ideal for long-running agent tasks.
  • Delegated Authentication: Integrates with an external authentication service via bearer tokens for secure access.
  • File Handling: Supports file uploads for tasks and provides download URLs for generated artifacts.
  • Dynamic Configuration: All gateway behaviors, including server settings and authentication, are configured via the main SAM Host YAML file.

Installation

Once the plugin is installed (e.g., from PyPI or a local wheel file):

sam plugin add <your-new-component-name> --plugin sam-rest-gateway

This will create a new component configuration at configs/plugins/<your-new-component-name-kebab-case>.yaml.

Configuration

The gateway is configured within the app_config section of its app definition in your main SAM Host YAML file.

Example Configuration:

# In your main SAC config file, under the 'apps:' list
- name: my_rest_gateway_app
  app_module: solace_agent_mesh.gateway.rest.app
  app_base_path: src
  broker:
    # Standard A2A Control Plane broker connection details
    <<: *broker_connection
  app_config:
    # --- Base Gateway Config ---
    namespace: "my-org/dev"
    gateway_id: "rest-gw-01"
    artifact_service:
      type: "filesystem"
      base_path: "/tmp/sam_artifacts"
    identity_service:
      type: "local_file"
      file_path: "config/users.json"

    # --- REST Gateway Specific Config ---
    rest_api_server_host: "0.0.0.0"
    rest_api_server_port: 8080
    sync_mode_timeout_seconds: 60 # Timeout for the v1 synchronous API

    # --- Authentication Config ---
    enforce_authentication: true
    external_auth_service_url: "http://my-auth-server:8080"

Configuration Parameters

  • rest_api_server_host (string, optional, default: "127.0.0.1"): Host address for the embedded FastAPI server.
  • rest_api_server_port (integer, optional, default: 8080): Port for the embedded FastAPI server.
  • sync_mode_timeout_seconds (integer, optional, default: 60): Timeout in seconds for synchronous v1 API calls.
  • enforce_authentication (boolean, optional, default: false): If true, all API endpoints (except /health and /api/health) will require a valid bearer token.
  • external_auth_service_url (string, optional): URL of the external authentication service for token validation. Required if enforce_authentication is true.

API Documentation

The REST Gateway provides interactive API documentation (Swagger UI) for both of its API versions. The documentation is generated automatically from the code and is the single source of truth for all endpoints, parameters, and data models.

v2 API (Asynchronous)

The v2 API is the recommended interface for all new integrations. It is non-blocking and suitable for tasks of any duration.

Workflow:

  1. Client sends POST /api/v2/tasks with the agent task details.
  2. Gateway immediately responds with 202 Accepted and a taskId.
  3. Client polls GET /api/v2/tasks/{taskId} until it receives a 200 OK with the final result.
  4. If the result contains artifacts, the client uses the endpoints under /api/v2/artifacts to download them.

v1 API (Legacy, Synchronous - DEPRECATED)

The v1 API is provided for backward compatibility with systems that cannot handle an asynchronous workflow. It is not recommended for new development and may be removed in a future version.

Workflow:

  1. Client sends POST /api/v1/invoke with the agent task details.
  2. The gateway holds the HTTP connection open, waiting for the agent to complete the task.
  3. The gateway returns a 200 OK with the final result in the response body, including any artifact content embedded as base64.

Warning: This endpoint is subject to the sync_mode_timeout_seconds configuration and is not suitable for long-running tasks.

Health Check

The gateway provides a health check endpoint to verify its operational status. This endpoint bypasses authentication.

  • URL: http://localhost:8080/health
  • Alternate URL (for backward compatibility): http://localhost:8080/api/health

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sam_rest_gateway-0.2.0-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file sam_rest_gateway-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sam_rest_gateway-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc7268268d8d12273c523df16e3b53579950e269f575ad16f8c3cef0644c5b19
MD5 ae02cd7d4e6dd5317e212de6de10f36f
BLAKE2b-256 03465269db5df360bd092402ac9e22537d4efade029e612672a7e1247af837fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for sam_rest_gateway-0.2.0-py3-none-any.whl:

Publisher: release.yaml on SolaceLabs/solace-agent-mesh-core-plugins

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page