tientran1234

Agent Runtime — AI skill for Claude Code

AI community

Provider-agnostic LLM agent loop for Node: bounded tool calling with validated inputs, token-budget memory, tracing with cost, fallback chains, SSE.

How to install Agent Runtime

This entry records only its repository, not the path inside it, so there is no exact command to give. Open tientran1234/agent-runtime and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Agent Runtime does

Provider-agnostic LLM agent loop for Node: bounded tool calling with validated inputs, token-budget memory, tracing with cost, fallback chains, SSE. Anthropic adapter on the official SDK; scripted fake for offline tests.

Alternatives in AI

  • Axonhub — ⚡️ Open-source AI Gateway — Use any SDK to call 100+ LLMs 3.2k ★
  • Vllm Mlx — High-performance OpenAI and Anthropic compatible LLM inference server for Apple Silicon 1.5k ★
  • Engage.Scorecard — Calibrate model verdict trust (Wilson-bounded miss-rate) to short-circuit re-validation 348 ★

README

agent-runtime

The part of an LLM agent that is not the model: a bounded tool loop, memory that fits a token budget, a trace of what happened and what it cost, and a fallback chain for when a provider is down. Provider-agnostic by construction — the Anthropic adapter is one file on the official SDK, and a scripted fake runs the whole thing offline in tests.

import { runAgent, defineTool, Tracer, ConsoleExporter } from "agent-runtime";
import { AnthropicProvider } from "agent-runtime/anthropic";
import { z } from "zod";

const getOrder = defineTool({
  name: "get_order",
  description: "Look up an order by id",
  input: z.object({ orderId: z.string() }),
  execute: async ({ orderId }) => db.orders.find(orderId),
  timeoutMs: 5_000,
});

const result = await runAgent({
  provider: new AnthropicProvider({ model: "claude-opus-5", effort: "high" }),
  system: "You are a support agent. Use tools; do not guess order details.",
  tools: [getOrder],
  input: "Where is order ord_42?",
  maxIterations: 8,
  tracer: new Tracer({ exporters: [new ConsoleExporter()] }),
});

result.status;   // "completed" | "max_iterations" | "refused" | "truncated" | "aborted"
result.text;     // the final answer
result.usage;    // tokens across every model call

What the loop guarantees

  • It ends. maxIterations caps model calls. A model that never stops calling tools gets status: "max_iterations", not an infinite bill.
  • No tool runs on bad input. Every tool input is validated against its Zod schema first. Invalid input becomes an error result the model can read and correct — not an exception, and not a side effect on garbage.
  • No tool runs after a refusal or a truncated turn. A refusal can cut a tool_use off mid-input; a max_tokens stop can leave input that parses but is incomplete. Both end the run with a named status.
  • No tool hangs the agent, and no tool floods the context. Per-tool timeout (default 30 s) and result cap (default 16