More screenshots

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Minimal Extensible Agent Loop

    1

    This TypeScript package provides a minimal, extensible agent runtime designed for developers who need to build or extend coding-agent loops without the bloat of a full framework.

    $9

    /mo

    Subscription · cancel anytime

    Secure checkout via Stripe

    • Always the latest version
    • Delivered live to your agent via MCP
    • Cancel anytime, access ends at period end
    Security scanned
    Minimal Extensible Agent Loop

    Minimal Extensible Agent Loop

    Example session with this skill installed

    Build a TypeScript agent loop that requires human approval for any 'write_file' tool calls and terminates if the agent hits 10 consecutive errors.

    • Read your context and instructions
    • Compiled the minimal extensible agent

    I have initialized a minimal agent loop with a custom security door for write approvals and a guard configuration to prevent error storms.

    Agent Runtime Configuration

    import {
      runIMLoop,
      ToolRegistry,
      createConfig,
      createWriteApprovalDoor
    } from './src/index.js';
    
    // 1. Setup registry with security door
    const registry = new ToolRegistry();
    registry.registerDoor(
      createWriteApprovalDoor({
        handler: async (req) => {
          console.log(`Approval requested for: ${req.toolName}`);
          // In a real app, this triggers a UI signal
          return 'approved'; 
        }
      })
    );
    
    // 2. Configure guards
    const config = createConfig({
      maxConsecutiveToolErrors: 10,
      maxSteps: 50,
    });
    
    // 3. Execution entry point
    const result = await runIMLoop({
      config,
      registry,
      streamChat: myModelClient,
      url: 'https://api.openai.com/v1/chat/completions',
      model: 'gpt-4',
      systemPrompt: 'File manager agent.',
      sessionId: 'session-123'
    });
    
    console.log(`Loop terminated. Reason: ${result.reason}`);
    

    Next steps

    • Implement the streamChat function to connect to your LLM provider.
    • Connect the signalGate to your front-end to handle approval.request events asynchronously.
    • Run npm test to verify that the error-rate guard trips as expected in your environment.
    $9/mo

    Subscription · always the latest version

    • Secure checkout via Stripe
    • Cancel anytime
    • Delivered live via MCP

    About this skill

    This TypeScript package provides a minimal, extensible agent runtime designed for developers who need to build or extend coding-agent loops without the bloat of a full framework. It solves the difficult problems of agent safety and multi-session management: termination guards, pluggable security doors, per-session approval isolation, and a unified signal gate for multiple front-ends. The codebase focuses on the loop itself rather than specific tools or prompt templates.

    Small by design, the package contains zero runtime dependencies and 247 tests covering five critical safety invariants. It ensures the loop cannot run away, prevents tripped states from leaking into the model's prompt, and enforces security doors before every tool execution. The signal gate acts as a single source of truth for governance, allowing you to connect CLI, web, or mobile front-ends to a shared core without duplicating complex session locking or approval logic.

    What it does

    • Enforces termination guards by monitoring tokens, steps, tool-call rates, and consecutive error thresholds to prevent runaway loops.
    • Isolates session state using a per-session ApprovalStore to ensure tool permissions and grants do not leak between users or turns.
    • Secures tool calls through pluggable security doors that can trigger human-in-the-loop approvals or block dangerous operations.
    • Relays front-end communication via a signal gate that manages turn serialization, command processing, and event broadcasting.
    • Handles OpenAI-style streaming with built-in SSE parsing, tool-call accumulation, and bounded retry logic for 429/503 errors.

    How it works

    1. Initialize the Registry by registering your system tools and security doors (e.g., file system access or write approvals).
    2. Define the Model Client by supplying a streamChat function that conforms to the OpenAI-compatible streaming contract.
    3. Invoke the Loop using runIMLoop with a specific sessionId and configuration to start the turn.
    4. Manage Signals by subscribing to the signal gate for text deltas, approval requests, and session updates to update your UI.

    Frameworks & tools

    Built for Node.js 18+ environments using TypeScript. It targets ES2022 and relies on standard web APIs like AbortSignal and node:crypto.

    Why this beats prompting it yourself

    Prompting an agent to "be safe" or "stop eventually" is unreliable and prone to jailbreaking. This skill implements safety at the runtime level with hard-coded guards and isolated memory that the model cannot bypass or ignore.

    Use cases

    • Building a secure IDE agent that requires explicit approval before writing to sensitive production directories.
    • Creating a multi-user agent service where session isolation and turn queueing must be handled by the backend.
    • Wrapping an existing agent in a new front-end (like Slack or a web dashboard) without rebuilding the security logic.
    • Adding runtime protection to an agent that currently lacks bounds on costs or execution steps.

    Known limitations

    The package is TypeScript-only and does not include built-in tools (like bash or search), prompt assets, or LLM provider clients. It lacks context compression and does not support hot-plugging tools or doors at runtime.

    TypeScript only, Node.js 18+. No built-in tools or prompt content. OpenAI wire format only. No hot-plugging of tools. No context compression or sub-agent tree support.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 23 days ago

    Requires

    Node.js 18+
    npm
    tsc
    Node.js
    Git

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Network Access
    Listed23 days ago
    Updated10 days ago

    What's inside

    Frequently Asked Questions

    This skill provides the rigid structural scaffolding (guards, security gates, and session logic) that generic LLMs lack, preventing runaway execution and unauthorized tool access that prompts alone cannot stop.

    The package is designed for Node.js 18+ environments and works with any LLM provider that supports OpenAI-style streaming responses, such as Anthropic, Groq, or self-hosted models.

    No, this is a 'bring your own tools' architecture; it provides the secure plumbing to manage tools and approvals but does not include pre-defined tools like file system access or web search.

    Yes, the built-in Signal Gate and ApprovalStore are specifically engineered to handle per-session isolation, allowing you to manage multiple users or front-ends simultaneously without state leakage.

    The Signal Gate allows you to subscribe to text deltas and tool events in real-time, making it easy to pipe updates to a React frontend, a CLI, or a messaging platform like Slack.

    New in Agents & Orchestration