Agent SDK and CLI
agentsdk is the Go SDK for building Airlock apps. An app is a normal Go program that registers its web routes, tools, chat behavior, integrations, schedules, storage, and other capabilities, then calls agent.Serve().
Airlock supplies the runtime around that code: secure containers, app-scoped Postgres and object storage, credential injection, LLM access, authentication, triggers, run history, and deployment.
The SDK
Add the SDK to an existing Go app with:
go get github.com/airlockrun/agentsdkUse the SDK when your app needs to:
- Register typed Go tools for AI chat and Telegram.
- Serve web pages and custom HTTP routes.
- Store data in its app-scoped Postgres schema or object storage namespace.
- Connect OAuth, token, and MCP integrations without putting credentials in app code.
- Receive webhooks, run scheduled work, or call another Airlock app.
- Call LLMs through Airlock’s provider and credential layer.
The app owns its UI and domain logic. The SDK gives that code access to the Airlock platform.
Global launcher
Install the airlock launcher once on your development machine:
go install github.com/airlockrun/agentsdk/cmd/airlock@latestThe launcher connects to an Airlock instance, discovers its compatible Agent SDK version, and initializes or clones an app repository.
airlock init my-app --url https://airlock.example.com
airlock clone existing-app --url https://airlock.example.com my-appThe global launcher is only for bootstrapping. Inside an app repository, use go tool air instead.
Pinned app toolchain
airlock init creates an app repository that pins its own Air CLI and build toolchain in go.mod. This means every developer and CI job builds with the versions selected for that app, rather than relying on a globally installed CLI.
Install the pinned tools from the app repository:
go tool air toolchain installThe toolchain provides the SDK-owned build path, including generated UI, SQL, and other app build requirements.
Server-rendered UI stack
Airlock apps render HTML on the server. There is no Node runtime, node_modules, frontend bundler, or client-side application to maintain.
The pinned toolchain includes:
- templ for type-safe Go HTML templates.
- htmx for small browser-side interactions over server-rendered HTML.
- Tailwind CSS as a standalone binary for styles.
- daisyUI as the Tailwind component library.
- sqlc for type-safe Go code generated from SQL queries.
The browser receives server-rendered pages and htmx responses. Go owns the app behavior, templates, routes, database access, and AI/tool integrations in one codebase.
Build and deploy
Build the app before deployment:
go tool air buildThis runs the app build chain and reports failures locally. When it passes, deploy the current source to Airlock:
go tool air deploy -m "Describe this deployment"Airlock builds the container image, deploys it, and records the build in the app activity history.
Coding harness workflow
Use Cursor, Claude Code, OpenCode, or another coding harness in the local app repository. Start from the scaffold created by airlock init, let the harness implement the app, then run go tool air build and go tool air deploy.
For quick changes, use Airlock’s built-in coding workflow. For deeper work, the local repository gives your preferred harness the full Go project, SDK guidance, and pinned toolchain.
More SDK detail
The SDK source repository contains its complete API reference and focused guides for file storage, remote execution, interactive authentication, integrations, and database-backed apps: