how to execute python code in AI Agent

 

smolagents

codeAgent

E2B

docker

pyodide

deno

webasembly

sandbox

 

https://github.com/huggingface/smolagents

https://huggingface.co/docs/smolagents/index

https://huggingface.co/docs/smolagents/guided_tour

https://huggingface.co/docs/smolagents/guided_tour

 

smolagents is a library that enables you to run powerful agents in a few lines of code. It offers:

✨ Simplicity: the logic for agents fits in ~1,000 lines of code (see agents.py). We kept abstractions to their minimal shape above raw code!

🧑‍💻 First-class support for Code Agents. Our CodeAgent writes its actions in code (as opposed to "agents being used to write code"). To make it secure, we support executing in sandboxed environments via E2B, Docker, or Pyodide+Deno WebAssembly sandbox.

🤗 Hub integrations: you can share/pull tools or agents to/from the Hub for instant sharing of the most efficient agents!

🌐 Model-agnostic: smolagents supports any LLM. It can be a local transformers or ollama model, one of many providers on the Hub, or any model from OpenAI, Anthropic and many others via our LiteLLM integration.

👁️ Modality-agnostic: Agents support text, vision, video, even audio inputs! Cf this tutorial for vision.

🛠️ Tool-agnostic: you can use tools from any MCP server, from LangChain, you can even use a Hub Space as a tool.

 

Pandora Box: A Revolutionary Open-Source Python Environment

https://github.com/pydaxing/PandoraBox

 

posted @ 2025-08-05 09:05  iTech  阅读(24)  评论(1)    收藏  举报