UnvibeCode⭐ Star UnvibeCode

Business Workflow Map

Understand end-to-end business operations reconstructed from the code.

smolagents-main · 30 workflows · 11 areas
Workflow area 1

Agent workflows

3 workflows
01
Workflow 1

Agent run memory, replay, and message reconstruction

What this workflow does

Agent task/action/planning history is stored in AgentMemory, converted back into messages, replayed to logs, and can yield concatenated code actions.

Purpose

Persist and inspect an agent's step-by-step work product

What it produces

AgentMemory / step history

Who relies on it

Agent developer or operator

Why this workflow matters

  • Enables debugging and auditability of agent runs
  • Preserves task, planning, tool-call, and final-answer context for later inspection
  • Supports reconstruction of executable code from prior actions
Implementation references
  • AgentMemory src/smolagents/memory.py · lines 214–277
  • ActionStep src/smolagents/memory.py · lines 50–150
  • AgentMemory.return_full_code() src/smolagents/memory.py · lines 273–277
  • MemoryStep src/smolagents/memory.py · lines 41–47
  • AgentMemory.replay() src/smolagents/memory.py · lines 248–271
  • ActionStep.to_messages() src/smolagents/memory.py · lines 92–150
  • PlanningStep.to_messages() src/smolagents/memory.py · lines 174–183
  • TestAgentMemory.test_initialization() tests/test_memory.py · lines 21–25
  • TestAgentMemory.test_return_all_code_actions() tests/test_memory.py · lines 27–34
  • test_action_step_to_messages_no_tool_calls_with_observations() tests/test_memory.py · lines 159–177
  • test_action_step_to_messages() tests/test_memory.py · lines 119–156
  • PlanningStep src/smolagents/memory.py · lines 153–183
02
Workflow 2

Normalize multimodal agent inputs and outputs

What this workflow does

AgentImage and AgentAudio normalize text, image, and audio outputs into raw objects or serialized file paths, enabling display and transport across agent tools and notebooks.

Purpose

Convert agent outputs into portable artifacts and recover raw objects from serialized forms

What it produces

AgentText / AgentImage / AgentAudio

Who relies on it

Agent caller or UI consumer

Why this workflow matters

  • Allows images and audio to be passed through agent workflows
  • Creates temporary file artifacts for notebook/UI consumption
  • Handles remote audio URLs by downloading and decoding content
Implementation references
  • AgentImage._ipython_display_() src/smolagents/agent_types.py · lines 111–117
  • AgentImage.save() src/smolagents/agent_types.py · lines 164–173
  • AgentImage.to_raw() src/smolagents/agent_types.py · lines 119–134
  • AgentImage.to_string() src/smolagents/agent_types.py · lines 136–162
  • AgentImage.__init__() src/smolagents/agent_types.py · lines 79–109
  • AgentAudio._ipython_display_() src/smolagents/agent_types.py · lines 208–214
  • AgentAudio.to_string() src/smolagents/agent_types.py · lines 237–251
  • AgentAudio.to_raw() src/smolagents/agent_types.py · lines 216–235
  • AgentAudio.__init__() src/smolagents/agent_types.py · lines 181–206
  • AgentAudioTests.test_from_string() tests/test_types.py · lines 55–66
  • AgentAudioTests.test_from_tensor() tests/test_types.py · lines 35–53
  • TestAgentImage tests/test_types.py · lines 69–109
03
Workflow 3

multi-step agent orchestration

What this workflow does

Agent tests show a tool-calling or code-executing agent taking a task, invoking tools, recording memory steps, and producing a final answer or error state.

Purpose

solve a task by iterating between model reasoning and tool execution

What it produces

agent memory / task run / final answer

Who relies on it

end user issuing the task

Why this workflow matters

  • Demonstrates tool use and final-answer completion
  • Records observations, tool calls, and errors in memory
  • Supports streaming tool-call handling and validation
Implementation references
  • TestAgent tests/test_agents.py · lines 417–821
  • TestToolCallingAgent.test_toolcalling_agent_passes_both_tools_and_managed_agents() tests/test_agents.py · lines 1651–1676
  • TestToolCallingAgent.test_process_tool_calls() tests/test_agents.py · lines 2065–2089
  • TestAgent.test_code_nontrivial_final_answer_works() tests/test_agents.py · lines 615–631
  • TestAgent.test_generation_errors_are_raised() tests/test_agents.py · lines 739–748
  • TestAgent.test_fake_toolcalling_agent() tests/test_agents.py · lines 418–425
  • TestAgent.test_fake_code_agent() tests/test_agents.py · lines 466–474
  • TestAgent.test_planning_step_with_injected_memory() tests/test_agents.py · lines 750–821
  • TestMultiStepAgent.test_step_number() tests/test_agents.py · lines 1245–1260
  • TestAgent.test_fails_max_steps() tests/test_agents.py · lines 501–520
  • TestToolCallingAgent tests/test_agents.py · lines 1645–2089
  • TestToolCallingAgent.test_toolcalling_agent_api_misformatted_output() tests/test_agents.py · lines 1890–1914
