Show HN: Agent in 9 Lines Python
Sentiment Mix
Geography
Expert Signals
tosh
author • 1 mention
Hacker News
source • 1 mention
AI-Generated Claims
Generated from linked receipts; click sources for full context.
Show HN: Agent in 9 Lines Python.
Supported by 1 story
I asked myself: what would a minimal implementation of an agent look like?Something that works out of the box, is a real agent with tool calling, but without 1000s of lines of code, without dozens or hundreds of npm or pypi dependencies.
Supported by 1 story
Something with just a few 'essential' features (not a whole kitchen sink that most agent harnesses come with nowadays).An implementation close to pseudocode that you can look at in one page, everything there at a glance, no scrolling.This is the agent.py I ended up with so far: import json,sys;from subprocess import getoutput as sh;from urllib.request import Request as R,urlopen url=sys.argv[1];h=[];b=dict(model="gpt-5.6",input=h,tools=[dict(type="custom",name="sh")]) while p:=input("> "): h+=[dict(role="user",content=p)];H={"Content-Type":"application/json"} while True: o=(r:=json.load(urlopen(R(url,json.dumps(b).encode(),H))))["output"] h+=o;c=[i for i in o if i["type"]=="custom_tool_call"];z=r["usage"]["total_tokens"]/10500 if not...
Supported by 1 story
Related Events
Anthropic Mass-Produces Its Own AI Agents Named Lei Zhang and Xu Xin - 36 Kr
LLMs • 7/22/2026
Introducing OpenAI Presence
LLMs • 7/22/2026
Show HN: DeepSQL – A self-hostable DBA agent for Postgres and MySQL
Uncategorized • 7/22/2026
Show HN: Housecat.com – Gmail + durable workflows + sandbox VM
Uncategorized • 7/22/2026
How to create a skill in Claude Code for your design system - Figma
LLMs • 7/22/2026