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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lumenflow/packs-agent-runtime

v3.20.0

Published

Agent runtime pack scaffold for LumenFlow — governed model-turn execution, pack config, and provider capability baselines

Downloads

385

Readme

Agent Runtime Pack

The governed agent-runtime pack provides a host-driven agent loop with kernel-enforced tool gating.

Current scope:

  • agent:execute-turn performs one provider-backed model turn and returns the governed turn contract
  • policy_factory converts configured intents into kernel-enforced allow, deny, and approval_required rules
  • runGovernedAgentLoop() shows how CLI, HTTP, or programmatic hosts can keep orchestration outside the pack while still feeding requested tools back through the kernel
  • startGovernedAgentSession() and resumeGovernedAgentSession() persist linear session state for long-running governed turns
  • startGovernedAgentWorkflow() and resumeGovernedAgentWorkflow() add pack-owned branch, join, and scheduled-wakeup orchestration inside the same agent-session
  • createHostContextMessages() lets a host add task and memory context without depending on any other pack's storage internals

Config shape

agent_runtime:
  default_model: default
  models:
    default:
      provider: openai_compatible
      model: demo-model
      api_key_env: AGENT_RUNTIME_API_KEY
      base_url_env: AGENT_RUNTIME_BASE_URL
  intents:
    scheduling:
      description: Schedule or reschedule work
      allow_tools:
        - calendar:create-event
      approval_required_tools:
        - calendar:create-event

Orchestration boundary

The kernel remains responsible for:

  • tool execution
  • policy evaluation
  • scope enforcement
  • evidence receipts for every governed tool call

The pack owns only agent-session orchestration concerns:

  • persisted session and workflow state under .agent-runtime/workflow/
  • branch and join readiness
  • scheduled wakeups for routine-style follow-up nodes
  • workflow-level continuation records that explain why the next governed turn ran

This keeps scheduled and resumed execution inside the existing agent-session task model rather than inventing a new execution class.

Host loop sketch

import {
  createApprovalResolutionMessage,
  createHostContextMessages,
  runGovernedAgentLoop,
  resumeGovernedAgentWorkflow,
  startGovernedAgentWorkflow,
} from '@lumenflow/packs-agent-runtime';

const seedMessages = [
  ...createHostContextMessages({
    task_summary: 'Reschedule the weekly review.',
    memory_summary: 'The reviewer prefers mornings.',
  }),
  { role: 'user', content: 'Please sort out the next slot.' },
];

const result = await runGovernedAgentLoop({
  runtime,
  executeTurnInput: {
    session_id: executionContext.session_id,
    model_profile: 'default',
    url: 'https://model-provider.invalid/',
    messages: seedMessages,
  },
  createContext: (metadata) => ({
    ...executionContext,
    metadata,
  }),
});

if (result.kind === 'approval_required') {
  await runtime.resolveApproval({
    request_id: result.pending_request_id,
    approved: true,
    approved_by: '[email protected]',
  });

  const approvalMessage = createApprovalResolutionMessage({
    requestId: result.pending_request_id,
    approved: true,
    approvedBy: '[email protected]',
    toolName: result.requested_tool.name,
  });

  // Append approvalMessage to the next execute-turn call and continue the loop.
}

The pack keeps tool gating in the kernel. Hosts only decide when to start the loop, when to resolve approvals, and what external context to inject into the conversation.

Workflow sketch

const workflow = await startGovernedAgentWorkflow({
  runtime,
  storageRoot: workspaceRoot,
  workflow: {
    session_id: executionContext.session_id,
    nodes: [
      {
        id: 'collect',
        execute_turn_input: {
          session_id: executionContext.session_id,
          model_profile: 'default',
          url: 'https://model-provider.invalid/',
          messages: [{ role: 'user', content: 'Collect the constraints.' }],
        },
      },
      {
        id: 'follow-up',
        depends_on: ['collect'],
        wake_at: '2026-03-13T09:00:00.000Z',
        execute_turn_input: {
          session_id: executionContext.session_id,
          model_profile: 'default',
          url: 'https://model-provider.invalid/',
          messages: [{ role: 'user', content: 'Perform the scheduled follow-up.' }],
        },
      },
    ],
  },
  createContext: (metadata) => ({ ...executionContext, metadata }),
});

if (workflow.kind === 'scheduled') {
  await resumeGovernedAgentWorkflow({
    runtime,
    storageRoot: workspaceRoot,
    sessionId: executionContext.session_id,
    createContext: (metadata) => ({ ...executionContext, metadata }),
  });
}