Workflow area 2

Agent workflows

4 workflows
04
Workflow 4

Chat UI rendering for agent step logs

What this workflow does

Agent step logs are converted into Gradio chat messages, including formatted tool calls, execution logs, images, and footnotes.

Purpose

Present agent reasoning, tool usage, observations, and errors in a conversational interface

What it produces

ActionStep / PlanningStep visual transcript

Who relies on it

End user observing the agent run

Why this workflow matters

  • Provides a readable live transcript of agent execution
  • Surfaces tool call arguments, logs, images, and errors in the UI
  • Preserves step metadata such as duration and token counts for display
Implementation references
  • _process_action_step() src/smolagents/gradio_ui.py · lines 80–163
  • get_step_footnote_content() src/smolagents/gradio_ui.py · lines 29–36
  • _clean_model_output() src/smolagents/gradio_ui.py · lines 39–56
  • _format_code_content() src/smolagents/gradio_ui.py · lines 59–77
05
Workflow 5

Interactive UI presentation of agent progress

What this workflow does

Agent execution steps are converted into Gradio chat messages and streamed to a UI consumer as planning, action, or final-answer updates.

Purpose

Show the user what the agent is planning or answering in real time

What it produces

agent step logs and chat messages

Who relies on it

end user viewing the Gradio interface

Why this workflow matters

  • Surfaces intermediate reasoning and final answers to the user
  • Preserves stream order across planning, action, and final-answer events
  • Converts rich outputs such as images and audio into UI-friendly payloads
Implementation references
  • stream_to_gradio() src/smolagents/gradio_ui.py · lines 248–276
  • pull_messages_from_step() src/smolagents/gradio_ui.py · lines 226–245
  • _process_final_answer_step() src/smolagents/gradio_ui.py · lines 189–223
  • _process_planning_step() src/smolagents/gradio_ui.py · lines 166–186
06
Workflow 6

agentic web browsing and retrieval

What this workflow does

Agent-facing browser/search tools let an agent search the web, visit pages, and receive readable page content or search result summaries.

Purpose

find online information and read webpage content through a text browser

What it produces

web search query / visited webpage

Who relies on it

agent or user running a browser-assisted research task

Why this workflow matters

  • returns searchable text from web pages
  • surfaces prior-visit context and viewport position
  • enables agentic research workflows
Implementation references
  • SearchInformationTool.forward() examples/open_deep_research/scripts/text_web_browser.py · lines 388–391
  • SimpleTextBrowser examples/open_deep_research/scripts/text_web_browser.py · lines 22–370
  • SimpleTextBrowser._serpapi_search() examples/open_deep_research/scripts/text_web_browser.py · lines 204–261
  • SimpleTextBrowser._fetch_page() examples/open_deep_research/scripts/text_web_browser.py · lines 263–353
  • SimpleTextBrowser._find_next_viewport() examples/open_deep_research/scripts/text_web_browser.py · lines 147–175
  • SearchInformationTool examples/open_deep_research/scripts/text_web_browser.py · lines 373–391
  • VisitTool examples/open_deep_research/scripts/text_web_browser.py · lines 394–407
07
Workflow 7

external file acquisition and web archival lookup

What this workflow does

Browser download and archive tools fetch external files or archived URLs, persist downloads locally, and then route content back into the browser state for inspection.

Purpose

retrieve a remote file or closest archived copy of a URL for later inspection

What it produces

remote file / archived URL snapshot

Who relies on it

agent or user investigating external content

Why this workflow matters

  • downloads binary assets to a local path
  • returns archive snapshot text for inspection
  • supports research on unavailable or historical pages
Implementation references
  • DownloadTool.forward() examples/open_deep_research/scripts/text_web_browser.py · lines 423–442
  • ArchiveSearchTool.forward() examples/open_deep_research/scripts/text_web_browser.py · lines 461–485
  • SimpleTextBrowser._fetch_page() examples/open_deep_research/scripts/text_web_browser.py · lines 263–353
  • DownloadTool examples/open_deep_research/scripts/text_web_browser.py · lines 410–442
  • ArchiveSearchTool examples/open_deep_research/scripts/text_web_browser.py · lines 445–485
