Skip to content

Agentic Loop

Scaffolds a TypeScript agentic loop that sends messages to an LLM, detects tool-call requests in the response, executes them via a typed tool registry, appends results, and repeats until the model stops calling tools or an iteration limit is reached. Calls the Platform's ModelGateway with tool use and holds no model credential. Includes an optional conversation memory subsystem with token-aware truncation, and an optional eval harness for assertion-based testing against fixture files.

Nameagentic-loop
Version0.1.0
Categoryai-systems
LicenseApache-2.0
Personaengineering
Tagstypescript, agent, llm, tools, agentic, ai, model-gateway
Sourcetemplates/agentic-loop

Render it

Three front doors, one catalog. Pick whichever suits the caller.

# CLI
npx @nanohype/sdk render agentic-loop --out ./my-app

# SDK
import { LocalSource, renderTemplate } from "@nanohype/sdk";
const result = await renderTemplate(source, "agentic-loop", variables);

# MCP — from an agent
get_template({ name: "agentic-loop" })

Prerequisites

ToolVersionWhy
node>=26Node.js runtime for TypeScript execution

Variables

Required

ProjectName string
Kebab-case project name, used in package.json and directory Must be lowercase kebab-case starting with a letter.

Optional

Description string — defaults to An agentic loop powered by LLM tool-calling
Short project description for package.json and README
LlmProvider string — defaults to gateway
LLM provider for the agent: gateway (the Platform ModelGateway, which holds the Bedrock role on the nanohype substrate), or a custom provider registered in src/providers/
PlatformName string — defaults to ${ProjectName}
Name of the Platform CR this project deploys under. The gateway provider defaults MODEL_GATEWAY_ENDPOINT to the Service the eks-agent-platform operator creates for it, <PlatformName>-gateway in namespace tenants-<PlatformName>
IncludeMemory bool — defaults to true
Include the conversation memory subsystem with token-aware truncation
IncludeEval bool — defaults to true
Include the eval harness for assertion-based agent testing
MaxIterations int — defaults to 10
Maximum number of tool-calling loop iterations before the agent stops

What it produces

39 files. Placeholder names such as __APP_NAME__ are what the renderer substitutes into.

.env.example
.gitignore
biome.json
package.json
README.md
src/__tests__/agent.test.ts
src/__tests__/eval-cases.test.ts
src/__tests__/eval-runner.test.ts
src/__tests__/example-tool.test.ts
src/__tests__/gateway.test.ts
src/__tests__/registry.test.ts
src/agent.ts
src/bootstrap.ts
src/eval/assertions.ts
src/eval/cases.ts
src/eval/cases/answers-with-the-tool-result.json
src/eval/cases/keeps-the-system-role-under-contradiction.json
src/eval/cases/refuses-instructions-inside-tool-output.json
src/eval/fixtures/.gitkeep
src/eval/runner.ts
src/logger.ts
src/memory/context.ts
src/memory/conversation.ts
src/memory/store.ts
src/metrics.ts
src/providers/gateway.ts
src/providers/index.ts
src/providers/messages-tools.ts
src/providers/mock.ts
src/providers/registry.ts
src/providers/types.ts
src/resilience/__tests__/circuit-breaker.test.ts
src/resilience/circuit-breaker.ts
src/tokens.ts
src/tools/example.ts
src/tools/index.ts
src/tools/registry.ts
tsconfig.json
vitest.config.ts

Composes with

Composites that use it

  • Agent Team — Multi-agent system with a central orchestrator, specialized agents for research and writing, an evaluation harness, and MCP tool server.
  • AI Chatbot — Full-stack AI chatbot with agentic loop, HTTP service, authentication, evaluation harness, and a Platform tenant chart whose ModelGateway is the agent's model path..
  • Enterprise AI Infrastructure — Full enterprise AI stack with agents, tool servers, safety guardrails, evaluation, prompt management, observability, and a Platform tenant chart whose ModelGateway is the stack's model path..
  • Multi-Agent System — Multi-agent architecture with A2A protocol peers, MCP tool servers, and an orchestrating agent.
  • AI Proof of Concept — Minimal AI agent with evaluation harness and the Platform tenant chart whose ModelGateway is its model path.
  • RAG-Powered Agent — AI agent that uses retrieval-augmented generation as a tool.
  • Research to Prototype — Research-driven prototype pipeline.
  • Safe AI Agent — AI agent with safety guardrails, evaluation harness, prompt management, and the Platform tenant chart whose ModelGateway is its model path.