Autessa CDK
The deploy API and the Autessa CDK are in preview and not yet released. Names and shapes may change before they are generally available. Projects with React apps can't deploy yet: app files are refused at Autessa's network edge until that is opened for the deploy API.
The Autessa CDK keeps your Autessa setup in a Git repo. Describe tables, tools, agents, apps, phone numbers and permissions in code. Preview every change, then deploy it to one tenant or many.
When to use it
- You want changes reviewed in pull requests, not clicked in a UI.
- You run separate dev and prod tenants and want them to match.
- You ship the same setup to many customer tenants.
- You want to see when a change gives someone more access, before it ships.
How it works
- Write resources in code, or
pullthem from an existing tenant. - Build turns your code into a manifest plus files (tool sources, app bundles).
- Diff asks the server what would change in a stage. Changes that widen access are marked
WIDENS. - Deploy applies the change. It is idempotent and matched on each resource's
logicalId. - Rollback returns a stage to an earlier deployment.
Get started
- Try a complete app. autessa-cdk-sample is a help desk built with the CDK: tables with row security, a few tools, a Triage agent, a staff desk and a customer portal. Clone it, run it on your machine with
npx autessa-cdk dev(no account needed), run its tests, then deploy it to your own tenant. - Start with an agent. Build an agent in code walks through
init agent,test,chatanddeploy.
The same commands run from each language's command line, the Maven and Gradle plugins, the GitHub Action and Autessa Pipelines.
Packages
| Language | Package | Run commands with |
|---|---|---|
| Python | autessa-cdk (autessa.cdk) | autessa-cdk <command> |
| TypeScript | @autessa/cdk | npx autessa-cdk <command> |
| Java | com.autessa:autessa-cdk (com.autessa.cdk) | The Maven plugin com.autessa:autessa-cdk-maven-plugin (mvn autessa-cdk:<command>) or the Gradle plugin com.autessa.cdk (gradle autessa<Command>, for example autessaDiff) |
Every language has the same commands: init, test, chat, dev, build, diff, deploy, rollback and pull. The TypeScript CDK also has adopt-app. See Commands.
The CDK is separate from the feature packages you call from your app (firewall, SecurePass, RAG and the rest). Those come one at a time, or all together as autessa-sdk (@autessa/sdk on npm). See Features.
Install
- Python
- TypeScript
- Java
During the preview, install from GitHub (core and agents first):
pip install "autessa-core @ git+https://github.com/Autessa-Inc/autessa-python#subdirectory=packages/autessa-core"
pip install "autessa-agents @ git+https://github.com/Autessa-Inc/autessa-python#subdirectory=packages/autessa-agents"
pip install "autessa-cdk @ git+https://github.com/Autessa-Inc/autessa-python#subdirectory=packages/autessa-cdk"
npm install --save-dev @autessa/cdk
<dependencies>
<dependency>
<groupId>com.autessa</groupId>
<artifactId>autessa-cdk</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.autessa</groupId>
<artifactId>autessa-cdk-maven-plugin</artifactId>
<version>0.1.0-SNAPSHOT</version>
</plugin>
</plugins>
</build>
For Gradle, apply id("com.autessa.cdk") version "0.1.0-SNAPSHOT" and add implementation("com.autessa:autessa-cdk:0.1.0-SNAPSHOT").
A small project
One table, one tool, one agent that uses the tool. The model is a stage variable, so dev and prod can use different values.
- Python
- TypeScript
- Java
# autessa.config.py
from autessa.cdk import Agent, Column, Project, Table, Tool
project = Project("support-desk")
model = project.variable("model", default="small")
tickets = Table(project, "tickets",
columns=[
Column("subject", "SHORT_TEXT"),
Column("body", "LONG_TEXT"),
Column("status", "SINGLE_SELECT", options=["open", "closed"]),
],
vectorize=["body"])
lookup = Tool(project, "lookupTicket", source="tools/lookup_ticket.as")
Agent(project, "supportAgent",
instructions="You answer questions about support tickets.",
tools=[lookup],
table=tickets,
model=model)
// autessa.config.ts
import { Project, Table, Tool, Agent } from "@autessa/cdk";
const project = new Project({ name: "support-desk" });
const model = project.variable("model", { default: "small" });
const tickets = new Table(project, "tickets", {
columns: [
{ name: "subject", type: "SHORT_TEXT" },
{ name: "body", type: "LONG_TEXT" },
{ name: "status", type: "SINGLE_SELECT", options: ["open", "closed"] },
],
vectorize: ["body"],
});
const lookup = new Tool(project, "lookupTicket", { source: "tools/lookup_ticket.as" });
new Agent(project, "supportAgent", {
instructions: "You answer questions about support tickets.",
model: `${model}`,
tools: [lookup],
table: tickets,
});
export default project;
// src/main/java/com/example/SupportDesk.java
package com.example;
import com.autessa.cdk.*;
public class SupportDesk implements AutessaProject {
@Override
public Project define() {
Project p = Project.create("support-desk");
Variable model = p.variable("model").defaultValue("small");
Table tickets = p.table("tickets")
.column("subject", ColumnType.SHORT_TEXT)
.column("body", ColumnType.LONG_TEXT)
.select("status", "open", "closed")
.vectorize("body");
Tool lookup = p.tool("lookupTicket").source("tools/lookup_ticket.as");
p.agent("supportAgent")
.instructions("You answer questions about support tickets.")
.model(model.ref())
.tools(lookup)
.knowledge(tickets);
return p;
}
}
List the class in src/main/resources/META-INF/services/com.autessa.cdk.AutessaProject (one line: com.example.SupportDesk), or name it with -Dautessa.projectClass.
The ID you give each resource (tickets, lookupTicket, supportAgent) is its logicalId. Keep it stable. Renaming it means delete and create.
Project layout
autessa.config.py | autessa.config.ts | a Java AutessaProject class | autessa.yaml # your resources
autessa.stages.yaml # the tenants you deploy to
tools/*.as # AutessaScript tool sources
types/*.as # shared AutessaScript types
apps/<name>/ # React app sources
.autessa/ # build output (add to .gitignore)
See Project files for every file.
Deploy keys
The CDK uses a deploy key, not a normal API key. See Keys for which key each package needs.
- A deploy key belongs to one company (tenant).
- It carries scopes:
DEPLOY_DIFF,DEPLOY_PULL,DEPLOY_APPLY,DEPLOY_ROLLBACK,MODEL_TURNfor chatting with a project's agents on your machine, andHARNESS_CHATfor chatting with them in the stage's tenant. - Company admins create, rotate and revoke deploy keys, in Autessa under Settings → Deploy keys or from the terminal. In Autessa,
DEPLOY_DIFFis called Preview changes,DEPLOY_APPLYDeploy,DEPLOY_PULLDownload,DEPLOY_ROLLBACKRoll back,MODEL_TURNRun agents locally andHARNESS_CHATChat with agents from your machine. - Keys are read from environment variables, never from project files.
- Give CI only the scopes it needs. A pull-request job needs
DEPLOY_DIFFonly.
From the terminal, signed in as a company admin:
autessa deploy-keys create --name "CI main" --scopes DEPLOY_DIFF,DEPLOY_APPLY --stageName production
autessa deploy-keys list
autessa deploy-keys rotate --keyId <keyId>
autessa deploy-keys revoke --keyId <keyId>
create and rotate print the secret once, so save it straight into your CI's secret store. Scripts, agents and apps can't run these commands. See API access for who can.
API reference
Deploy API and Pipelines API.
Examples
- autessa-cdk-sample: a complete help desk app built with the CDK, ready to run locally and deploy to your tenant.
- autessa-as-code-tenant: a whole tenant in TypeScript and Java, with a stages file and a GitHub workflow.