Workflow area 3

Remote workflows

4 workflows
08
Workflow 8

Remote code execution transport and answer handoff

What this workflow does

An agent executor serializes variables and final answers for transport into a remote Python environment, then deserializes results under an explicit safe-versus-pickle policy.

Purpose

Run agent code in a remote sandbox while preserving data fidelity and transport safety

What it produces

serialized variables and final answer payloads

Who relies on it

agent runtime / remote execution environment

Why this workflow matters

  • Moves agent state into the remote kernel namespace
  • Encodes final answers for return to the caller
  • Rejects unsafe pickle payloads unless explicitly enabled
Implementation references
  • RemotePythonExecutor.__init__() src/smolagents/remote_executors.py · lines 70–80
  • RemotePythonExecutor.send_variables() src/smolagents/remote_executors.py · lines 115–131
  • SafeSerializer.loads() src/smolagents/serialization.py · lines 294–346
  • RemotePythonExecutor src/smolagents/remote_executors.py · lines 53–332
  • SafeSerializer.dumps() src/smolagents/serialization.py · lines 251–292
  • SafeSerializer src/smolagents/serialization.py · lines 45–514
  • RemotePythonExecutor._deserialize_final_answer() src/smolagents/remote_executors.py · lines 306–332
  • RemotePythonExecutor._patch_final_answer_with_exception.forward() src/smolagents/remote_executors.py · lines 168–283
  • RemotePythonExecutor.send_tools() src/smolagents/remote_executors.py · lines 94–113
  • RemotePythonExecutor._patch_final_answer_with_exception() src/smolagents/remote_executors.py · lines 143–304
09
Workflow 9

remote python sandbox execution

What this workflow does

DockerExecutor initializes a Docker-backed Jupyter sandbox, connects to it over HTTP/websocket, executes remote Python code, and cleans up the container.

Purpose

start and manage a Docker-backed execution environment for agent code

What it produces

Docker container / Jupyter kernel

Who relies on it

agent runtime / local caller

Why this workflow matters

  • Provides isolated code execution for agents
  • Returns executed code results through the remote kernel
  • Releases container resources after use
Implementation references
  • DockerExecutor.__init__() src/smolagents/remote_executors.py · lines 572–677
  • DockerExecutor.run_code_raise_errors() src/smolagents/remote_executors.py · lines 679–692
  • DockerExecutor src/smolagents/remote_executors.py · lines 551–723
  • DockerExecutor.cleanup() src/smolagents/remote_executors.py · lines 694–704
  • TestDockerExecutorUnit tests/test_remote_executors.py · lines 231–261
  • TestDockerExecutorIntegration tests/test_remote_executors.py · lines 385–407
10
Workflow 10

remote python sandbox execution

What this workflow does

ModalExecutor creates a Modal sandbox, starts a Jupyter kernel gateway, executes remote Python code, and terminates the sandbox.

Purpose

provision and manage a Modal-backed execution environment

What it produces

Modal sandbox / Jupyter kernel

Who relies on it

agent runtime / local caller

Why this workflow matters

  • Provides isolated execution for agent code
  • Installs requested packages into the sandbox
  • Ensures sandbox termination on cleanup
Implementation references
  • ModalExecutor.__init__() src/smolagents/remote_executors.py · lines 748–811
  • ModalExecutor.run_code_raise_errors() src/smolagents/remote_executors.py · lines 813–826
  • ModalExecutor src/smolagents/remote_executors.py · lines 726–856
  • BlaxelExecutor.install_packages() src/smolagents/remote_executors.py · lines 982–1039
  • BlaxelExecutor.cleanup() src/smolagents/remote_executors.py · lines 1049–1065
  • TestModalExecutorUnit tests/test_remote_executors.py · lines 422–474
  • TestModalExecutorIntegration tests/test_remote_executors.py · lines 410–419
11
Workflow 11

remote python sandbox execution

What this workflow does

BlaxelExecutor provisions a Blaxel sandbox, creates a Jupyter kernel, installs packages, executes remote Python code, and deletes the sandbox on cleanup.

Purpose

provision and manage a Blaxel-backed execution environment

What it produces

Blaxel sandbox / Jupyter kernel

Who relies on it

agent runtime / local caller

Why this workflow matters

  • Provides isolated execution for agent code
  • Installs packages requested at runtime
  • Ensures sandbox teardown on cleanup
