EVEMISSTechnology

Repository guide · architecture · v2

huggingface / smolagents · Architecture

Static view of a Python agent library: 185 analyzed files around docs, examples, src and tests; ten reported entrypoints; recorded execution paths that all end at unresolved external boundaries; core src/smolagents modules ranked by inferred call-degree roles; and 6888 of 7633 static relations left external or unresolved.

Original repository
huggingface/smolagents
License
Apache-2.0 · open-source license
Analyzed revision · last verified
30bb1161095dbae2271e6bc3cc4c219cc3897a57 ·

Newer revision observed; the code this guide cites is unchanged. The default branch moved to c30b115286e0, checked 2026-10-03. A revision diff of 6 changed files found no change in the code regions this guide cites. The guide still describes revision 30bb1161095d; repository-wide counts (files, calls and so on) refer to that revision.

huggingface/smolagents Architecture: How the Repository Is Structured

Terms used on this page
Entrypoint record
A file the analyzer marks as a place where execution can start. When it carries a __main__ guard excerpt, the file contains an if __name__ == "__main__": block and the excerpt shows what that block calls; without an excerpt, the file was flagged by its name only.
Bounded static execution path
A call chain reconstructed from the source code without running it, stopped after a fixed number of steps. It shows how far the code can be followed on paper, not what happens at run time.
Unresolved boundary
Where a static path stops because the next call goes into an external library or cannot be resolved without running the code. It marks the edge of this analysis, not a defect in the repository.
Static relations
Calls and imports found in the source. "External or unresolved" relations point outside the analyzed files.
Module role
The analyzer's label for a file, inferred from how many calls go in and out (for example core, entry/orchestration, leaf). It describes a position in the call graph, not the authors' design.
Test-like files
Files whose names or locations look like tests. This analysis counts them; it does not run them.
Observed · inferred · author-claimed · unresolved
How each statement is supported: read directly from the analyzed files; derived by the analyzer from them; stated by the repository's authors (metadata, README); or not established by this analysis.
Verified
Two uses on these pages. In an analyzer record ("verified provenance", "a verified entrypoint") it means the record was read directly from the analyzed files, which these guides call observed; for an entrypoint, the __main__ guard text is present. Since the analyzer fix of 2026-10-04, a file that only has an entrypoint-like name such as cli.py or main.py is recorded as inferred; guides analyzed before that still call such a file verified, and it is still only a guess about how the file is used. It does not mean the code was run or tested. "Last verified" is the date the guide last passed the lab's checks against the analysis record of the stated revision; it is not a review of the repository itself.

Shape at a glance

GitHub metadata records Python as the primary language, and the repository's own description calls it smolagents, 'a barebones library for agents that think in code'.

The analyzer summary counts 185 analyzed files organized around docs, examples, src and tests, including 28 test-like files, and the subsystem records flag docs, src and tests as likely subsystems.

Reported top-level file counts: docs 81, examples 34, src 21, tests 28, .github 10, plus 11 root-level files.

  • src/smolagents holds files such as cli.py and vision_web_browser.py, both flagged as likely entrypoints.
  • examples/ holds runnable scripts with per-example requirements manifests, such as examples/async_agent/requirements.txt and examples/open_deep_research/requirements.txt.

Entrypoints and control flow

Ten entrypoints are reported: eight files carry an explicit __main__ execution guard — examples/structured_output_tool.py, src/smolagents/cli.py, src/smolagents/vision_web_browser.py, examples/open_deep_research/app.py, examples/open_deep_research/run.py, examples/open_deep_research/run_gaia.py, examples/plan_customization/plan_customization.py, examples/smolagents_benchmark/run.py — and examples/async_agent/main.py plus examples/server/main.py are candidates by filename heuristic.

The summary names examples/structured_output_tool.py as the apparent main starting place, while a teaching claim points to examples/async_agent/main.py. The reconstruction reports 90 bounded execution paths; ten are recorded individually here.

Of the recorded paths:

  • both examples/async_agent/main.py paths stop at Route and Starlette;
  • the three examples/open_deep_research/app.py paths stop at create_agent, GradioUI and demo.launch;
  • the five examples/open_deep_research/run.py paths stop at load_dotenv, login, os.getenv and threading.Lock.

