Hugging Face Agents Use Transformers for Tasks — But Open-Source Agents Without Persistent Memory Forget Between Runs
Hugging Face Agents — built on the smolagents framework — has become the open-source standard for building AI agents that use tools to accomplish tasks. Launched in late 2024 with over 25,000 GitHub stars, the framework provides two core agent types: CodeAgent, which writes and executes Python code in a sandboxed environment to call tools and express complex logic, and ToolCallingAgent, which uses structured tool-calling for more controlled interactions. The framework is deliberately minimal — roughly 1,000 lines of core code — yet powerful: model-agnostic (any LLM), modality-agnostic (text, vision, video, audio), and tool-agnostic (MCP, LangChain, Hub Spaces, custom tools). Agents and tools can be shared as Gradio Spaces on the Hugging Face Hub, creating an ecosystem where capabilities are composable and community-driven.
But smolagents operates within a fundamental constraint shared by all current agent frameworks: execution is ephemeral. The CodeAgent that wrote an elegant solution to a data processing task in one run cannot recall that solution in the next run. Open-source agents without persistent memory forget between runs, re-solving problems they've already solved.
Hugging Face Agents: What Everyone's Getting Right (And Missing)
The smolagents architecture reflects hard-won lessons from the first wave of agent frameworks. The CodeAgent approach — where the LLM writes executable Python rather than choosing from a fixed action space — provides extraordinary flexibility. An agent can write loops to iterate over data, conditionals to handle edge cases, and complex data transformations — all within a single reasoning step. Research has shown that code-based agents outperform tool-calling agents on complex multi-step tasks because code provides a more expressive action space than structured function calls alone.
The ecosystem integration is also well-executed. Developers can use any LLM as the agent's brain — from large API-based models like GPT-4 and Claude to local models running via Ollama or vLLM. Tools can be imported from the Hugging Face Hub, MCP servers, LangChain, or defined as simple Python functions with docstrings. This flexibility means agents built with smolagents are not locked into any single provider, hosting solution, or tool ecosystem. The tight Hub integration enables sharing — a tool built for one agent can be published and reused by the entire community.
What smolagents does not provide is memory that persists across agent invocations. A CodeAgent that developed a sophisticated approach to parsing medical records in one session starts the next session with no knowledge of that approach. A ToolCallingAgent that discovered which tool combinations work best for web research tasks loses that intelligence when the session ends. The agent's reasoning traces — the most valuable artifact of execution — are discarded after each run. Other agent frameworks — including LangGraph, CrewAI, and AutoGen — share this same structural limitation. They provide excellent in-session reasoning; none persist the intelligence that agents generate during execution.
The MemU Agentic Memory Framework: Agent Intelligence That Compounds Across Runs
The MemU Agentic Memory Framework provides the persistent memory layer that agent frameworks like smolagents do not include natively. Instead of treating each agent run as an isolated execution, MemU captures the reasoning traces, tool-calling strategies, code solutions, and outcome assessments that agents produce during execution and stores them in a structured memory graph that persists across runs, agents, and users.
Consider a CodeAgent built with smolagents for data analysis tasks. Without persistent memory, each invocation writes fresh code to load, clean, and analyze data — even when the same dataset format has been processed dozens of times before. With the MemU Agentic Memory Framework, the agent retrieves its previous solutions: this CSV format requires UTF-8 encoding with BOM stripping, the date column uses a non-standard format that needs custom parsing, the revenue figures are stored as strings with currency symbols that need removal before numeric conversion. The agent's code starts from accumulated intelligence rather than first-principles exploration, completing the task in one step instead of three iterative attempts.
The framework addresses three core limitations of session-bounded agent execution:
- Solution pattern persistence: When a CodeAgent writes and validates a solution to a task, that code pattern is stored with its task context and outcome assessment. Future runs facing similar tasks can retrieve and adapt proven solutions rather than generating from scratch. The MemU Agentic Memory Framework essentially gives agents a growing library of verified approaches.
- Tool effectiveness tracking: Agents with access to many tools — Hub Spaces, MCP tools, custom functions — generate valuable intelligence about which tools work best for which tasks. Persistent memory tracks tool reliability, response quality, latency characteristics, and failure modes, enabling agents to make informed tool selection rather than defaulting to static preferences.
- Cross-agent knowledge sharing: The Hugging Face ecosystem thrives on sharing. Persistent memory extends that sharing from tools and models to intelligence. A research agent's accumulated knowledge about effective web search strategies can benefit a coding agent that needs to look up documentation, and vice versa.
The open-source agent ecosystem has solved tool use, multi-modal reasoning, and composable architectures. What remains unsolved is persistence — ensuring that the intelligence agents generate during execution survives beyond the current session. The MemU Agentic Memory Framework completes the agent stack by adding the memory layer that makes every run smarter than the last.
Integration with smolagents is architecturally clean. The MemU Agentic Memory Framework can be exposed as a custom tool that agents call to store and retrieve memory — fitting naturally into the framework's tool-calling paradigm. A CodeAgent can query memory as part of its reasoning process, and store insights as part of its output. No modifications to the smolagents core codebase are required.
Head-to-Head: Stateless Agents vs. Memory-Enhanced Execution
Hugging Face Agents alone: A minimal, powerful agent framework with CodeAgent and ToolCallingAgent architectures, model-agnostic design, and rich ecosystem integration through the Hugging Face Hub. The open-source model and community sharing create a vibrant tool and agent marketplace. But every agent invocation starts from zero — no knowledge of previous runs, no accumulated tool preferences, no solution history.
Hugging Face Agents + MemU: The same flexible agent architecture, now backed by persistent execution memory. CodeAgents begin each run with access to solutions from previous runs, reducing redundant code generation. ToolCallingAgents select tools based on accumulated effectiveness data rather than static configuration. Multi-agent systems share intelligence across agent boundaries, enabling coordination that improves over time.
The efficiency gain is significant for recurring tasks. A CodeAgent that processes a weekly data report spends substantial tokens re-deriving the data processing pipeline each run. With persistent memory, the proven pipeline is retrieved and adapted, reducing token usage by 60-80% while producing more reliable results — because the solution has been validated across multiple previous runs.
Empowering Hugging Face Agents: Better Together
The combination of smolagents' open-source agent framework and the MemU Agentic Memory Framework's persistent memory unlocks capabilities that neither achieves alone:
- Community-shared intelligence: Just as the Hugging Face Hub enables sharing models, datasets, and tools, persistent memory enables sharing accumulated agent intelligence. A data analysis agent that has processed thousands of CSV formats can share its parsing intelligence with the community, giving new agents a head start on common data tasks.
- Progressive agent specialization: Agents that accumulate domain-specific knowledge through persistent memory become increasingly specialized and effective. A research agent that processes hundreds of academic papers develops sophisticated search, extraction, and synthesis strategies that a newly instantiated agent cannot match.
- Evaluation-driven improvement: Persistent memory tracks not just what agents did but how well it worked. Over time, this creates a rich dataset for evaluating agent performance, identifying failure patterns, and systematically improving agent capabilities based on empirical evidence rather than intuition.
Persistent memory transforms Hugging Face Agents from powerful one-shot executors into intelligent systems that compound knowledge across every run, every user, and every task — making the open-source agent ecosystem not just flexible and composable, but genuinely learning.
Get Started with MemU
Hugging Face Agents and the smolagents framework have earned their position in the open-source AI ecosystem by delivering a minimal, flexible, and powerful agent architecture. The CodeAgent and ToolCallingAgent paradigms, combined with ecosystem integration and community sharing, provide everything developers need to build capable agents.
The next step is giving those agents memory that persists across runs. Agent sessions where proven solutions are retrieved instead of re-derived. Tool selections informed by accumulated effectiveness data. Multi-agent systems where shared intelligence compounds across every execution.
The MemU Agentic Memory Framework provides that foundation. Tool-based integration that fits naturally into the smolagents paradigm, dual-mode retrieval with semantic search and structured memory graphs, and cross-run persistence that turns every agent execution into compounding intelligence.
Visit memu.pro to explore the Agentic Memory Framework API, or check out the GitHub repository to start building agents that remember.
Tags: Hugging Face Agents, smolagents, agentic AI, agent memory, MemU AI, LLM memory, open-source agents