Build your own Claude Code

Reddit r/AI_Agents Tools

Summary

16-year-old Brazilian developer Kauan announces Tiny Agents, a Python framework for easily building AI agent harnesses with multi-provider model support, context-window management, async workers, tool execution, and a customizable terminal UI — demonstrating a Claude Code-like assistant in just 103 lines of code.

Hey everyone! I'm Kauan, a 16-year-old developer from Brazil, and I'm building Tiny Agents, a Python framework focused on making AI agent harnesses ridiculously easy to build. I'm developing it for Hack Club's Terra program, and during the prep week I've already implemented support for models from two providers, context-window management, asynchronous workers, a customizable terminal UI with commands, and tool execution. To demonstrate what you can build with it, I put together a working assistant with model selection, configurable tools, context compaction, custom commands, and a full interactive TUI. The fun part? The entire example application is just 103 lines of Python. The idea is to keep the application code simple while Tiny Agents handles much of the underlying harness infrastructure, leaving developers free to customize the behavior instead of wiring everything together from scratch. Github link in the comments I'm still actively developing it, so I'd love feedback from people who build AI agents: - What parts of building an agent harness do you find the most tedious? - Would you prefer a minimal framework like this, or a more batteries-included solution? - What would you need to see before considering using it in a real project? And here the example: import os from dotenv import load_dotenv from prompt_toolkit.patch_stdout import patch_stdout from tinyAgents import * from tinyAgents.panel import initPanel, PanelContext, Command, AsyncWorker from tinyAgents.colors import * agent_worker = AsyncWorker() load_dotenv() apiKeyNvidia = os.getenv("API_KEY_NVIDIA") apiKeyOllama = os.getenv("API_KEY_OLLAMA") profiles = { "nvidia": { "models": ["openai/gpt-oss-20b", "nvidia/nemotron-3-super-120b-a12b", "z-ai/glm-5-3-flash"], "apiKey": apiKeyNvidia, }, "cloud-ollama": { "models": ["gpt-oss:20b"], "apiKey": apiKeyOllama, } } selected = ["nvidia", "nvidia/nemotron-3-super-120b-a12b"] toolsJsonPath = os.path.join("Tools", "tools.json") toolsCallJsonPath = os.path.join("Tools", "toolsCall.json") TOOLS = loadTools(toolsJsonPath) TOOLS_HANDLERS = loadToolHandlers(toolsCallJsonPath) prePrompt = "You are a helpful agent that provides detailed answers. Use tools only when the user asks." agent = AgentHarness( profiles=profiles, selected=selected, tools=TOOLS, tool_handlers=TOOLS_HANDLERS, pre_prompt=prePrompt, worker=agent_worker, ) def echo(args: list[str], ctx: PanelContext) -> str: return " ".join(args) def clear_command(args: list[str], ctx: PanelContext) -> None: ctx.clear() def exit_command(args: list[str], ctx: PanelContext) -> None: ctx.exit() COMMANDS = [ Command("/echo", "Repeat the arguments", echo), Command("/clear", "Clear the panel", clear_command), Command("/exit", "Exit the panel", exit_command), Command("/compact", "Compact the context window", agent.compact_context), ] PANEL_CONFS = { "NAME_TEXT": f"{BOLD + BLUE}KML CODE{RESET}", "SUBNAME_TEXT": f"{ITALIC}The Tiny Agents Ultimate Framework{RESET}", "INPUT_BOX_UPPER_TEXT": f"{DIM}Try typing something{RESET}", "THINKING_TEXT": "Thinking...", "MODEL_NAME": agent.model, "MODEL_PROVIDER": agent.provider, "MODEL_OPTION": agent.model_option, "CONTEXT_WINDOW_SIZE": contextWindowSize, "CONTEXT_WINDOW_MAX": 10000, "THEME": "default", "MESSAGE_SPACING": 1, "STYLE": { "title": BOLD + BLUE, "user": BG_BLUE + WHITE, "model": WHITE, "error": RED, "separator": DIM + BLACK, "hint": DIM, "input-field": BG_BLUE + WHITE, "completion-menu": WHITE, "completion-menu.completion": WHITE, "completion-menu.completion.current": BG_BLUE + BOLD + BLUE, "scrollbar": BG_BLACK, "scrollbar.button": BG_BLACK + WHITE, }, "COMMANDS": COMMANDS, "COMMANDS_LIST": [command.name for command in COMMANDS], "MODEL_HANDLER": agent.model_handler, "MODEL_OPTIONS": agent.model_options(), "MODEL_OPTION_LABELS": agent.model_option_labels(), "MODEL_SELECT_HANDLER": agent.select_model, } panel = initPanel(PANEL_CONFS) with patch_stdout(): panel.run()
Original Article

Similar Articles

Claude Code in 9 lines python

Reddit r/LocalLLaMA

A developer shares a 9-line Python implementation of a minimal coding agent similar to Claude Code or Codex, using only the standard library and compatible with any OpenAI Responses API, with code on GitHub.