All ten end the same way: terminal reason 'unresolved_boundary', no truncation, no detected cycle.

Core modules and assigned roles

All 20 module-role records in the packet are analyzer inferences drawn from static resolved call degree and entrypoint membership; none is confirmed by runtime evidence.

  • src/smolagents/local_python_executor.py has the highest call degree listed: 195 incoming and 190 outgoing calls.
  • src/smolagents/models.py (60 in / 66 out) and src/smolagents/agents.py (16 in / 80 out) are service/core candidates.
  • src/smolagents/utils.py (56 in / 8 out) and src/smolagents/_function_type_hints_utils.py (24 in / 18 out) are also core candidates.
  • Further src/smolagents candidates: tools.py (5/24), remote_executors.py (7/22), monitoring.py (17/1), memory.py (16/1), gradio_ui.py (9/9), agent_types.py (10/5), serialization.py (10/4).
  • In examples/open_deep_research/scripts: mdconvert.py (30/29), gaia_scorer.py (12/12), run_agents.py (4/4).
  • Entry/orchestration candidates: src/smolagents/cli.py, src/smolagents/vision_web_browser.py, examples/open_deep_research/run_gaia.py, examples/plan_customization/plan_customization.py.
  • tests/test_agents.py is the highest-degree test module (89 in / 89 out).

Where static paths stop

Most recorded edges leave the analyzable area: 6888 of 7633 static relations are external or unresolved, and only 745 resolve to local targets.

The recorded paths stop at:

  • Route and Starlette, reached from examples/async_agent/main.py; starlette is also a declared runtime dependency of that example;
  • create_agent, GradioUI and demo.launch, reached from examples/open_deep_research/app.py — the packet does not establish where these targets are defined;
  • load_dotenv, login, os.getenv and threading.Lock, reached from examples/open_deep_research/run.py.

Each of the ten recorded paths terminates because its next target is external or unresolved rather than another analyzed module.

The analyzer also documents that reflection, runtime dependency injection, dynamic imports, monkey-patching, generated code, framework runtime wiring and dynamic dispatch are not resolved.

Dependencies between parts

Recorded relations divide into 6700 calls and 933 imports (7633 total); the reconstruction separately reports 615 resolved static call relations, a figure the packet does not reconcile with the 745 local edges.

Manifest evidence:

  • examples/async_agent/requirements.txt declares smolagents, starlette, anyio and uvicorn as runtime dependencies — the example lists the library itself.
  • examples/open_deep_research/requirements.txt yields records including anthropic (>=0.37.1), openai (>=1.52.2), transformers (>=4.46.0) and torch (>=2.2.2).
  • Records cover requirements-style manifests only: pyproject.toml dependency tables are not parsed, so the src package's own dependencies are absent.

Internal coupling: high incoming counts on local_python_executor.py (195) and models.py (60) suggest, by inference, that much of src/smolagents is called from elsewhere, but the packet does not list the callers.

What static analysis cannot show

How the pieces are wired while the program runs is not established here: the analyzer does not resolve framework runtime wiring, dynamic dispatch, reflection, dynamic imports, monkey-patching, generated code or runtime dependency injection.

Also outside this analysis:

  • installation and run/build behavior is only partially inferred, and installation commands are not verified;
  • README-derived statements are line-based extractions and count as author claims at best;
  • the manifest's capability fields describe the analyzer itself, not the repository, and are excluded from evidence;
  • tests exist (28 test-like files per the summary), but what they verify at runtime is not established.

Finally, 6888 of 7633 relations are external or unresolved, so a missing link in this data is not evidence that two parts are independent.

A reading order for the architecture

README.md, pyproject.toml and LICENSE are classified as project-level important files.

A teaching claim in the packet recommends starting from manifests and important symbols, then tracing the bounded execution paths and inspecting the unresolved boundaries before changing code.

What this analysis could not establish

