Skip to content

Quick Start

An LLM that can take actions, not just generate text. It calls tools, reads the results, decides what to do next, and loops until done. agentfootprint makes every step of that loop inspectable β€” what landed in which slot, which tool ran with what args, why a decision branched the way it did.

User question β†’ LLM thinks β†’ calls a tool β†’ reads result β†’ thinks again β†’ responds
Terminal window
npm install agentfootprint
import { Agent, defineTool, mock } from 'agentfootprint';
const weather = defineTool({
schema: {
name: 'weather',
description: 'Get current weather for a city.',
inputSchema: {
type: 'object',
properties: { city: { type: 'string' } },
required: ['city'],
},
},
execute: async (args) => `${(args as { city: string }).city}: 72Β°F, sunny`,
});
const agent = Agent.create({
provider: mock({ reply: 'Paris is 72Β°F and sunny today.' }),
model: 'mock',
maxIterations: 5,
})
.system('You answer weather questions using the `weather` tool.')
.tool(weather)
.build();
const result = await agent.run({ message: 'Weather in Paris?' });
console.log(result);
// β†’ "Paris is 72Β°F and sunny today."

The mock provider returns a scripted reply β€” perfect for $0 testing. Swap to anthropic / openai / bedrock / ollama for real LLMs; no other code changes.

agentfootprint ships a single defineMemory({ type, strategy, store }) factory. Pick a TYPE (what shape you keep), a STRATEGY (how you fit it in), and a STORE.

import {
Agent, defineMemory, MEMORY_TYPES, MEMORY_STRATEGIES, InMemoryStore, mock,
} from 'agentfootprint';
const memory = defineMemory({
id: 'short-term',
type: MEMORY_TYPES.EPISODIC,
strategy: { kind: MEMORY_STRATEGIES.WINDOW, size: 10 }, // last 10 turns
store: new InMemoryStore(),
});
const agent = Agent.create({ provider: mock({ reply: 'Hi Alice!' }), model: 'mock' })
.memory(memory)
.build();
// Pass an `identity` so memory accumulates per conversation.
const id = { conversationId: 'alice-session' };
await agent.run({ message: 'My name is Alice', identity: id });
const result = await agent.run({ message: 'What did I just say?', identity: id });
// β†’ memory subflow loaded the prior turn; the agent answered from context

Read memory examples for all 7 strategies (window / budget / summarize / topK / extract / causal / hybrid).

console.log(agent.getNarrative());
// Human-readable execution trace β€” every stage, every decision,
// every tool call, every memory injection.

Or attach typed event listeners:

agent.on('agentfootprint.context.injected', (e) => {
console.log(`[${e.payload.source}] landed in ${e.payload.slot} slot`);
});
agent.on('agentfootprint.stream.tool_start', (e) => {
console.log(`β†’ tool ${e.payload.toolName}(${JSON.stringify(e.payload.args)})`);
});

Every event is typed: 47 events across 13 domains (context, agent, stream, tools, skill, permission, eval, cost, memory, …).