rytena-agent
v1.0.1
Published
Production memory leak detection for Node.js — detects leaks, finds the exact file and line, and generates AI-powered fixes.
Downloads
284
Maintainers
Readme
rytena-agent
Production memory leak detection for Node.js.
Detects leaks in real time. Finds the exact file and line. Generates AI-powered fixes.
Website · Documentation · Dashboard
What is Rytena
Rytena watches your Node.js processes in production. When memory starts growing where it shouldn't, Rytena catches it — identifies the exact code responsible, explains why in plain English, and suggests a fix you can ship.
No graphs to interpret. No stack traces to dig through. Just answers.
Install
npm install rytena-agentZero native dependencies. Works on any Node.js 16+.
Quick start
Add three lines to your app's entry file — before any other imports.
const { Rytena } = require('rytena-agent')
Rytena.init({
apiKey: process.env.RYTENA_API_KEY
})That's the entire integration. The agent starts monitoring immediately.
Get your API key at rytena.vercel.app/dashboard.
What you get
- Real-time detection — heap sampled every 30 seconds
- Root cause — exact file, function, and line responsible for the leak
- Code context — 10 lines around the leak location, captured automatically
- AI analysis — plain-English explanation of why the code leaks memory
- Fix suggestions — corrected code snippet you can review and merge
- Email alerts — get notified before your process runs out of memory
- Zero dependencies — no native compilation, no C++ bindings, no fragile toolchains
How it works
Rytena uses Node's built-in inspector module to sample V8's heap. When it detects sustained memory growth (15%+ across the rolling window), it runs a 30-second deep scan to identify which functions are allocating the most memory.
The agent extracts source code around the leak location and sends it to Rytena's backend, which runs it through an LLM to generate a specific root cause analysis and fix.
You never leave your editor. You never dig through stack traces. You just get a leak report with a fix.
Configuration
Rytena.init({
apiKey: 'ryt_xxxx.yyyy', // required
name: 'production-api', // optional — display name
endpoint: 'https://api.rytena.dev', // optional — for self-hosted
interval: 30, // optional — seconds between snapshots
debug: false // optional — verbose logs
})Environment variables
All options can be set via environment variables:
RYTENA_API_KEY=ryt_xxxx.yyyy
RYTENA_APP_NAME=production-api
RYTENA_ENDPOINT=https://api.rytena.dev
RYTENA_INTERVAL=30
RYTENA_DEBUG=falseOptions passed to init() take precedence over environment variables.
API
Rytena.init(options)
Starts the agent. Registers with the Rytena backend, begins collecting snapshots on the configured interval, and runs deep scans when leaks are detected.
Rytena.stop()
Gracefully stops the agent. Clears the monitoring interval and removes event listeners.
Rytena.status()
Returns the current agent state.
Rytena.status()
// {
// running: true,
// processId: 42,
// runtimeId: 'ryt_a1b2c3d4e5f6',
// endpoint: 'https://api.rytena.dev',
// interval: 30,
// name: 'production-api'
// }Overhead
Rytena is designed to have negligible impact on your application.
| Operation | Overhead | | -------------- | --------------------------------------- | | Quick snapshot | < 1 ms | | Memory usage | < 5 MB | | Deep scan | Only when leak detected, 5-min cooldown | | Network | One HTTP request per interval |
What Rytena doesn't do
Being clear about scope:
- Not an APM — Rytena focuses on memory. Use Datadog or New Relic for full-stack observability.
- Not an error tracker — Rytena catches memory issues before they crash. Use Sentry for runtime exceptions.
- Not a log aggregator — Rytena collects memory metrics only. Use Papertrail or Loggly for logs.
Rytena does one thing better than anyone: finds memory leaks in production Node.js apps and tells you exactly how to fix them.
Example — Try it in 60 seconds
const { Rytena } = require('rytena-agent')
const express = require('express')
Rytena.init({
apiKey: process.env.RYTENA_API_KEY
})
const app = express()
const leakyArray = []
// Intentionally leaky endpoint for demo
app.get('/leak', (req, res) => {
for (let i = 0; i < 1000; i++) {
leakyArray.push(new Array(1000).fill('leak'))
}
res.json({ leaked: leakyArray.length })
})
app.listen(3000)Run this, hit /leak a few times, and watch Rytena detect the leak in your dashboard.
Data privacy
Rytena collects:
- Memory metrics (heap used, heap total, RSS, external)
- Process metadata (hostname, PID, runtime version)
- Code snippets around detected leak locations (up to 10 lines)
Rytena does NOT collect:
- Your full source code
- HTTP request or response data
- Database queries
- User data flowing through your application
- Environment variables
See our Privacy Policy for details.
Documentation
Full docs at rytena.vercel.app/docs
- Quickstart — get running in 3 minutes
- How it works — technical architecture
- Agent configuration — every option explained
- Concepts — projects, processes, leaks, alerts
Support
- Documentation — rytena.vercel.app/docs
- Issues — github.com/AayushShukla1438/Rytena/issues
- Email — [email protected]
License
MIT © Aayush Shukla