Implementation references
  • BlaxelExecutor.__init__() src/smolagents/remote_executors.py · lines 882–951
  • BlaxelExecutor.run_code_raise_errors() src/smolagents/remote_executors.py · lines 963–980
  • BlaxelExecutor src/smolagents/remote_executors.py · lines 859–1076
  • BlaxelExecutor.install_packages() src/smolagents/remote_executors.py · lines 982–1039
  • BlaxelExecutor.cleanup() src/smolagents/remote_executors.py · lines 1049–1065
  • TestBlaxelExecutorUnit tests/test_remote_executors.py · lines 477–617
Workflow area 4

Web workflows

4 workflows
12
Workflow 12

browser-assisted web navigation for an agent

What this workflow does

A browser helper captures screenshots, appends current URL context, and exposes a safe search tool that focuses a matching page element.

Purpose

Find page text safely and keep browser observations current for the agent

What it produces

current browser page / page search result

Who relies on it

CodeAgent using Selenium/Helium

Why this workflow matters

  • Supports web research and task completion
  • Improves observation quality with screenshots and URL context
  • Reduces XPath query injection risk via escaping
Implementation references
  • initialize_agent() src/smolagents/vision_web_browser.py · lines 148–157
  • run_webagent() src/smolagents/vision_web_browser.py · lines 217–237
  • save_screenshot() src/smolagents/vision_web_browser.py · lines 66–84
  • search_item_ctrl_f() src/smolagents/vision_web_browser.py · lines 105–121
  • _escape_xpath_string() src/smolagents/vision_web_browser.py · lines 87–102
  • TestXPathEscaping.test_escape_prevents_injection() tests/test_vision_web_browser.py · lines 67–75
  • TestXPathEscaping.test_escape_xpath_string_basic() tests/test_vision_web_browser.py · lines 39–42
  • TestXPathEscaping.test_escape_xpath_string_mixed_quotes() tests/test_vision_web_browser.py · lines 52–56
  • TestSearchItemCtrlF.test_search_item_not_found() tests/test_vision_web_browser.py · lines 126–132
  • TestSearchItemCtrlF.test_search_item_nth_result() tests/test_vision_web_browser.py · lines 115–124
  • TestSearchItemCtrlF.test_search_item_prevents_injection() tests/test_vision_web_browser.py · lines 91–113
13
Workflow 13

Web search and article retrieval

What this workflow does

A user query is sent to external search or article sources and returned as formatted text results for agent consumption.

Purpose

Find and return source text or search results for a user query

What it produces

search query / Wikipedia topic

Who relies on it

agent or end user consuming retrieved content

Why this workflow matters

  • Provides external knowledge to the agent
  • Formats results for downstream prompting or display
  • Can fail gracefully when no result exists or the article is unavailable
Implementation references
  • DuckDuckGoSearchTool.forward() src/smolagents/default_tools.py · lines 140–146
  • WikipediaSearchTool src/smolagents/default_tools.py · lines 547–643
  • DuckDuckGoSearchTool src/smolagents/default_tools.py · lines 104–159
  • WikipediaSearchTool.forward() src/smolagents/default_tools.py · lines 623–643
  • DuckDuckGoSearchTool._enforce_rate_limit() src/smolagents/default_tools.py · lines 148–159
  • WikipediaSearchTool.__init__() src/smolagents/default_tools.py · lines 587–621
  • DuckDuckGoSearchTool.__init__() src/smolagents/default_tools.py · lines 126–138
14
Workflow 14

web research question answering

What this workflow does

CLI user supplies a question; the open_deep_research script builds a browsing/search agent stack and runs it to produce an answer.

Purpose

ask a natural-language question and get a researched answer

What it produces

question/answer task and supporting browser context

Who relies on it

CLI user

Why this workflow matters

  • Produces a synthesized answer from web browsing and file inspection
  • Uses external search and model inference services to complete the task
Implementation references
  • main() examples/open_deep_research/run.py · lines 114–121
  • create_agent() examples/open_deep_research/run.py · lines 60–111
  • parse_args() examples/open_deep_research/run.py · lines 34–40
15
Workflow 15

web chat agent response

What this workflow does

Anonymous web client submits a chat message to /chat, the server runs the code agent on the message, and returns a JSON reply.

Purpose

ask the agent a question and receive a response

What it produces

chat message / reply

Who relies on it

web visitor using the demo UI

Why this workflow matters

  • interactive conversational assistance
  • immediate JSON response for the frontend
Implementation references
  • chat() examples/server/main.py · lines 197–204
Workflow area 5

Llm workflows

3 workflows
16
Workflow 16

LLM task orchestration with tool use

What this workflow does

A MultiStepAgent receives a task, cycles through planning and action steps with tools and memory, and returns a final answer or max-steps result.

Purpose

Solve a user-provided task step by step and produce a final answer

