Agnos-ML is a high-performance, containerized Machine Learning inference platform. It is designed with a strict separation of concerns, utilizing a lightning-fast C++ compute engine for heavy tensor operations and a highly concurrent Go API Gateway to handle client traffic.
The system is composed of two primary microservices communicating over a local Docker network:
-
C++ Compute Engine (
/engine)- Role: Core inference execution.
- Stack: C++17, gRPC, Protobuf, Alpine Linux.
- Features: Loads custom binary
.agnosneural network models. Implements a custom CPU backend for matrix multiplications (MatMul) and non-linear activations (ReLU, Sigmoid, Tanh). Exposed strictly via a high-performance gRPC server on port50051.
-
Go API Gateway (
/backend)- Role: Client-facing REST API and orchestrator.
- Stack: Go 1.22+, Fiber (HTTP framework), gRPC Client.
- Features: Ingests HTTP JSON payloads, validates shapes, maps them to Protobuf messages, and routes them to the C++ Engine. Handles request timeouts and connection pooling. Exposed on port
8080.
- Docker
- Docker Compose
The entire stack is containerized and orchestrated via docker-compose.
# Clone the repository
git clone [https://github.com/abhikumar63/agnos-ml.git](https://github.com/abhikumar63/agnos-ml.git)
cd agnos-ml
# Build the containers and launch the network
docker-compose up --buildThe C++ Engine requires a compiled .agnos model file to boot.
Place your model in the data/models/ directory at the root of the project. Docker Compose automatically mounts this directory to /app/data/models/ inside the C++ container to bypass macOS file-sharing restrictions.
Checks the status of both the Go REST API and the internal C++ gRPC Engine.
Request: GET /health
Response:
{
"api_status": "UP",
"engine_status": "SERVING"
}Pushes a tensor through the neural network.
Request: POST /predict
{
"model_id": "v1_base_mlp",
"correlation_id": "req-12345",
"input_shape": [1, 20],
"tensor_data": [1.0, 0.5, -0.2, 0.1, 0.0]
}Response:
{
"correlation_id": "req-12345",
"output_shape": [1, 2],
"prediction": [0.89, 0.11],
"compute_time_us": 26
}- Caching Layer: Implement Redis in the Go API to hash and cache frequent tensor requests.
- Telemetry: Add Prometheus
/metricsscraping to the Go API. - GPU Acceleration: Extend the C++ backend to support CUDA.