Offline "smolagents" usage example:


from smolagents import CodeAgent,TransformersModel,DuckDuckGoSearchTool

model_path = 'usr/Qwen3-4B' #or 'C:/model/Qwen3-4B' #(Path to model files usually .safetensors)

model = TransformersModel( model_id=model_path, max_new_tokens=4096, device_map="auto" )

agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model)

agent.run("Is it good today?")

Online "smolagents" usage example:


from smolagents import CodeAgent, HfApiModel,DuckDuckGoSearchTool

model_path = 'Qwen/Qwen3-4B'#(Path to model space)

agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=HfApiModel(model_path))

agent.run("Is it good today?")