Why one agent instance must serve one run: lessons from smolagents source
Mahmoud_Zalt · x · 2026-09-11
AI architect Mahmoud Zalt dissects Hugging Face smolagents' agents.py to argue a core engineering rule: one agent instance should serve one run unless sharing is explicitly synchronized.
- MultiStepAgent.run() is a ReAct state machine: record task, plan, request model action, execute tools/code, store observations, loop until final answer or maxsteps.
- Though stateless at the API boundary, the agent internally owns mutable state across model transport, AgentMemory, and PythonExecutor backends.
- A reusable agent loop is also a mutable run container — this dictates safe concurrency and deployment; parallel tool execution is the key risk point.
- Takeaway: separate orchestration from execution and assign per-run ownership to make concurrency and deployment safe.
More from coding & agent
- Blacksmith ships free default container caching, CI jobs 25-89% faster — DanielLockyer · 2026-09-11
- Open-source agent skill /first-reader simulates real readers reviewing your draft line by line — Saboo_Shubham_ · 2026-09-11
- Agent Beacon: open-source local telemetry layer records what AI agents do across 23+ harnesses — Scobleizer · 2026-09-11
- OpenAI Releases 1-Hour Codex Workshop on Building Agentic Systems from Scratch — nikola_mr64990 · 2026-09-11
- Dev builds unofficial MCP that drives a browser to edit API-less game tracker — Renyc_Elessar · 2026-09-11
- AI Agent Starts Emailing Itself Notes 1-3 Times a Day to Track Its Own Tasks — RachelVT42 · 2026-09-11