backend-setup_skill

This skill helps you bootstrap a robust backend runtime for agent services by configuring persistence, REST/WebSocket servers, and Modal integration.
  • TypeScript

0

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill hhopkins95/ai-systems --skill backend-setup

  • SKILL.md6.6 KB

Overview

This skill sets up a Node.js backend that runs agent runtimes using @hhopkins/agent-runtime. It covers environment configuration, implementing a PersistenceAdapter, creating the runtime, and exposing REST and WebSocket endpoints. Use it to host agent sandboxes, manage sessions, and stream agent outputs to clients.

How this skill works

You implement a PersistenceAdapter to connect sessions, transcripts, files, and agent profiles to your storage layer. The skill shows how to create and start the agent runtime with Modal credentials and optional timeouts, then expose a REST API and attach a WebSocket server to the same HTTP server. Sandboxes are created lazily on first message, and the runtime manages session lifecycle, syncing, and graceful shutdown.

When to use it

  • You need a production-ready backend to host conversational agents with session persistence.
  • You want a simple Node.js/TypeScript reference for integrating @hhopkins/agent-runtime.
  • You must implement storage integration (in-memory, SQLite, Postgres, Supabase, etc.).
  • You need REST endpoints for session lifecycle and WebSocket streaming for real-time updates.
  • You plan to use Modal sandboxes and require Modal credential configuration.

Best practices

  • Implement PersistenceAdapter to persist sessions, transcripts, workspace files, and agent profiles before production use.
  • Use lazy sandbox creation: create session records on create, only start sandboxes on first message to save resources.
  • Set sensible idleTimeoutMs and syncIntervalMs to balance resource usage and state durability.
  • Protect REST endpoints with an apiKey or other authentication and validate incoming requests.
  • Gracefully handle SIGTERM to close HTTP, WebSocket servers and shutdown the runtime to avoid state loss.

Example use cases

  • Small dev server with in-memory PersistenceAdapter for local testing and rapid iteration.
  • Single-server production using SQLite or Postgres PersistenceAdapter for durable sessions and files.
  • Serverless or managed DB backends using Supabase/Convex adapters with the same runtime API.
  • Real-time web client that consumes WebSocket block streaming events for UI updates.
  • Automated agents that spawn subagents; use sessionManager to inspect, unload, or retrieve session state.

FAQ

Provide Modal credentials (MODAL_TOKEN_ID and MODAL_TOKEN_SECRET) and any AI provider keys such as ANTHROPIC_API_KEY when using Claude.

When is a sandbox created?

Sandboxes are created lazily: creating a session record does not start a sandbox. The first message to the session triggers sandbox creation.

How do I persist state reliably?

Implement a PersistenceAdapter backed by a durable store (Postgres, SQLite, Supabase). Configure syncIntervalMs and call runtime.sessionManager.unloadSession to ensure final sync before shutdown.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational