⏣ Control your infrastructure with AI.
OpenControl lets you control your infrastructure with AI.
Install dependencies
npm install opencontrol hono @ai-sdk/anthropicHere are we are going to use Anthropic's Claude.
Create the server
touch src/opencontrol.tsimport { create } from "opencontrol"
import { handle } from "hono/aws-lambda"
const app = create({
// model: ...,
// tools: [ ]
})
export const handler = handle(app)Pick the model
+ import { Resource } from "sst"
+ import { createAnthropic } from "@ai-sdk/anthropic"
const app = create({
+ model: createAnthropic({
+ apiKey: Resource.AnthropicKey.value,
+ })("claude-3-7-sonnet-20250219")
})Define your tools
+ import { tool } from "opencontrol/tool"
+ import { Inventory } from "@acme/core/inventory/index"
+ const inventory = tool({
+ name: "inventory_record",
+ description: "Record new inventory event to track in or out amounts",
+ args: Inventory.record.schema,
+ async run(input) {
+ return Inventory.record(input)
+ }
+ })
const app = create({
tools: [
+ inventory
]
})Infrastructure
We are using SST here, but since OpenControl is just a Hono app, you can deploy it however you want.
touch sst.config.tsconst anthropicKey = new sst.Secret("AnthropicKey")
const server = new sst.aws.OpenControl("MyServer", {
server: {
handler: "src/opencontrol.handler",
link: [anthropicKey],
},
})We are defining a secret for the Anthropic API key and linking it to our OpenControl server.
Link any resources
const bucket = new sst.aws.Bucket("MyBucket")
const server = new sst.aws.OpenControl("MyServer", {
server: {
handler: "src/opencontrol.handler",
link: [bucket],
},
})If your tools need to access to your resources, you can link them as well.
Grant permissions
If you are using the AWS tool, you'll need to give your OpenControl server permissions to access your AWS account.
const server = new sst.aws.OpenControl("MyServer", {
server: {
handler: "src/opencontrol.handler",
policies: $dev
? ["arn:aws:iam::aws:policy/AdministratorAccess"]
: ["arn:aws:iam::aws:policy/ReadOnlyAccess"],
},
})Here we are giving it admin access in dev but read-only access in prod.
Deploy
Currently, OpenControl uses basic auth but we'll be adding support for OAuth soon.
return {
OpenControlUrl: server.url,
OpenControlPassword: server.password,
}You can print out the URL of your server and it's password and deploy.
sst deployNow head over to the URL, login with the password, and you can use AI to talk to your infrastructure.
Check out how Terminal uses OpenControl.
Here are some examples of the tools you can use with OpenControl.
………OpenControl is created by the maintainers of SST.
No open issues yet, or sync has not completed.