What it produces

Agent run / task execution session

Who relies on it

Caller invoking the agent

Why this workflow matters

  • Produces a task completion result
  • Tracks execution steps, token usage, and timing
  • Supports managed-agent delegation and step callbacks
Implementation references
  • MultiStepAgent src/smolagents/agents.py · lines 268–1212
  • MultiStepAgent.__init__() src/smolagents/agents.py · lines 294–352
  • MultiStepAgent.run() src/smolagents/agents.py · lines 436–538
  • RunResult src/smolagents/agents.py · lines 195–253
  • MultiStepAgent._run_stream() src/smolagents/agents.py · lines 540–611
  • get_json_schema() src/smolagents/_function_type_hints_utils.py · lines 97–231
  • MultiStepAgent.from_hub() src/smolagents/agents.py · lines 1064–1116
  • go_back() src/smolagents/vision_web_browser.py · lines 124–127
  • close_popups() src/smolagents/vision_web_browser.py · lines 130–135
  • initialize_driver() src/smolagents/vision_web_browser.py · lines 138–145
  • initialize_agent() src/smolagents/vision_web_browser.py · lines 148–157
  • _escape_xpath_string() src/smolagents/vision_web_browser.py · lines 87–102
  • search_item_ctrl_f() src/smolagents/vision_web_browser.py · lines 105–121
  • save_screenshot() src/smolagents/vision_web_browser.py · lines 66–84
17
Workflow 17

LLM tool-call execution

What this workflow does

A ToolCallingAgent receives an LLM-produced tool call, validates it, executes the tool or managed agent, and records the resulting observation or final answer.

Purpose

invoke a tool or managed agent on behalf of the model

What it produces

tool call and tool output

Who relies on it

agent runtime and downstream tool target

Why this workflow matters

  • Turns model decisions into concrete tool actions
  • Captures observations and final answers for subsequent steps
Implementation references
  • ToolCallingAgent._step_stream() src/smolagents/agents.py · lines 1276–1359
  • ToolCallingAgent src/smolagents/agents.py · lines 1215–1502
  • ToolCallingAgent.execute_tool_call() src/smolagents/agents.py · lines 1453–1502
  • ToolCallingAgent.__init__() src/smolagents/agents.py · lines 1231–1258
  • ToolCallingAgent._substitute_state_variables() src/smolagents/agents.py · lines 1444–1451
  • ToolCallingAgent.process_tool_calls() src/smolagents/agents.py · lines 1361–1442
18
Workflow 18

code-based agent execution

What this workflow does

A CodeAgent generates code from the model, parses it, executes it through a Python executor, and returns the resulting output or final answer.

Purpose

let the model solve a task by emitting executable code

What it produces

generated code and execution output

Who relies on it

agent runtime and code executor

Why this workflow matters

  • Runs model-written code to complete tasks
  • Supports local or remote execution backends
  • Produces truncated logs/output for the user-facing run
Implementation references
  • CodeAgent._step_stream() src/smolagents/agents.py · lines 1638–1764
  • CodeAgent.create_python_executor() src/smolagents/agents.py · lines 1598–1618
  • CodeAgent src/smolagents/agents.py · lines 1505–1803
Workflow area 6

Python workflows

3 workflows
19
Workflow 19

Safe local Python execution

What this workflow does

Agent-generated Python code is parsed and evaluated locally with controlled imports, bounded operations, and explicit error handling.

Purpose

Run model-generated or user-supplied Python logic while constraining imports and runaway execution

What it produces

Python AST / execution state

Who relies on it

Agent runtime and caller waiting for computed output

Why this workflow matters

  • Allows the system to compute results from generated code
  • Prevents unrestricted imports and excessive operation counts
  • Surfaces interpreter errors and timeouts instead of hanging
Implementation references
  • evaluate_ast() src/smolagents/local_python_executor.py · lines 1416–1569
  • evaluate_import() src/smolagents/local_python_executor.py · lines 1309–1342
  • evaluate_generatorexp() src/smolagents/local_python_executor.py · lines 1345–1377
20
Workflow 20

constrained code execution for agent reasoning / sandboxed Python code execution

What this workflow does

Restricted local Python execution evaluates agent-generated code, enforces authorized imports and timeouts, and returns stdout plus a structured result. / A caller submits Python code to the local executor, which evaluates it against a controlled tool/state environment and returns the computed result while mutating execution state.

Purpose

run Python snippets to compute results or manipulate intermediate state / execute agent-authored Python snippets safely

What it produces

Python code action / execution state and tool namespace

Who relies on it

agent executing calculations / agent or caller supplying code

