Building a Lightweight AI Agent in Go: Baize's Architecture and Trade-offs
Description and use
Baize is a lightweight AI assistant that runs as a sidecar process. It dynamically registers tools from OpenAPI, HTTP plugins, and MCP servers, executes them via HTTP callbacks, and supports approval gates and access control. This enables deploying an AI assistant in enterprise environments without restarting processes.
Problem
Deploying an AI assistant as a sidecar in enterprise environments requires a lightweight, language-agnostic runtime that can register tools dynamically, handle approvals, and run with minimal overhead.
Outcome
Baize enables enterprises to run an AI assistant as a lightweight, language-agnostic sidecar that dynamically registers tools, enforces approval gates, and handles failures gracefully, all from a single binary.
Workflow
- 1. Build a single Go binary with
go buildfor target OS/architecture. - 2. Deploy the binary as a sidecar alongside existing services.
- 3. Import OpenAPI docs, register HTTP plugins, or connect to MCP tool servers to populate the tool registry.
- 4. The agent core loop receives user input, selects a tool, and POSTs a JSON payload to the configured callback URL.
- 5. The external service executes the tool, returns the result, and Baize reports it back to the user via the console.
- 6. Human approvals are handled by the
require_approvalflag; rejected writes transition to a terminal state without crashing. - 7. All events (
llm.thinking,llm.tool_call,tool.result) are persisted for observability. - 8. Tool registration/unregistration can be performed at runtime without restarting the agent.
Evidence
Baize is a "sidecar" AI assistant runtime: a single process that sits beside services you already run, turns API documentation into tools the assistant can call, and pauses important writes until a person approves them.
The core requirement of sidecar deployment is "one process, copy it over, run it." A Go binary needs no interpreter, no dependency installation, no virtualenv on the target machine.
Baize doesn’t execute the tool itself; it POSTs the invocation to your own endpoint… Benefits: language-agnostic, process-isolated, auditable; idempotency_key makes retries safe.
- Record date: 2026-09-21T11:00:48.771Z