AWS.QApps reference
AssociateLibraryItemReview
Section titled “AssociateLibraryItemReview”Source:
src/AWS/QApps/AssociateLibraryItemReview.ts
Runtime binding for qapps:AssociateLibraryItemReview.
Upvotes a library item as the calling identity. Provide the implementation with
Effect.provide(AWS.QApps.AssociateLibraryItemReviewHttp).
AssociateLibraryItemReview: Library Items
Section titled “AssociateLibraryItemReview: Library Items”// init — bind the operation to the Q Appconst associateLibraryItemReview = yield* AWS.QApps.AssociateLibraryItemReview(app);
// runtimeyield* associateLibraryItemReview({ libraryItemId });AssociateQAppWithUser
Section titled “AssociateQAppWithUser”Source:
src/AWS/QApps/AssociateQAppWithUser.ts
Runtime binding for qapps:AssociateQAppWithUser.
Links the calling identity to the bound Q App, marking it as a favorite in the user’s inventory. Provide the implementation with
Effect.provide(AWS.QApps.AssociateQAppWithUserHttp).
AssociateQAppWithUser: User Inventory
Section titled “AssociateQAppWithUser: User Inventory”// init — bind the operation to the Q Appconst associateQAppWithUser = yield* AWS.QApps.AssociateQAppWithUser(app);
// runtimeyield* associateQAppWithUser();BatchCreateCategory
Section titled “BatchCreateCategory”Source:
src/AWS/QApps/BatchCreateCategory.ts
Runtime binding for qapps:BatchCreateCategory.
Creates library categories that web-experience users use to tag and filter library items. Provide the implementation with
Effect.provide(AWS.QApps.BatchCreateCategoryHttp).
BatchCreateCategory: Categories
Section titled “BatchCreateCategory: Categories”// init — bind the operation to the Q Appconst batchCreateCategory = yield* AWS.QApps.BatchCreateCategory(app);
// runtimeyield* batchCreateCategory({ categories: [{ title: "HR" }, { title: "Marketing" }],});BatchDeleteCategory
Section titled “BatchDeleteCategory”Source:
src/AWS/QApps/BatchDeleteCategory.ts
Runtime binding for qapps:BatchDeleteCategory.
Deletes library categories by id. Provide the implementation with
Effect.provide(AWS.QApps.BatchDeleteCategoryHttp).
BatchDeleteCategory: Categories
Section titled “BatchDeleteCategory: Categories”// init — bind the operation to the Q Appconst batchDeleteCategory = yield* AWS.QApps.BatchDeleteCategory(app);
// runtimeyield* batchDeleteCategory({ categories: [categoryId] });BatchUpdateCategory
Section titled “BatchUpdateCategory”Source:
src/AWS/QApps/BatchUpdateCategory.ts
Runtime binding for qapps:BatchUpdateCategory.
Renames or recolors existing library categories. Provide the implementation with
Effect.provide(AWS.QApps.BatchUpdateCategoryHttp).
BatchUpdateCategory: Categories
Section titled “BatchUpdateCategory: Categories”// init — bind the operation to the Q Appconst batchUpdateCategory = yield* AWS.QApps.BatchUpdateCategory(app);
// runtimeyield* batchUpdateCategory({ categories: [{ id: categoryId, title: "People Ops" }],});CreateLibraryItem
Section titled “CreateLibraryItem”Source:
src/AWS/QApps/CreateLibraryItem.ts
Runtime binding for qapps:CreateLibraryItem.
Publishes a version of the bound Q App into the instance’s library so other users can discover and run it. Provide the implementation with
Effect.provide(AWS.QApps.CreateLibraryItemHttp).
CreateLibraryItem: Library Items
Section titled “CreateLibraryItem: Library Items”// init — bind the operation to the Q Appconst createLibraryItem = yield* AWS.QApps.CreateLibraryItem(app);
// runtimeconst item = yield* createLibraryItem({ appVersion: 1, categories: [categoryId],});console.log(item.libraryItemId);CreatePresignedUrl
Section titled “CreatePresignedUrl”Source:
src/AWS/QApps/CreatePresignedUrl.ts
Runtime binding for qapps:CreatePresignedUrl.
Creates a presigned upload URL for a file-upload card of the bound Q App. Provide the implementation with
Effect.provide(AWS.QApps.CreatePresignedUrlHttp).
CreatePresignedUrl: Files
Section titled “CreatePresignedUrl: Files”// init — bind the operation to the Q Appconst createPresignedUrl = yield* AWS.QApps.CreatePresignedUrl(app);
// runtimeconst upload = yield* createPresignedUrl({ cardId, fileContentsSha256, fileName: "report.pdf", scope: "SESSION", sessionId,});console.log(upload.presignedUrl);DeleteLibraryItem
Section titled “DeleteLibraryItem”Source:
src/AWS/QApps/DeleteLibraryItem.ts
Runtime binding for qapps:DeleteLibraryItem.
Unpublishes a library item, removing the app from the instance’s library. Provide the implementation with
Effect.provide(AWS.QApps.DeleteLibraryItemHttp).
DeleteLibraryItem: Library Items
Section titled “DeleteLibraryItem: Library Items”// init — bind the operation to the Q Appconst deleteLibraryItem = yield* AWS.QApps.DeleteLibraryItem(app);
// runtimeyield* deleteLibraryItem({ libraryItemId });DescribeQAppPermissions
Section titled “DescribeQAppPermissions”Source:
src/AWS/QApps/DescribeQAppPermissions.ts
Runtime binding for qapps:DescribeQAppPermissions.
Reads the principals and actions granted on the bound Q App. Provide the implementation with
Effect.provide(AWS.QApps.DescribeQAppPermissionsHttp).
DescribeQAppPermissions: Permissions
Section titled “DescribeQAppPermissions: Permissions”// init — bind the operation to the Q Appconst describeQAppPermissions = yield* AWS.QApps.DescribeQAppPermissions(app);
// runtimeconst permissions = yield* describeQAppPermissions();console.log(permissions.permissions?.length);DisassociateLibraryItemReview
Section titled “DisassociateLibraryItemReview”Source:
src/AWS/QApps/DisassociateLibraryItemReview.ts
Runtime binding for qapps:DisassociateLibraryItemReview.
Removes the calling identity’s upvote from a library item. Provide the implementation with
Effect.provide(AWS.QApps.DisassociateLibraryItemReviewHttp).
DisassociateLibraryItemReview: Library Items
Section titled “DisassociateLibraryItemReview: Library Items”// init — bind the operation to the Q Appconst disassociateLibraryItemReview = yield* AWS.QApps.DisassociateLibraryItemReview(app);
// runtimeyield* disassociateLibraryItemReview({ libraryItemId });DisassociateQAppFromUser
Section titled “DisassociateQAppFromUser”Source:
src/AWS/QApps/DisassociateQAppFromUser.ts
Runtime binding for qapps:DisassociateQAppFromUser.
Removes the bound Q App from the calling identity’s inventory of favorited apps. Provide the implementation with
Effect.provide(AWS.QApps.DisassociateQAppFromUserHttp).
DisassociateQAppFromUser: User Inventory
Section titled “DisassociateQAppFromUser: User Inventory”// init — bind the operation to the Q Appconst disassociateQAppFromUser = yield* AWS.QApps.DisassociateQAppFromUser(app);
// runtimeyield* disassociateQAppFromUser();ExportQAppSessionData
Section titled “ExportQAppSessionData”Source:
src/AWS/QApps/ExportQAppSessionData.ts
Runtime binding for qapps:ExportQAppSessionData.
Exports a shared Q App session’s collected data as a downloadable CSV file link. Provide the implementation with
Effect.provide(AWS.QApps.ExportQAppSessionDataHttp).
ExportQAppSessionData: Sessions
Section titled “ExportQAppSessionData: Sessions”// init — bind the operation to the Q Appconst exportQAppSessionData = yield* AWS.QApps.ExportQAppSessionData(app);
// runtimeconst exported = yield* exportQAppSessionData({ sessionId });console.log(exported.csvFileLink);GetLibraryItem
Section titled “GetLibraryItem”Source:
src/AWS/QApps/GetLibraryItem.ts
Runtime binding for qapps:GetLibraryItem.
Retrieves a library item — its published app version, categories, status, and rating counts. Provide the implementation with
Effect.provide(AWS.QApps.GetLibraryItemHttp).
GetLibraryItem: Library Items
Section titled “GetLibraryItem: Library Items”// init — bind the operation to the Q Appconst getLibraryItem = yield* AWS.QApps.GetLibraryItem(app);
// runtimeconst item = yield* getLibraryItem({ libraryItemId });console.log(item.ratingCount);GetQAppSession
Section titled “GetQAppSession”Source:
src/AWS/QApps/GetQAppSession.ts
Runtime binding for qapps:GetQAppSession.
Retrieves the current state of a Q App session — execution status plus the per-card status map. Provide the implementation with
Effect.provide(AWS.QApps.GetQAppSessionHttp).
GetQAppSession: Sessions
Section titled “GetQAppSession: Sessions”// init — bind the operation to the Q Appconst getQAppSession = yield* AWS.QApps.GetQAppSession(app);
// runtimeconst state = yield* getQAppSession({ sessionId });if (state.status === "COMPLETED") console.log(state.cardStatus);GetQAppSessionMetadata
Section titled “GetQAppSessionMetadata”Source:
src/AWS/QApps/GetQAppSessionMetadata.ts
Runtime binding for qapps:GetQAppSessionMetadata.
Retrieves a Q App session’s metadata — name, sharing configuration, and ownership. Provide the implementation with
Effect.provide(AWS.QApps.GetQAppSessionMetadataHttp).
GetQAppSessionMetadata: Sessions
Section titled “GetQAppSessionMetadata: Sessions”// init — bind the operation to the Q Appconst getQAppSessionMetadata = yield* AWS.QApps.GetQAppSessionMetadata(app);
// runtimeconst metadata = yield* getQAppSessionMetadata({ sessionId });console.log(metadata.sharingConfiguration.enabled);ImportDocument
Section titled “ImportDocument”Source:
src/AWS/QApps/ImportDocument.ts
Runtime binding for qapps:ImportDocument.
Uploads a base64-encoded file into a card of the bound Q App, at app or session scope. Provide the implementation with
Effect.provide(AWS.QApps.ImportDocumentHttp).
ImportDocument: Files
Section titled “ImportDocument: Files”// init — bind the operation to the Q Appconst importDocument = yield* AWS.QApps.ImportDocument(app);
// runtimeconst imported = yield* importDocument({ cardId, fileContentsBase64, fileName: "notes.txt", scope: "SESSION", sessionId,});console.log(imported.fileId);ListCategories
Section titled “ListCategories”Source:
src/AWS/QApps/ListCategories.ts
Runtime binding for qapps:ListCategories.
Lists the library categories of the bound app’s Q Business application environment instance. Provide the implementation with
Effect.provide(AWS.QApps.ListCategoriesHttp).
ListCategories: Categories
Section titled “ListCategories: Categories”// init — bind the operation to the Q Appconst listCategories = yield* AWS.QApps.ListCategories(app);
// runtimeconst result = yield* listCategories();console.log(result.categories?.map((c) => c.title));ListLibraryItems
Section titled “ListLibraryItems”Source:
src/AWS/QApps/ListLibraryItems.ts
Runtime binding for qapps:ListLibraryItems.
Lists the library items published in the bound app’s Q Business application environment instance. Provide the implementation with
Effect.provide(AWS.QApps.ListLibraryItemsHttp).
ListLibraryItems: Library Items
Section titled “ListLibraryItems: Library Items”// init — bind the operation to the Q Appconst listLibraryItems = yield* AWS.QApps.ListLibraryItems(app);
// runtimeconst page = yield* listLibraryItems({ limit: 25 });console.log(page.libraryItems?.length);ListQApps
Section titled “ListQApps”Source:
src/AWS/QApps/ListQApps.ts
Runtime binding for qapps:ListQApps.
Lists the calling identity’s Q Apps in the bound app’s Q Business application environment instance. Provide the implementation with
Effect.provide(AWS.QApps.ListQAppsHttp).
ListQApps: User Inventory
Section titled “ListQApps: User Inventory”// init — bind the operation to the Q Appconst listQApps = yield* AWS.QApps.ListQApps(app);
// runtimeconst page = yield* listQApps({ limit: 25 });console.log(page.apps.map((a) => a.title));ListQAppSessionData
Section titled “ListQAppSessionData”Source:
src/AWS/QApps/ListQAppSessionData.ts
Runtime binding for qapps:ListQAppSessionData.
Lists the per-user data collected in a shared Q App session. Provide the implementation with
Effect.provide(AWS.QApps.ListQAppSessionDataHttp).
ListQAppSessionData: Sessions
Section titled “ListQAppSessionData: Sessions”// init — bind the operation to the Q Appconst listQAppSessionData = yield* AWS.QApps.ListQAppSessionData(app);
// runtimeconst data = yield* listQAppSessionData({ sessionId });console.log(data.sessionData?.length);PredictQApp
Section titled “PredictQApp”Source:
src/AWS/QApps/PredictQApp.ts
Runtime binding for qapps:PredictQApp.
Generates a Q App definition from a natural-language problem statement or a Q Business conversation. Provide the implementation with
Effect.provide(AWS.QApps.PredictQAppHttp).
PredictQApp: Generation
Section titled “PredictQApp: Generation”// init — bind the operation to the Q Appconst predictQApp = yield* AWS.QApps.PredictQApp(app);
// runtimeconst predicted = yield* predictQApp({ options: { problemStatement: "Summarize meeting notes into action items", },});console.log(predicted.app.title);Source:
src/AWS/QApps/QApp.ts
An Amazon Q App — a lightweight, purpose-built AI app defined as a flow of cards (text inputs, file uploads, LLM query cards, plugin cards) running inside an Amazon Q Business application environment.
QApp: Creating Q Apps
Section titled “QApp: Creating Q Apps”Prompt-Driven Q App
import * as AWS from "alchemy/AWS";
const summarizer = yield* AWS.QApps.QApp("Summarizer", { instanceId: qbusinessApp.applicationId, description: "Summarizes pasted text", appDefinition: { cards: [ { textInput: { id: "11111111-1111-4111-8111-111111111111", title: "Source Text", type: "text-input", }, }, { qQuery: { id: "22222222-2222-4222-8222-222222222222", title: "Summary", type: "q-query", prompt: "Summarize the following text: @Source Text", }, }, ], },});File Upload Q App
const analyzer = yield* AWS.QApps.QApp("DocAnalyzer", { instanceId: qbusinessApp.applicationId, appDefinition: { initialPrompt: "Upload a document to analyze", cards: [ { fileUpload: { id: "33333333-3333-4333-8333-333333333333", title: "Document", type: "file-upload", }, }, { qQuery: { id: "44444444-4444-4444-8444-444444444444", title: "Analysis", type: "q-query", prompt: "List the key points of @Document", }, }, ], },});StartQAppSession
Section titled “StartQAppSession”Source:
src/AWS/QApps/StartQAppSession.ts
Runtime binding for qapps:StartQAppSession.
Starts a new session of the bound Q App, optionally seeding initial card values. Provide the implementation with
Effect.provide(AWS.QApps.StartQAppSessionHttp).
StartQAppSession: Sessions
Section titled “StartQAppSession: Sessions”// init — bind the operation to the Q Appconst startQAppSession = yield* AWS.QApps.StartQAppSession(app);
// runtimeconst session = yield* startQAppSession({ appVersion: 1 });console.log(session.sessionId);StopQAppSession
Section titled “StopQAppSession”Source:
src/AWS/QApps/StopQAppSession.ts
Runtime binding for qapps:StopQAppSession.
Stops an active Q App session, halting any in-progress card executions. Provide the implementation with
Effect.provide(AWS.QApps.StopQAppSessionHttp).
StopQAppSession: Sessions
Section titled “StopQAppSession: Sessions”// init — bind the operation to the Q Appconst stopQAppSession = yield* AWS.QApps.StopQAppSession(app);
// runtimeyield* stopQAppSession({ sessionId });UpdateLibraryItem
Section titled “UpdateLibraryItem”Source:
src/AWS/QApps/UpdateLibraryItem.ts
Runtime binding for qapps:UpdateLibraryItem.
Updates a library item’s publication status or categories. Provide the implementation with
Effect.provide(AWS.QApps.UpdateLibraryItemHttp).
UpdateLibraryItem: Library Items
Section titled “UpdateLibraryItem: Library Items”// init — bind the operation to the Q Appconst updateLibraryItem = yield* AWS.QApps.UpdateLibraryItem(app);
// runtimeyield* updateLibraryItem({ libraryItemId, status: "DISABLED" });UpdateLibraryItemMetadata
Section titled “UpdateLibraryItemMetadata”Source:
src/AWS/QApps/UpdateLibraryItemMetadata.ts
Runtime binding for qapps:UpdateLibraryItemMetadata.
Updates a library item’s verification badge (isVerified). Provide the implementation with
Effect.provide(AWS.QApps.UpdateLibraryItemMetadataHttp).
UpdateLibraryItemMetadata: Library Items
Section titled “UpdateLibraryItemMetadata: Library Items”// init — bind the operation to the Q Appconst updateLibraryItemMetadata = yield* AWS.QApps.UpdateLibraryItemMetadata(app);
// runtimeyield* updateLibraryItemMetadata({ libraryItemId, isVerified: true });UpdateQAppPermissions
Section titled “UpdateQAppPermissions”Source:
src/AWS/QApps/UpdateQAppPermissions.ts
Runtime binding for qapps:UpdateQAppPermissions.
Grants or revokes read/edit permissions on the bound Q App for Identity Center principals. Provide the implementation with
Effect.provide(AWS.QApps.UpdateQAppPermissionsHttp).
UpdateQAppPermissions: Permissions
Section titled “UpdateQAppPermissions: Permissions”// init — bind the operation to the Q Appconst updateQAppPermissions = yield* AWS.QApps.UpdateQAppPermissions(app);
// runtimeyield* updateQAppPermissions({ grantPermissions: [{ action: "read", principal: userId }],});UpdateQAppSession
Section titled “UpdateQAppSession”Source:
src/AWS/QApps/UpdateQAppSession.ts
Runtime binding for qapps:UpdateQAppSession.
Submits new card values into a running Q App session (e.g. answers a text-input card). Provide the implementation with
Effect.provide(AWS.QApps.UpdateQAppSessionHttp).
UpdateQAppSession: Sessions
Section titled “UpdateQAppSession: Sessions”// init — bind the operation to the Q Appconst updateQAppSession = yield* AWS.QApps.UpdateQAppSession(app);
// runtimeyield* updateQAppSession({ sessionId, values: [{ cardId, value: "Hello, Q Apps!" }],});UpdateQAppSessionMetadata
Section titled “UpdateQAppSessionMetadata”Source:
src/AWS/QApps/UpdateQAppSessionMetadata.ts
Runtime binding for qapps:UpdateQAppSessionMetadata.
Updates a Q App session’s metadata — rename it or reconfigure how it is shared with collaborators. Provide the implementation with
Effect.provide(AWS.QApps.UpdateQAppSessionMetadataHttp).
UpdateQAppSessionMetadata: Sessions
Section titled “UpdateQAppSessionMetadata: Sessions”// init — bind the operation to the Q Appconst updateQAppSessionMetadata = yield* AWS.QApps.UpdateQAppSessionMetadata(app);
// runtimeyield* updateQAppSessionMetadata({ sessionId, sharingConfiguration: { enabled: true, acceptResponses: true },});