Why this workflow matters

  • produces stdout and output for agent reasoning
  • rejects unsupported imports and unsafe constructs
  • limits execution duration
  • returns computed values from code
  • persists variables and print output into execution state
Implementation references
  • LocalPythonExecutor src/smolagents/local_python_executor.py · lines 1688–1765
  • evaluate_python_code() src/smolagents/local_python_executor.py · lines 1583–1667
  • PrintContainer src/smolagents/local_python_executor.py · lines 240–263
  • evaluate_python_code._execute_code() src/smolagents/local_python_executor.py · lines 1639–1661
  • LocalPythonExecutor._check_authorized_imports_are_installed() src/smolagents/local_python_executor.py · lines 1727–1745
  • timeout() src/smolagents/local_python_executor.py · lines 285–320
  • PythonInterpreterTool.forward() src/smolagents/default_tools.py · lines 69–80
  • PythonInterpreterTool src/smolagents/default_tools.py · lines 39–80
  • TestEvaluatePythonCode tests/test_local_python_executor.py · lines 52–1803
  • TestPrintContainer tests/test_local_python_executor.py · lines 2108–2136
  • TestEvaluatePythonCode.test_print_output() tests/test_local_python_executor.py · lines 806–831
  • TestEvaluatePythonCode.test_assignment_cannot_overwrite_tool() tests/test_local_python_executor.py · lines 77–81
  • TestEvaluatePythonCode.test_max_operations() tests/test_local_python_executor.py · lines 392–408
  • TestLocalPythonExecutorSecurity tests/test_local_python_executor.py · lines 2440–2989
  • TestEvaluatePythonCode.test_evaluate_assign() tests/test_local_python_executor.py · lines 58–75
21
Workflow 21

sandboxed Python evaluation

What this workflow does

The local Python executor evaluates AST/code with explicit safety gates, restricted imports/calls, bounded loops, and controlled state mutation.

Purpose

execute generated Python safely while preserving interpreter state control

What it produces

evaluation state and result

Who relies on it

agent runtime / tool caller

Why this workflow matters

  • reduces unsafe access to dunder attributes and unauthorized builtins
  • controls loop execution and assignment side effects
  • produces evaluated results for tool execution
Implementation references
  • check_safer_result() src/smolagents/local_python_executor.py · lines 156–182
  • evaluate_call() src/smolagents/local_python_executor.py · lines 825–918
  • set_value() src/smolagents/local_python_executor.py · lines 794–822
  • create_function.new_func() src/smolagents/local_python_executor.py · lines 471–519
  • evaluate_while() src/smolagents/local_python_executor.py · lines 440–459
  • nodunder_getattr() src/smolagents/local_python_executor.py · lines 68–71
  • evaluate_attribute() src/smolagents/local_python_executor.py · lines 383–393
  • safer_eval._check_return() src/smolagents/local_python_executor.py · lines 196–206
Workflow area 7

Tool workflows

2 workflows
22
Workflow 22

tool schema extraction

What this workflow does

Utility functions inspect Python callables, parse Google-style docstrings and type hints, and emit JSON schemas for tool descriptions.

Purpose

Turn Python functions into machine-readable tool schemas

What it produces

function schema / tool schema

Who relies on it

LLM prompt template or tool caller

Why this workflow matters

  • Enables tool descriptions for chat templates
  • Validates docstring and type-hint completeness
  • Normalizes complex Python types into JSON-schema structures
Implementation references
  • get_json_schema() src/smolagents/_function_type_hints_utils.py · lines 97–231
  • TestGetJsonSchema tests/test_function_type_hints_utils.py · lines 240–452
  • _parse_type_hint() src/smolagents/_function_type_hints_utils.py · lines 326–384
  • _convert_type_hints_to_json_schema() src/smolagents/_function_type_hints_utils.py · lines 291–323
  • _parse_google_format_docstring() src/smolagents/_function_type_hints_utils.py · lines 256–288
23
Workflow 23

Tool packaging and distribution

What this workflow does

A developer-defined Tool is validated, serialized, saved or published, and can later be reloaded from code, Hub, or MCP into an executable tool object.

Purpose

Prepare a tool for reuse, distribution, or deployment in another runtime

What it produces

Tool / ToolCollection

Who relies on it

Downstream agent or user who loads the tool

Why this workflow matters

  • Makes tool logic portable across local code, Hub, and MCP sources
  • Creates executable UI and requirements artifacts for sharing
  • Can initialize remote-backed tool wrappers for agent use
