Rust-based forwarder for agent-to-agent communications.
Set the build profile you prefer. Available options:
- debug
- release
PROFILE=release
# PROFILE=debug
task data-plane:build PROFILE=${PROFILE}
This will build a local binary of the gateway.
To run a multiarch image of the gateway (linux/arm64 & linux/amd64):
REPO_ROOT="$(git rev-parse --show-toplevel)"
docker build -t gateway -f "${REPO_ROOT}/data-plane/Dockerfile" --platform linux/amd64,linux/arm64 "${REPO_ROOT}"
Or alternatively, with docker buildx bake:
pushd $(git rev-parse --show-toplevel) && IMAGE_REPO=gateway IMAGE_TAG=latest docker buildx bake gateway && popd
The container image build process was tested on:
- Windows 10 + Hyper-V
- windows 11 + WSL 2
The instructions below assume Powershell 7 environment.
$env:REPO_ROOT = "<path-to-repo>"
Example:
$env:REPO_ROOT = "C:\Users\<dummy>\agp"
To convert line endings in VSCode from CRLF (Windows-style) to LF (Unix-style), follow these steps:
- Open the Dockerfile (or any file you want to convert) in VSCode.
- Look at the bottom-right corner of the VSCode window.
- You should see something like
CRLF
(Carriage Return + Line Feed). - Click on
CRLF
, and a small menu will appear. - Select LF (Line Feed) from the menu.
- Save the file (
Ctrl + S
orCmd + S
on Mac).
Notice that there is no arm64 on the command below, otherwise it will fail even if using buildx
.
docker buildx build `
-t gateway `
-f "$env:REPO_ROOT\data-plane\Dockerfile" `
--platform linux/amd64 `
"$env:REPO_ROOT"
If everything goes well you should see an output similar to:
...
=> => naming to docker.io/library/gateway:latest 0.0s
=> => unpacking to docker.io/library/gateway:latest
The gateway can be run in 3 main ways:
- directly as binary (preferred way when deployed as workload in k8s)
- via the rust APIs (check the sdk-mock example)
- via the python bindings
The gateway can run in server mode, in client mode or both (i.e. spawning a server and connecting to another gateway at the same time).
To run the gateway binary as server, a configuration file is needed to setup the basic runtime options. Some basic examples are provided in the config folder:
- reference is a reference configuration, with comments explaining all the available options.
- base is a base configuration for a server without encryption and authentication.
- tls is a configuration for a server with encryption enabled, with no authentication.
- basic-auth is a configuration for a server with encryption and basic auth enabled.
- mtls is a configuration for a server expecting clients to authenticate with a trusted certificate.
To run the gateway as server:
MODE=base
# MODE=tls
# MODE=basic-auth; export PASSWORD=12345
# MODE=mtls
cargo run --bin gateway -- --config ./config/${MODE}/server-config.yaml
Or, using the container image (assuming the image name is
gateway/agp
):
docker run -it \
-e PASSWORD=${PASSWORD} \
-v ./config/base/server-config.yaml:/config.yaml \
gateway/agp /gateway --config /config.yaml
The instructions below assume Powershell 7 environment.
$env:PASSWORD = "your_secure_password"
This sets the environment variable PASSWORD
for the current session.
Since PowerShell doesn’t support ${PASSWORD}
, replace it with $env:PASSWORD
:
💣 Notice we are exposing port 46357
to the host and it matches the one inside ${PWD}/config/base/server-config.yaml
docker run -it `
-e PASSWORD=$env:PASSWORD `
-v ${PWD}/config/base/server-config.yaml:/config.yaml `
-p 46357:46357 `
gateway:latest /gateway --config /config.yaml
If you want the password to persist across sessions:
[System.Environment]::SetEnvironmentVariable("PASSWORD", "your_secure_password", "User")
This makes PASSWORD
available across all PowerShell sessions.
To run the gateway binary as client, you will need to configure it to start one (or more) clients at startup. and you will need to provide the address of a remote gateway server. As usually, some configuration examples are available in the config folder:
- reference is a reference configuration, with comments explaining all the available options.
- base is a base configuration for a client without encryption and authentication.
- tls is a configuration for a client with encryption enabled, with no authentication.
- basic-auth is a configuration for a client with encryption and basic auth enabled.
- mtls is a configuration for a client connecting to a server with a trusted certificate.
To run the gateway as client:
MODE=base
# MODE=tls
# MODE=basic-auth; export PASSWORD=12345
# MODE=mtls
cargo run --bin gateway -- --config ./config/${MODE}/client-config.yaml
Or, using the container image (assuming the image name is
gateway/agp
):
docker run -it \
-e PASSWORD=${PASSWORD} \
-v ./config/base/client-config.yaml:/config.yaml \
gateway/agp /gateway --config /config.yaml