Agents

Simple AI agent with tools (no framework)

A readable agent loop: the model picks a tool, your code runs it, results go back until it's done.

Paste into Cursor, Claude Code, Codex, Lovable, Bolt, Replit or v0
Build a minimal AI agent in [TypeScript/Python] without an agent framework.

- Tools: search_notes(query), read_file(path) restricted to ./data, and write_summary(text).
- Use the provider's native tool/function-calling API.
- Loop: send messages + tool definitions → execute requested tool calls → append results → repeat until the model answers, with a hard cap of 8 steps.
- Log every step (tool, arguments, duration) to the console.
- Guardrails: validate tool arguments, block path traversal, and ask for confirmation before any write.
Explain the loop in comments so I can extend it.

Tips

  • Start with read-only tools; add write actions behind a confirmation step.

Works with: Cursor, Claude Code, Codex, Replit. Last reviewed 2026-11-13.

← All prompts · Something broke? Fix library