Implementation references
  • Tool src/smolagents/tools.py · lines 106–791
  • ToolCollection src/smolagents/tools.py · lines 895–1058
  • Tool.to_dict() src/smolagents/tools.py · lines 292–365
  • load_tool() src/smolagents/tools.py · lines 840–879
  • Tool.from_hub() src/smolagents/tools.py · lines 516–569
  • ToolCollection.from_mcp() src/smolagents/tools.py · lines 949–1058
  • Tool.validate_arguments() src/smolagents/tools.py · lines 144–226
  • Tool.to_code_prompt() src/smolagents/tools.py · lines 258–287
  • evaluate_ast() src/smolagents/local_python_executor.py · lines 1416–1569
Workflow area 8

Model workflows

2 workflows
24
Workflow 24

model generation with telemetry instrumentation

What this workflow does

A caller invokes InferenceClientModel.generate, and instrumentation records a successful OpenTelemetry span around the model call.

Purpose

produce a language-model response while emitting trace data

What it produces

generated model response and trace span

Who relies on it

caller of the model API

Why this workflow matters

  • returns a model-generated answer
  • records observability data for the call
  • supports integration monitoring and tracing
Implementation references
  • TestOpenTelemetry.test_model() tests/test_telemetry.py · lines 68–88
  • instrument() tests/test_telemetry.py · lines 55–63
  • InferenceClientModel src/smolagents/models.py · lines 1456–1643
25
Workflow 25

model inference backend selection and prompt-to-response generation

What this workflow does

A backend model adapter loads a local or hosted LLM, prepares chat-formatted prompts, and returns assistant text or tool-call capable responses for agent use.

Purpose

obtain model-generated assistant output from a chosen inference backend

What it produces

ChatMessage / generated assistant response

Who relies on it

agent runtime consuming the model output

Why this workflow matters

  • Enables local inference and serving
  • Produces assistant text for downstream agent steps
  • Preserves token accounting and stop-sequence behavior
Implementation references
  • VLLMModel src/smolagents/models.py · lines 633–748
  • MLXModel src/smolagents/models.py · lines 751–857
  • TransformersModel src/smolagents/models.py · lines 860–1135
  • VLLMModel.generate() src/smolagents/models.py · lines 687–748
  • MLXModel.generate() src/smolagents/models.py · lines 816–857
  • TransformersModel.generate() src/smolagents/models.py · lines 1052–1091
  • VLLMModel.__init__() src/smolagents/models.py · lines 648–668
  • MLXModel.__init__() src/smolagents/models.py · lines 791–814
  • TransformersModel.__init__() src/smolagents/models.py · lines 906–978
  • VLLMModel.cleanup() src/smolagents/models.py · lines 670–685
Workflow area 9

Remote workflows

1 workflow
26
Workflow 26

remote LLM API integration

What this workflow does

An API-backed model adapter builds a completion request, rate-limits it, retries on rate-limit errors, and returns the provider response as a ChatMessage.

Purpose

call a hosted model endpoint safely and recover from transient rate limits

What it produces

completion request and response

Who relies on it

external model provider

Why this workflow matters

  • Supports OpenAI-compatible, Azure OpenAI, and Bedrock deployments
  • Applies retry and throttle controls for API stability
  • Normalizes response content and token usage for the agent runtime
Implementation references
  • ApiModel src/smolagents/models.py · lines 1138–1191
  • OpenAIModel src/smolagents/models.py · lines 1646–1793
  • AmazonBedrockModel src/smolagents/models.py · lines 1859–2060
  • AzureOpenAIModel src/smolagents/models.py · lines 1799–1853
  • OpenAIModel.generate_stream() src/smolagents/models.py · lines 1707–1759
  • AmazonBedrockModel.generate() src/smolagents/models.py · lines 2020–2060
  • OpenAIModel.generate() src/smolagents/models.py · lines 1761–1793
  • ApiModel.__init__() src/smolagents/models.py · lines 1161–1183
  • is_rate_limit_error() src/smolagents/models.py · lines 1194–1202
  • AmazonBedrockModel._prepare_completion_kwargs() src/smolagents/models.py · lines 1968–2008
  • OpenAIModel.create_client() src/smolagents/models.py · lines 1697–1705
  • AzureOpenAIModel.create_client() src/smolagents/models.py · lines 1845–1853
  • AmazonBedrockModel.create_client() src/smolagents/models.py · lines 2010–2018
Workflow area 10

File workflows

3 workflows
27
Workflow 27

inspect_file_as_text / document-to-text conversion

What this workflow does

File-inspection tools convert local text-like and web document inputs into markdown/text results for downstream research use.

Purpose

Read a local file as markdown/text so a research agent can ask questions about it

What it produces

local file content and converted text output

