npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@looopy-ai/aws

v2.1.10

Published

AWS storage and providers for Looopy AI

Readme

@looopy-ai/aws

AWS helpers for running Looopy AgentCore inside AWS runtimes. This package currently ships a DynamoDB-backed AgentStore plus the agentcore-runtime-server used to service Bedrock AgentCore Runtime events.

DynamoDB Agent Store

DynamoDBAgentStore persists each AgentCore context in DynamoDB. A single table can host many agents by prefixing the keys:

  • Partition key (pk by default): agent#{agentId}
  • Sort key (sk by default): context#{contextId}
  • Attributes: entityType, serialized state, and an ISO updatedAt

You can override the key attribute names and prefixes in the constructor to match an existing schema.

Usage

import { Agent } from '@looopy-ai/core';
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
import { DynamoDBAgentStore } from '@looopy-ai/aws/ts/stores';

const documentClient = DynamoDBDocumentClient.from(
  new DynamoDBClient({ region: process.env.AWS_REGION }),
);

const agentStore = new DynamoDBAgentStore({
  tableName: process.env.AGENT_STATE_TABLE!,
  agentId: 'agentcore-runtime',
  documentClient,
});

const agent = new Agent({
  agentId: 'agentcore-runtime',
  contextId: 'ctx-1234',
  agentStore,
  // supply llmProvider, toolProviders, and messageStore
});

Creating the table with AWS CDK

The snippet below provisions a table that matches the defaults used by DynamoDBAgentStore.

import { Stack, StackProps, RemovalPolicy, CfnOutput } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { AttributeType, BillingMode, Table } from 'aws-cdk-lib/aws-dynamodb';

export class AgentStateStoreStack extends Stack {
  public readonly table: Table;

  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    this.table = new Table(this, 'AgentStateTable', {
      partitionKey: { name: 'pk', type: AttributeType.STRING },
      sortKey: { name: 'sk', type: AttributeType.STRING },
      billingMode: BillingMode.PAY_PER_REQUEST,
      pointInTimeRecovery: true,
      removalPolicy: RemovalPolicy.RETAIN,
    });

    new CfnOutput(this, 'AgentStateTableName', { value: this.table.tableName });
  }
}
  1. Run cdk init app --language typescript in a new directory.
  2. Add the stack above to lib/agent-state-store-stack.ts and synthesize with cdk synth.
  3. Deploy with cdk deploy and capture the AgentStateTableName output.
  4. Pass the table name to your runtime as AGENT_STATE_TABLE and grant the runtime IAM role dynamodb:GetItem, PutItem, and DeleteItem actions for that table.

Optional: add timeToLiveAttribute: 'ttl' to the table props and write a UNIX timestamp to that attribute from your runtime if you want DynamoDB TTL based cleanup.

Wiring into AgentCore Runtime Server

When running the provided agentcore-runtime-server, create the store once and reuse it for each invocation:

import { serve } from '@looopy-ai/aws';
import { Agent } from '@looopy-ai/core';
import { DynamoDBAgentStore } from '@looopy-ai/aws/ts/stores';
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';

const documentClient = DynamoDBDocumentClient.from(new DynamoDBClient({ region: process.env.AWS_REGION }));
const agentStore = new DynamoDBAgentStore({
  tableName: process.env.AGENT_STATE_TABLE!,
  agentId: 'agentcore-runtime',
  documentClient,
});

serve({
  agent: async (contextId) =>
    new Agent({
      agentId: 'agentcore-runtime',
      contextId,
      agentStore,
      // other dependencies here
    }),
});

This ensures each Bedrock AgentCore request can resume from the state stored in DynamoDB across separate Lambda or container invocations.

AgentCore Memory Message Store

AgentCoreMemoryMessageStore streams conversation turns to the Bedrock AgentCore Memory APIs so short-term and long-term memories persist outside of your runtime container. The store wraps the runtime (CreateEvent, ListEvents, DeleteEvent) and memory retrieval APIs (RetrieveMemoryRecords) and implements the MessageStore contract used by Agent.

Prerequisites

  1. In the AWS Console open Amazon Bedrock → Agentic Memory (or use the @aws-sdk/client-bedrock-agentcore / AWS CLI equivalent) and create a Memory resource. Enable the strategies you want (summaries, user preferences, etc.).
  2. Capture the memoryId that is returned.
  3. Grant the runtime IAM role the following permissions scoped to that memory: bedrock:CreateEvent, bedrock:ListEvents, bedrock:DeleteEvent, and bedrock:RetrieveMemoryRecords.
  4. Provide an agentId that serves as the actor identifier for all sessions. This typically represents the agent or assistant identity.

Usage

import { Agent } from '@looopy-ai/core';
import { AgentCoreMemoryMessageStore } from '@looopy-ai/aws/ts/stores';

const messageStore = new AgentCoreMemoryMessageStore({
  memoryId: process.env.AGENT_MEMORY_ID!,
  agentId: 'agentcore-runtime',
  region: process.env.AWS_REGION,
  // Optional: enable long-term memory retrieval
  longTermMemoryNamespace: 'persistent-context',
});

const agent = new Agent({
  agentId: 'agentcore-runtime',
  contextId: 'ctx-1234',
  messageStore,
  // llmProvider, toolProviders, agentStore, etc.
});

Features

  • Short-term memory: Every call to append persists conversation turns via CreateEventCommand. Messages are stored per session (contextId).
  • Long-term memory (optional): When longTermMemoryNamespace is configured, getRecent automatically retrieves and prepends relevant long-term memories to the conversation context.
  • Token budget support: getRecent honors token limits using trimToTokenBudget to keep conversations within model constraints.
  • Memory search: Use searchMemories(query, options?) to retrieve long-term memories semantically related to a query.
  • Session cleanup: Call clear(contextId) to remove all short-term events for a specific session. Long-term memories persist per your memory resource configuration.

Configuration Options

| Option | Required | Description | |--------|----------|-------------| | memoryId | Yes | Pre-provisioned AgentCore memory identifier | | agentId | Yes | Static actor identifier used across all sessions | | region | No | AWS region (defaults to AWS_REGION env var or us-west-2) | | client | No | Custom BedrockAgentCoreClient instance (useful for testing) | | longTermMemoryNamespace | No | Namespace for retrieving long-term memories. When set, enables automatic memory retrieval in getRecent |