Skip to content
25K
Console

OpenControl

The OpenControl component has been deprecated. It should not be used for new projects.

The OpenControl component lets you deploy your OpenControl server to AWS Lambda.

Create an OpenControl server

sst.config.ts
const server = new sst.aws.OpenControl("MyServer", {
server: "src/server.handler"
});
sst.config.ts
const anthropicKey = new sst.Secret("AnthropicKey");
const server = new sst.aws.OpenControl("MyServer", {
server: {
handler: "src/server.handler",
link: [anthropicKey]
}
});

If your tools are need access to specific resources, you can link them to the OpenControl server.

sst.config.ts
const bucket = new sst.aws.Bucket("MyBucket");
new sst.aws.OpenControl("MyServer", {
server: {
handler: "src/server.handler",
link: [bucket]
}
});

Give AWS permissions

If you are using the AWS tool within OpenControl, you will need to give your OpenControl server permissions to access your AWS account.

sst.config.ts
new sst.aws.OpenControl("OpenControl", {
server: {
handler: "src/server.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.

Define your server

Your server function might look like this.

src/server.ts
import { Resource } from "sst";
import { create } from "opencontrol";
import { tool } from "opencontrol/tool";
import { handle } from "hono/aws-lambda";
import { createAnthropic } from "@ai-sdk/anthropic";
const myTool = tool({
name: "my_tool",
description: "Get the most popular greeting",
async run() {
return "Hello, world!";
}
});
const app = create({
model: createAnthropic({
apiKey: Resource.AnthropicKey.value,
})("claude-3-7-sonnet-20250219"),
tools: [myTool],
});
export const handler = handle(app);

Learn more in the OpenControl docs on how to configure the server function.


Constructor

new OpenControl(name, args, opts?)

Parameters

OpenControlArgs

server

Type Input<string | FunctionArgs>

The function that’s running your OpenControl server.

{
server: "src/server.handler"
}

You can also pass in the full FunctionArgs.

{
server: {
handler: "src/server.handler",
link: [table]
}
}

Since the server function is a Hono app, you want to export it with the Lambda adapter.

src/server.ts
import { handle } from "hono/aws-lambda";
import { create } from "opencontrol";
const app = create({
// ...
});
export const handler = handle(app);

Learn more in the OpenControl docs on how to configure the server function.

Properties

nodes

Type Object

The underlying resources this component creates.

nodes.server

Type Output<Function>

The Function component for the server.

password

Type Output<string>

The password for the OpenControl server.

url

Type Output<string>

The URL of the OpenControl server.