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. Supports Anthropic and OpenAI as LLM providers, an optional conversation memory subsystem with token-aware truncation, and an optional eval harness for assertion-based testing against fixture files.
| Name | agentic-loop |
| Version | 0.1.0 |
| Category | ai-systems |
| License | Apache-2.0 |
| Persona | engineering |
| Tags | typescript, agent, llm, tools, agentic, ai |
| Source | templates/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
| Tool | Version | Why |
|---|---|---|
node | >=22 | Node.js runtime for TypeScript execution |
Variables
Required
ProjectNamestring- Kebab-case project name, used in package.json and directory Must be lowercase kebab-case starting with a letter.
Optional
Descriptionstring — defaults toAn agentic loop powered by LLM tool-calling- Short project description for package.json and README
LlmProviderstring — defaults toanthropic- LLM provider to use for the agent
IncludeMemorybool — defaults totrue- Include the conversation memory subsystem with token-aware truncation
IncludeEvalbool — defaults totrue- Include the eval harness for assertion-based agent testing
MaxIterationsint — defaults to10- Maximum number of tool-calling loop iterations before the agent stops
What it produces
32 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__/example-tool.test.ts
src/__tests__/registry.test.ts
src/agent.ts
src/bootstrap.ts
src/eval/assertions.ts
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/anthropic.ts
src/providers/index.ts
src/providers/mock.ts
src/providers/openai.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.tsComposes with
- Pairs with
mcp-server-ts - Pairs with
eval-harness - Pairs with
rag-pipeline - Nests inside
monorepo
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 deployment..
- Enterprise AI Infrastructure — Full enterprise AI stack with agents, tool servers, safety guardrails, evaluation, prompt management, observability, and Kubernetes deployment..
- 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.
- 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, and prompt management.