Why AI Agents Should Call Go Functions Instead of Linux Shell Commands
A general-purpose shell can read files, execute programs, and bypass the intended wallet workflow. A function registry narrows what an AI agent can request.
The engineering pattern
Expose wallet_balance and wallet_receive as distinct capabilities with explicitly checked arguments. Do not expose execute_shell, arbitrary URLs, file reads, or user-supplied command templates.
Security and product boundaries
Keep the CLI as a human interface to the same validated Go functions. A command such as wab balance is a UX choice, not a reason to execute AI-generated shell strings.
Practical validation
Attempt prompt injection that requests cat .env, arbitrary curl, or shell chaining. The executor must reject all unsupported actions.
Why this matters for developers
A wallet tool should expose a predictable capability with explicit inputs, bounded outputs, and a clear failure mode. A model's ability to choose a tool does not confer permission to use that tool. Developers can reuse the approach for self-hosted applications without changing the tested Bitcoin Engine or its immutable per-wallet signed fee law.
Related reading
Go Function Calling for WALLET AI BITCOIN: The Deterministic Executor
https://thamer.org/learn/go-function-calling-wallet-ai-bitcoin-executor
Designing a Typed JSON Tool Registry in Go for Bitcoin Operations
https://thamer.org/learn/typed-json-tool-registry-go-bitcoin
Can an AI model execute Bitcoin wallet functions directly?
https://thamer.org/ask/can-ai-model-execute-bitcoin-wallet-functions
Primary technical references
OpenAI function calling documentation:
https://platform.openai.com/docs/guides/function-calling
Go net/http documentation:
https://pkg.go.dev/net/http
OWASP AI Agent Security Cheat Sheet:
https://cheatsheetseries.owasp.org/cheatsheets/AI_Agent_Security_Cheat_Sheet.html
Model Context Protocol tools specification:
https://modelcontextprotocol.io/specification/2025-06-18/server/tools
