{"slug": "building-an-llm-agent-doesn-t-actually-require-a-massive", "title": "Building an LLM agent doesn't actually require a massive", "summary": "A developer has published a minimal LLM agent implementation in 14 lines of Python that uses only standard library modules, eliminating supply chain risk and startup latency. The agent executes shell commands via a custom tool loop and tracks context window usage, requiring only an OpenAI-compatible inference endpoint to run. The approach treats the Docker or sandbox environment as the security boundary rather than the code harness, saving context window tokens by avoiding system prompts.", "body_md": "# Building an LLM agent doesn't actually require a massive\n\nThe core logic here is that the environment (Docker, a sandbox, etc.) should be your security boundary, not the code harness itself. By avoiding a system prompt, you also save precious context window tokens, which modern high-reasoning models handle just fine without.\n\nHere is the complete implementation for a lightweight AI workflow:\n\n``` python\nimport json,sys;from subprocess import getoutput as sh;from urllib.request import Request as R,urlopen\nurl=sys.argv[1];h=[];b=dict(model=\"gpt-5.6\",input=h,tools=[dict(type=\"custom\",name=\"sh\")])\nwhile p:=input(\"> \"):\n  h+=[dict(role=\"user\",content=p)];H={\"Content-Type\":\"application/json\"}\n  while True:\n    o=(r:=json.load(urlopen(R(url,json.dumps(b).encode(),H))))[\"output\"]\n    h+=o;c=[i for i in o if i[\"type\"]==\"custom_tool_call\"];z=r[\"usage\"][\"total_tokens\"]/10500\n    if not c:print(o[-1][\"content\"][0][\"text\"],f'\\n[{z:06.3f}%]');break\n    h+=[dict(type=\"custom_tool_call_output\",call_id=i[\"call_id\"],output=sh(i[\"input\"])) for i in c]\n```\n\n## Why this works as a practical tutorial for agents\n\nIf you want to deploy this from scratch, here is the breakdown of the logic:\n\n1. **Zero Dependencies:** It uses `urllib`\n\nand `subprocess`\n\nfrom the stdlib. This means zero supply chain risk and near-instant startup time.\n\n2. **The Tool Loop:** The `while True`\n\nloop is the \"brain.\" It checks if the model's output contains a `custom_tool_call`\n\n. If it does, it executes the shell command (`sh`\n\n) and feeds the result back into the history (`h`\n\n).\n\n3. **Open-Ended Control:** By giving the agent access to `sh`\n\n, you've essentially given it the keys to the environment. It can read files, list directories, or run scripts.\n\n4. **Context Tracking:** The `z`\n\nvariable calculates the percentage of the context window used, which is critical for long-running sessions.\n\nTo run this, you just need an OpenAI-compatible inference endpoint. You can pass the URL as a command-line argument: `python agent.py http://your-api-endpoint`\n\n.\n\nThis is a great starting point for anyone wanting a deep dive into how LLM agents actually function without the abstraction layers of LangChain or AutoGPT.\n\n[Next AI Voiceover Workflow: Scaling Solo Content →](/en/threads/2364/)", "url": "https://wpnews.pro/news/building-an-llm-agent-doesn-t-actually-require-a-massive", "canonical_source": "https://promptcube3.com/en/threads/2380/", "published_at": "2026-07-23 15:02:03+00:00", "updated_at": "2026-07-23 23:07:19.721388+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "large-language-models"], "entities": ["OpenAI", "LangChain", "AutoGPT", "Docker"], "alternates": {"html": "https://wpnews.pro/news/building-an-llm-agent-doesn-t-actually-require-a-massive", "markdown": "https://wpnews.pro/news/building-an-llm-agent-doesn-t-actually-require-a-massive.md", "text": "https://wpnews.pro/news/building-an-llm-agent-doesn-t-actually-require-a-massive.txt", "jsonld": "https://wpnews.pro/news/building-an-llm-agent-doesn-t-actually-require-a-massive.jsonld"}}