Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Your Agent Is Leaking Tokens. Build a Decision Ledger on a Free Server

Описание и применение

Создайте агент, который записывает каждое решение в SQLite‑ledger и останавливается, когда исчерпывается токеновый бюджет, используя бесплатный сервер MonkeyCode.

Задача

An LLM‑powered agent can repeatedly call the same tool, rephrase, and retry, causing silent token budget leaks without errors.

Результат

A lightweight, self‑auditing agent that logs every decision and enforces a token budget, preventing silent leaks on a free server.

Рабочий процесс

  • Provision a free Linux server via MonkeyCode dashboard and install Python 3.10+ and requests
  • Export MC_API_KEY, MC_BASE_URL, MC_MODEL, and MC_BUDGET_TOKENS as environment variables
  • Create agent.py: initialize SQLite ledger, define call_llm(), a placeholder search_tool(), and main() loop
  • In main(), loop while used tokens < BUDGET: call LLM, parse JSON action, execute tool, record decision and token usage in ledger
  • Verify token counts from LLM response and update used counter
  • Stop loop when budget exceeded or LLM returns stop action

Доказательства

MonkeyCode’s free tier includes a 10M token allowance and a free server option.

Источник

The final artifact is a SQLite ledger with a hard token budget.

Источник

  • Дата записи: 2026-09-06T15:37:08.175Z