Who relies on it

first-party research agent using the text-inspection utility

Why this workflow matters

  • Makes non-text documents queryable in a text-centric workflow
  • Normalizes heterogeneous document formats into a common representation
  • Reduces the need for format-specific downstream handling
Implementation references
  • PlainTextConverter.convert() examples/open_deep_research/scripts/mdconvert.py · lines 130–146
  • HtmlConverter.convert() examples/open_deep_research/scripts/mdconvert.py · lines 152–162
  • WikipediaConverter.convert() examples/open_deep_research/scripts/mdconvert.py · lines 192–231
  • YouTubeConverter.convert() examples/open_deep_research/scripts/mdconvert.py · lines 237–329
  • HtmlConverter._convert() examples/open_deep_research/scripts/mdconvert.py · lines 164–186
  • DocumentConverterResult examples/open_deep_research/scripts/mdconvert.py · lines 112–117
  • HtmlConverter examples/open_deep_research/scripts/mdconvert.py · lines 149–186
  • PlainTextConverter examples/open_deep_research/scripts/mdconvert.py · lines 127–146
  • WikipediaConverter examples/open_deep_research/scripts/mdconvert.py · lines 189–231
  • YouTubeConverter examples/open_deep_research/scripts/mdconvert.py · lines 234–351
28
Workflow 28

media-to-text enrichment

What this workflow does

Audio and image converters enrich media inputs with metadata, transcription, OCR/LLM-style description, and return text outputs.

Purpose

Turn audio or image files into readable research notes

What it produces

media file metadata, transcript, and description text

Who relies on it

first-party research agent using the converted media text

Why this workflow matters

  • Makes non-text media searchable and inspectable
  • Captures metadata alongside human-readable text
  • Can add transcription or image description when optional dependencies are present
Implementation references
  • ImageConverter examples/open_deep_research/scripts/mdconvert.py · lines 679–757
  • WavConverter.convert() examples/open_deep_research/scripts/mdconvert.py · lines 523–559
  • ImageConverter.convert() examples/open_deep_research/scripts/mdconvert.py · lines 684–725
  • Mp3Converter.convert() examples/open_deep_research/scripts/mdconvert.py · lines 573–628
  • WavConverter._transcribe_audio() examples/open_deep_research/scripts/mdconvert.py · lines 561–565
  • ImageConverter._get_mlm_description() examples/open_deep_research/scripts/mdconvert.py · lines 727–757
  • DocumentConverterResult examples/open_deep_research/scripts/mdconvert.py · lines 112–117
  • WavConverter examples/open_deep_research/scripts/mdconvert.py · lines 518–565
  • Mp3Converter examples/open_deep_research/scripts/mdconvert.py · lines 568–628
29
Workflow 29

archive extraction and file listing

What this workflow does

ZIP archives are extracted to a local directory and a deterministic file listing is returned for the agent.

Purpose

Unpack a ZIP file into a local working directory and know what was extracted

What it produces

ZIP archive and extracted file set

Who relies on it

first-party research agent using downloaded artifacts

Why this workflow matters

  • Makes packaged downloads usable as individual files
  • Creates a stable extracted file listing for downstream processing
  • Persists extracted content under a configured directory
Implementation references
  • ZipConverter examples/open_deep_research/scripts/mdconvert.py · lines 631–676
  • ZipConverter.convert() examples/open_deep_research/scripts/mdconvert.py · lines 647–676
  • ZipConverter.__init__() examples/open_deep_research/scripts/mdconvert.py · lines 636–645
Workflow area 11

tool-session setup and teardown

1 workflow
30
Workflow 30

tool-session setup and teardown

What this workflow does

The MCP client establishes a tool session with a remote MCP server, exposes the tools to SmolAgents, and disconnects on cleanup.

Purpose

obtain usable tools from an MCP server for agent execution

What it produces

MCP tool list

Who relies on it

agent runtime and the remote MCP server

Why this workflow matters

  • remote tools become callable by the agent
  • session resources are cleaned up when disconnected
Implementation references
  • MCPClient src/smolagents/mcp_client.py · lines 33–171
  • MCPClient.get_tools() src/smolagents/mcp_client.py · lines 137–154
  • test_mcp_client_without_structured_output() tests/test_mcp_client.py · lines 87–100
  • test_mcp_client_with_structured_output() tests/test_mcp_client.py · lines 64–84
  • MCPClient.__init__() src/smolagents/mcp_client.py · lines 85–122
  • test_mcp_client_with_syntax() tests/test_mcp_client.py · lines 54–61

Continue your review

Structured graph of your codebase linking different files and symbols.