AWS.WorkSpaces reference
AccountModel
Section titled “AccountModel”Source:
packages/aws/src/WorkSpaces/AccountModel.ts
A model on the account’s Agentic WorkSpaces model list: the models that persona configurations and WorkSpaces in the account may use.
The account must be set up first (see AgenticAccountSetup). An account
can list up to 25 models. Destroying the entry removes the model from the
list; persona configurations that name it keep the reference, but requests
to the model are blocked.
AccountModel: Allowing a Model
Section titled “AccountModel: Allowing a Model”Allow one model
import * as WorkSpaces from "@alchemy.run/aws/WorkSpaces";
const sonnet = yield* WorkSpaces.AccountModel("Sonnet", { modelId: "anthropic.claude-sonnet-5-5",});Set the account up and allow a model in one stack
const setup = yield* WorkSpaces.AgenticAccountSetup("Agentic", { region: "us-east-2",});
// Passing `setup.region` makes the model wait for setup.const sonnet = yield* WorkSpaces.AccountModel("Sonnet", { modelId: "anthropic.claude-sonnet-5-5", region: setup.region,});AccountModel: Using a Model in a Persona
Section titled “AccountModel: Using a Model in a Persona”const persona = yield* WorkSpaces.AgenticPersonaConfiguration("Engineer", { modelIds: [sonnet.modelId],});AgentEnforcedPolicy
Section titled “AgentEnforcedPolicy”Source:
packages/aws/src/WorkSpaces/AgentEnforcedPolicy.ts
An Amazon WorkSpaces agent-enforced policy: a policy that the agent running on an agentic WorkSpace applies to itself.
Attach it to WorkSpaces through an AgenticPersonaConfiguration. The API
has no update operation, so a change to anything but tags replaces the
policy. For a policy the WorkSpace itself applies, see
WorkspaceEnforcedPolicy.
AgentEnforcedPolicy: Creating a Policy
Section titled “AgentEnforcedPolicy: Creating a Policy”Edit freely, never push
import * as WorkSpaces from "@alchemy.run/aws/WorkSpaces";
const policy = yield* WorkSpaces.AgentEnforcedPolicy("OpenDev", { policy: { permissionMode: "acceptEdits", allowedTools: ["PowerShell(git status)", "PowerShell(npm test)"], disallowedTools: ["PowerShell(git push *)"], workingDirectories: ["D:\\Projects"], },});No commands, no web, managed connectors only
const policy = yield* WorkSpaces.AgentEnforcedPolicy("LockedDown", { policy: { permissionMode: "default", disallowedTools: ["PowerShell", "WebFetch"], allowManagedMcpServersOnly: true, },});AgentEnforcedPolicy: Using a Policy in a Persona
Section titled “AgentEnforcedPolicy: Using a Policy in a Persona”const persona = yield* WorkSpaces.AgenticPersonaConfiguration("Engineer", { modelIds: ["anthropic.claude-sonnet-5-5"], agentEnforcedPolicyId: policy.policyId,});AgenticAccountSetup
Section titled “AgenticAccountSetup”Source:
packages/aws/src/WorkSpaces/AgenticAccountSetup.ts
The one-time setup of Agentic WorkSpaces for an account in a region. Models
and connectors can’t be configured until it is READY.
Setup needs the IAM role AgenticWorkspacesInferenceRole, which lets
Amazon WorkSpaces call Amazon Bedrock for the account’s agents. AWS creates
it the first time an account is set up and never again, so this resource
keeps it in place: a deploy creates the role when it is missing. The
deploying identity needs iam:CreateRole, iam:GetRole,
iam:PutRolePolicy and iam:TagRole. Setup takes about 20 seconds.
AWS has no operation to undo setup, so the account stays set up after a destroy. A destroy does remove the role when this stack created it, which stops the account’s agents from reaching their models. A role that existed before the stack is left alone.
AgenticAccountSetup: Setting Up an Account
Section titled “AgenticAccountSetup: Setting Up an Account”import * as WorkSpaces from "@alchemy.run/aws/WorkSpaces";
const setup = yield* WorkSpaces.AgenticAccountSetup("Agentic", {});AgenticAccountSetup: Configuring the Account After Setup
Section titled “AgenticAccountSetup: Configuring the Account After Setup”const setup = yield* WorkSpaces.AgenticAccountSetup("Agentic", { region: "us-east-2",});
// Passing `setup.region` makes the model wait for setup.const sonnet = yield* WorkSpaces.AccountModel("Sonnet", { modelId: "anthropic.claude-sonnet-5-5", region: setup.region,});AgenticConnectorActivation
Section titled “AgenticConnectorActivation”Source:
packages/aws/src/WorkSpaces/AgenticConnectorActivation.ts
An agentic connector activated for the account, so persona configurations and WorkSpaces can give it to their agents. A connector is a tool server that AWS manages, such as GitHub or Asana.
The account must be set up first (see AgenticAccountSetup). An account
can have up to 25 activated connectors. Destroying the activation
deactivates the connector.
AgenticConnectorActivation: Activating a Connector
Section titled “AgenticConnectorActivation: Activating a Connector”Activate the GitHub connector
import * as WorkSpaces from "@alchemy.run/aws/WorkSpaces";
const github = yield* WorkSpaces.AgenticConnectorActivation("GitHub", { agenticConnectorId: "wsacn-github",});Set the account up and activate a connector in one stack
const setup = yield* WorkSpaces.AgenticAccountSetup("Agentic", { region: "us-east-2",});
// Passing `setup.region` makes the activation wait for setup.const github = yield* WorkSpaces.AgenticConnectorActivation("GitHub", { agenticConnectorId: "wsacn-github", region: setup.region,});AgenticConnectorActivation: Using a Connector in a Persona
Section titled “AgenticConnectorActivation: Using a Connector in a Persona”const persona = yield* WorkSpaces.AgenticPersonaConfiguration("Engineer", { modelIds: ["anthropic.claude-sonnet-5-5"], agenticConnectorIds: [github.agenticConnectorId],});AgenticContext
Section titled “AgenticContext”Source:
packages/aws/src/WorkSpaces/AgenticContext.ts
An Amazon WorkSpaces agentic context: Markdown content that the service writes to a file on a WorkSpace for the agent running there to use.
A context is steering (standing instructions), a skill, or a workflow.
Attach it to WorkSpaces through an AgenticPersonaConfiguration. The API
has no update operation, so a change to anything but tags replaces the
context.
AgenticContext: Creating a Context
Section titled “AgenticContext: Creating a Context”Steering instructions
import * as WorkSpaces from "@alchemy.run/aws/WorkSpaces";
const steering = yield* WorkSpaces.AgenticContext("Conventions", { contextType: "STEERING", targetFilePath: "conventions.md", body: "# Conventions\n\nRun the tests before you commit.",});A skill with a description
const skill = yield* WorkSpaces.AgenticContext("ReleaseSkill", { contextType: "SKILL", description: "How to cut a release", targetFilePath: "release-skill.md", body: [ "---", "name: release", "description: Cut a release. Use when the user asks to ship a version.", "---", "# Release", "1. Bump the version.", "2. Tag the commit.", ].join("\n"),});AgenticContext: Using a Context in a Persona
Section titled “AgenticContext: Using a Context in a Persona”const persona = yield* WorkSpaces.AgenticPersonaConfiguration("Engineer", { modelIds: ["anthropic.claude-sonnet-5-5"], agenticContextIds: [steering.agenticContextId],});AgenticPersonaConfiguration
Section titled “AgenticPersonaConfiguration”Source:
packages/aws/src/WorkSpaces/AgenticPersonaConfiguration.ts
An Amazon WorkSpaces agentic persona configuration: the models, connectors, contexts and enforced policies that agentic WorkSpaces created with it start from.
The API has no update operation, so a change to anything but tags
replaces the persona configuration. WorkSpaces already created with the
old one keep their configuration.
AgenticPersonaConfiguration: Creating a Persona
Section titled “AgenticPersonaConfiguration: Creating a Persona”A persona with one model
import * as WorkSpaces from "@alchemy.run/aws/WorkSpaces";
const sonnet = yield* WorkSpaces.AccountModel("Sonnet", { modelId: "anthropic.claude-sonnet-5-5",});
const persona = yield* WorkSpaces.AgenticPersonaConfiguration("Engineer", { description: "Engineering agents", modelIds: [sonnet.modelId],});A persona with the GitHub connector
const github = yield* WorkSpaces.AgenticConnectorActivation("GitHub", { agenticConnectorId: "wsacn-github",});
const persona = yield* WorkSpaces.AgenticPersonaConfiguration("Engineer", { modelIds: [sonnet.modelId], agenticConnectorIds: [github.agenticConnectorId],});AgenticPersonaConfiguration: Contexts and Policies
Section titled “AgenticPersonaConfiguration: Contexts and Policies”const steering = yield* WorkSpaces.AgenticContext("Conventions", { contextType: "STEERING", targetFilePath: "conventions.md", body: "Run the tests before you commit.",});const agentPolicy = yield* WorkSpaces.AgentEnforcedPolicy("AgentGuardrails", { policy: { permissionMode: "acceptEdits", disallowedTools: ["PowerShell(git push *)"] },});const workspacePolicy = yield* WorkSpaces.WorkspaceEnforcedPolicy("WorkspaceGuardrails", { policy: { disableInternetAccess: true, deniedPaths: ["~\\.aws", "~\\.ssh"] },});
const persona = yield* WorkSpaces.AgenticPersonaConfiguration("Engineer", { modelIds: ["anthropic.claude-sonnet-5-5"], agenticContextIds: [steering.agenticContextId], agentEnforcedPolicyId: agentPolicy.policyId, workspaceEnforcedPolicyId: workspacePolicy.policyId,});WorkspaceEnforcedPolicy
Section titled “WorkspaceEnforcedPolicy”Source:
packages/aws/src/WorkSpaces/WorkspaceEnforcedPolicy.ts
An Amazon WorkSpaces WorkSpace-enforced policy: a policy that an agentic WorkSpace applies, outside the agent’s control.
Attach it to WorkSpaces through an AgenticPersonaConfiguration. The API
has no update operation, so a change to anything but tags replaces the
policy. For a policy the agent applies to itself, see
AgentEnforcedPolicy.
WorkspaceEnforcedPolicy: Creating a Policy
Section titled “WorkspaceEnforcedPolicy: Creating a Policy”Let the agent reach the internet
import * as WorkSpaces from "@alchemy.run/aws/WorkSpaces";
const policy = yield* WorkSpaces.WorkspaceEnforcedPolicy("OpenDev", { policy: { disableInternetAccess: false },});No internet, credentials and browser profiles out of reach
const policy = yield* WorkSpaces.WorkspaceEnforcedPolicy("LockedDown", { policy: { disableInternetAccess: true, writablePaths: ["D:\\Projects\\Billing"], deniedPaths: ["~\\.aws", "~\\.ssh", "~\\AppData\\Local\\Google\\Chrome\\User Data"], },});WorkspaceEnforcedPolicy: Using a Policy in a Persona
Section titled “WorkspaceEnforcedPolicy: Using a Policy in a Persona”const persona = yield* WorkSpaces.AgenticPersonaConfiguration("Engineer", { modelIds: ["anthropic.claude-sonnet-5-5"], workspaceEnforcedPolicyId: policy.policyId,});