The writing model's own notes on the analysis record. Identifiers such as lim_3, exec_* or claim_… name records of that analysis; the claims table cites the same records.

  • Only 10 of the 90 reported bounded execution paths appear as individual records; cycle and truncation facts are confirmed only for those ten.
  • Dependency records cover only examples/async_agent/requirements.txt and examples/open_deep_research/requirements.txt; pyproject.toml dependency tables were not parsed (lim_3), so the src package's own dependencies are unknown.
  • The packet reports 615 resolved static call relations (reconstruction overview) and 745 local edges (relation counts) without reconciling the two figures.
  • readme.md was excluded from the important-file list because its path is not in the analyzed inventory (case-variant match), so README content is not evidenced in this asset.
  • Where the unresolved targets create_agent, GradioUI and demo.launch are defined is not established by the packet.
  • No record lists which internal modules call which; internal coupling is visible only as per-module call degrees.
Claims and evidence — 40 claims, 40 supported by an independent verifier

Every substantive statement above is a claim bound to grounding IDs of the analyzed revision. Global grounding IDs are namespaced by the analysis run.

Claim Epistemic status Verifier Grounding (global IDs)
c1 GitHub metadata records Python as the repository's primary language. observed supported analysis_c0e49dab7c5999ba:meta_primary_language
c2 The repository's GitHub description calls it smolagents, 'a barebones library for agents that think in code'. author_claimed supported analysis_c0e49dab7c5999ba:meta_description
c3 The analyzer summary counts 185 analyzed files organized around docs, examples, src and tests, includes 28 test-like files, and the subsystem records flag docs, src and tests as likely subsystems. inferred supported analysis_c0e49dab7c5999ba:summary_repository, analysis_c0e49dab7c5999ba:subsys_1, analysis_c0e49dab7c5999ba:subsys_2, analysis_c0e49dab7c5999ba:subsys_3
c4 Reported top-level file counts are docs 81, examples 34, src 21, tests 28, .github 10, and 11 root-level files. inferred supported analysis_c0e49dab7c5999ba:summary_repository
c5 src/smolagents contains files including cli.py and vision_web_browser.py, both flagged as likely entrypoints. observed supported analysis_c0e49dab7c5999ba:important_6, analysis_c0e49dab7c5999ba:important_7, analysis_c0e49dab7c5999ba:py_entry_c3be260bce7b, analysis_c0e49dab7c5999ba:py_entry_3c44d771157e
c6 examples/ holds runnable scripts with per-example requirements manifests, including examples/async_agent/requirements.txt and examples/open_deep_research/requirements.txt; examples/async_agent/main.py is a filename-heuristic entrypoint candidate. inferred supported analysis_c0e49dab7c5999ba:dep_1, analysis_c0e49dab7c5999ba:dep_5, analysis_c0e49dab7c5999ba:entry_4
c7 Ten entrypoints are reported: eight files contain a Python __main__ execution guard (examples/structured_output_tool.py, src/smolagents/cli.py, src/smolagents/vision_web_browser.py, examples/open_deep_research/app.py, examples/open_deep_research/run.py, examples/open_deep_research/run_gaia.py, examples/plan_customization/plan_customization.py, examples/smolagents_benchmark/run.py), and examples/async_agent/main.py plus examples/server/main.py are filename-heuristic candidates. observed supported analysis_c0e49dab7c5999ba:py_entry_77730e8143f6, analysis_c0e49dab7c5999ba:py_entry_c3be260bce7b, analysis_c0e49dab7c5999ba:py_entry_3c44d771157e, analysis_c0e49dab7c5999ba:py_entry_eb911c5c2fc4, analysis_c0e49dab7c5999ba:py_entry_9daffde399e1, analysis_c0e49dab7c5999ba:py_entry_66aae1c925b6, analysis_c0e49dab7c5999ba:py_entry_a424b56a044e, analysis_c0e49dab7c5999ba:py_entry_b2d8852474a5, analysis_c0e49dab7c5999ba:entry_4, analysis_c0e49dab7c5999ba:entry_8
c8 The reconstruction overview reports 90 bounded execution paths for the analyzed revision; the packet records ten of them individually. inferred supported analysis_c0e49dab7c5999ba:architecture_reconstruction
c9 The analyzer summary names examples/structured_output_tool.py as the apparent main starting place, while a teaching claim names examples/async_agent/main.py as a detected starting point. inferred supported analysis_c0e49dab7c5999ba:summary_repository, analysis_c0e49dab7c5999ba:claim_175a3103d801
c10 Both recorded paths from examples/async_agent/main.py stop at Route and Starlette. inferred supported analysis_c0e49dab7c5999ba:exec_fcb626546464, analysis_c0e49dab7c5999ba:exec_4295bbf65082
c11 The three recorded paths from examples/open_deep_research/app.py stop at create_agent, GradioUI and demo.launch, each recorded as external or unresolved. inferred supported analysis_c0e49dab7c5999ba:exec_5beaf01e7396, analysis_c0e49dab7c5999ba:exec_6e6d72c98a2e, analysis_c0e49dab7c5999ba:exec_9cb721a97873
c12 The five recorded paths from examples/open_deep_research/run.py stop at load_dotenv, login, os.getenv (in two paths) and threading.Lock. inferred supported analysis_c0e49dab7c5999ba:exec_908b95280793, analysis_c0e49dab7c5999ba:exec_9cd14e99f98c, analysis_c0e49dab7c5999ba:exec_c734ee78c539, analysis_c0e49dab7c5999ba:exec_0178b2f8836e, analysis_c0e49dab7c5999ba:exec_d21a9989d8dd
c13 All ten recorded paths end with terminal reason 'unresolved_boundary'; none is truncated and none detects a cycle. inferred supported analysis_c0e49dab7c5999ba:exec_fcb626546464, analysis_c0e49dab7c5999ba:exec_4295bbf65082, analysis_c0e49dab7c5999ba:exec_5beaf01e7396, analysis_c0e49dab7c5999ba:exec_6e6d72c98a2e, analysis_c0e49dab7c5999ba:exec_9cb721a97873, analysis_c0e49dab7c5999ba:exec_908b95280793, analysis_c0e49dab7c5999ba:exec_9cd14e99f98c, analysis_c0e49dab7c5999ba:exec_c734ee78c539, analysis_c0e49dab7c5999ba:exec_0178b2f8836e, analysis_c0e49dab7c5999ba:exec_d21a9989d8dd
c14 All 20 module-role records in the packet are analyzer inferences drawn from static resolved call degree and entrypoint membership; none is confirmed by runtime evidence. inferred supported analysis_c0e49dab7c5999ba:role_22, analysis_c0e49dab7c5999ba:role_32, analysis_c0e49dab7c5999ba:role_24, analysis_c0e49dab7c5999ba:role_18, analysis_c0e49dab7c5999ba:role_30, analysis_c0e49dab7c5999ba:role_6, analysis_c0e49dab7c5999ba:role_16, analysis_c0e49dab7c5999ba:role_26, analysis_c0e49dab7c5999ba:role_29, analysis_c0e49dab7c5999ba:role_5, analysis_c0e49dab7c5999ba:role_21, analysis_c0e49dab7c5999ba:role_25, analysis_c0e49dab7c5999ba:role_23, analysis_c0e49dab7c5999ba:role_17, analysis_c0e49dab7c5999ba:role_27, analysis_c0e49dab7c5999ba:role_4, analysis_c0e49dab7c5999ba:role_31, analysis_c0e49dab7c5999ba:role_10, analysis_c0e49dab7c5999ba:role_19, analysis_c0e49dab7c5999ba:role_7
c15 src/smolagents/local_python_executor.py has the highest call degree among the listed roles: 195 incoming and 190 outgoing calls. inferred supported analysis_c0e49dab7c5999ba:role_22
c16 src/smolagents/models.py (60 incoming, 66 outgoing) and src/smolagents/agents.py (16 incoming, 80 outgoing) are service/core candidates. inferred supported analysis_c0e49dab7c5999ba:role_24, analysis_c0e49dab7c5999ba:role_18
c17 src/smolagents/utils.py (56 in, 8 out) and src/smolagents/_function_type_hints_utils.py (24 in, 18 out) are service/core candidates. inferred supported analysis_c0e49dab7c5999ba:role_30, analysis_c0e49dab7c5999ba:role_16
c18 Further service/core candidates in src/smolagents are tools.py (5/24), remote_executors.py (7/22), monitoring.py (17/1), memory.py (16/1), gradio_ui.py (9/9), agent_types.py (10/5) and serialization.py (10/4). inferred supported analysis_c0e49dab7c5999ba:role_29, analysis_c0e49dab7c5999ba:role_26, analysis_c0e49dab7c5999ba:role_25, analysis_c0e49dab7c5999ba:role_23, analysis_c0e49dab7c5999ba:role_21, analysis_c0e49dab7c5999ba:role_17, analysis_c0e49dab7c5999ba:role_27
c19 In examples/open_deep_research/scripts, mdconvert.py (30/29), gaia_scorer.py (12/12) and run_agents.py (4/4) are service/core candidates. inferred supported analysis_c0e49dab7c5999ba:role_6, analysis_c0e49dab7c5999ba:role_5, analysis_c0e49dab7c5999ba:role_7
c20 Entry/orchestration candidates are src/smolagents/cli.py, src/smolagents/vision_web_browser.py, examples/open_deep_research/run_gaia.py and examples/plan_customization/plan_customization.py. inferred supported analysis_c0e49dab7c5999ba:role_19, analysis_c0e49dab7c5999ba:role_31, analysis_c0e49dab7c5999ba:role_4, analysis_c0e49dab7c5999ba:role_10
c21 tests/test_agents.py is the highest-degree test module, with 89 incoming and 89 outgoing calls. inferred supported analysis_c0e49dab7c5999ba:role_32
c22 6888 of 7633 static relations are external or unresolved; 745 resolve to local targets. observed supported analysis_c0e49dab7c5999ba:relation_counts
c23 The two recorded async_agent paths stop at the targets Route and Starlette; starlette is also a declared runtime dependency of that example. inferred supported analysis_c0e49dab7c5999ba:exec_fcb626546464, analysis_c0e49dab7c5999ba:exec_4295bbf65082, analysis_c0e49dab7c5999ba:dep_2
c24 The three recorded app.py paths stop at create_agent, GradioUI and demo.launch, recorded as external or unresolved; the packet does not establish where these targets are defined. inferred supported analysis_c0e49dab7c5999ba:exec_5beaf01e7396, analysis_c0e49dab7c5999ba:exec_6e6d72c98a2e, analysis_c0e49dab7c5999ba:exec_9cb721a97873
c25 The five recorded run.py paths stop at load_dotenv, login, os.getenv and threading.Lock. inferred supported analysis_c0e49dab7c5999ba:exec_908b95280793, analysis_c0e49dab7c5999ba:exec_9cd14e99f98c, analysis_c0e49dab7c5999ba:exec_c734ee78c539, analysis_c0e49dab7c5999ba:exec_0178b2f8836e, analysis_c0e49dab7c5999ba:exec_d21a9989d8dd
c26 Each of the ten recorded paths terminates because its next target is external or unresolved rather than another analyzed module. inferred supported analysis_c0e49dab7c5999ba:exec_fcb626546464, analysis_c0e49dab7c5999ba:exec_4295bbf65082, analysis_c0e49dab7c5999ba:exec_5beaf01e7396, analysis_c0e49dab7c5999ba:exec_6e6d72c98a2e, analysis_c0e49dab7c5999ba:exec_9cb721a97873, analysis_c0e49dab7c5999ba:exec_908b95280793, analysis_c0e49dab7c5999ba:exec_9cd14e99f98c, analysis_c0e49dab7c5999ba:exec_c734ee78c539, analysis_c0e49dab7c5999ba:exec_0178b2f8836e, analysis_c0e49dab7c5999ba:exec_d21a9989d8dd
c27 The analyzer documents that reflection, runtime dependency injection, dynamic imports, monkey-patching, generated code, framework runtime wiring and dynamic dispatch are not resolved. observed supported analysis_c0e49dab7c5999ba:lim_1
c28 Relation counts record 6700 calls and 933 imports (7633 total); the reconstruction overview separately reports 615 resolved static call relations, a figure the packet does not reconcile with the 745 local edges. inferred supported analysis_c0e49dab7c5999ba:relation_counts, analysis_c0e49dab7c5999ba:architecture_reconstruction
c29 examples/async_agent/requirements.txt declares smolagents, starlette, anyio and uvicorn as runtime dependencies, so the example lists the library itself. observed supported analysis_c0e49dab7c5999ba:dep_1, analysis_c0e49dab7c5999ba:dep_2, analysis_c0e49dab7c5999ba:dep_3, analysis_c0e49dab7c5999ba:dep_4
c30 Dependency records from examples/open_deep_research/requirements.txt include anthropic (>=0.37.1), openai (>=1.52.2), transformers (>=4.46.0) and torch (>=2.2.2). observed supported analysis_c0e49dab7c5999ba:dep_5, analysis_c0e49dab7c5999ba:dep_15, analysis_c0e49dab7c5999ba:dep_30, analysis_c0e49dab7c5999ba:dep_28
c31 Dependency records exist only for requirements-style manifests; the analyzer does not parse pyproject.toml dependency tables, so the src package's own dependencies are absent from the records. observed supported analysis_c0e49dab7c5999ba:dep_1, analysis_c0e49dab7c5999ba:dep_5, analysis_c0e49dab7c5999ba:lim_3
c32 High incoming-call counts on src/smolagents/local_python_executor.py (195) and src/smolagents/models.py (60) indicate, by inference, heavy call coupling into src/smolagents, but the packet does not list the callers. inferred supported analysis_c0e49dab7c5999ba:role_22, analysis_c0e49dab7c5999ba:role_24
c33 How the core objects are constructed and connected during an actual run is not established by this packet; the analyzer does not resolve framework runtime wiring, dynamic dispatch, reflection, dynamic imports, monkey-patching, generated code or runtime dependency injection. unresolved supported analysis_c0e49dab7c5999ba:lim_1
c34 Installation and run/build behavior is only partially inferred, and installation commands are not verified. observed supported analysis_c0e49dab7c5999ba:lim_2
c35 README-derived statements are line-based extractions and count as author claims at best. observed supported analysis_c0e49dab7c5999ba:lim_4
c36 The manifest's capability fields describe the analyzer itself, not the repository, and are excluded from repository evidence. observed supported analysis_c0e49dab7c5999ba:lim_5
c37 The summary records that the repository includes tests, but what those tests verify at runtime is not established here. inferred supported analysis_c0e49dab7c5999ba:summary_repository, analysis_c0e49dab7c5999ba:lim_1
c38 6888 of 7633 relations are external or unresolved, so a missing link in this data is not evidence that two parts are independent. inferred supported analysis_c0e49dab7c5999ba:relation_counts
c39 README.md, pyproject.toml and LICENSE are classified as project-level important files. observed supported analysis_c0e49dab7c5999ba:important_1, analysis_c0e49dab7c5999ba:important_3, analysis_c0e49dab7c5999ba:important_4
c40 A teaching claim recommends starting from manifests and important symbols, then tracing the bounded execution paths and inspecting the unresolved boundaries before changing code. inferred supported analysis_c0e49dab7c5999ba:claim_e56db45165bf

Sources, rights and disclosure · attribution-license-templates/v0.1

Rights notice. Original repository hosted on GitHub. Repository source code, documentation, names, media, and related project materials remain subject to the rights of their respective authors, contributors, and other rights holders and to applicable repository license terms.

Platform notice. GitHub is the source hosting platform for the linked repository. GitHub and related marks are trademarks of GitHub, Inc. EVEMISS Technology is not affiliated with or endorsed by GitHub unless explicitly stated otherwise.

How this page is produced. This page was produced using revision-aware repository analysis and AI-assisted editorial tooling. Technical claims are tied to the analyzed repository revision and may be revalidated when the source repository changes.

AI-assisted analysis. Reviewed by EVEMISS Technology through human–AI collaborative review. · Report a rights concern · Back to the overview