项目介绍
Agent 开发框架 · 2026-11-09 更新 · 本站尚未实测
Fragments 是 E2B 提供的开源 Web 应用模板,README 将其定位为类似 Anthropic Claude Artifacts、Vercel v0 或 GPT Engineer 的开源版本。它本身是一个可自行部署的 Next.js 项目,核心做法是让大模型生成代码,再借助 E2B SDK 在其沙箱中执行(隔离效果未由本站实测),从而把生成结果直接跑起来并展示给用户。
需要明确:Fragments 不是可以一键下载运行的 Agent 成品,也不是 MCP 服务器或 Skill,而是一套供开发者二次搭建“AI 生成应用”产品的代码模板。官方同时提供在线体验站点 fragments.e2b.dev。
核心能力
点击能力名称查看输入、输出和原文依据。
- 技术栈基于 Next.js 14(App Router、Server Actions)、shadcn/ui、TailwindCSS 与 Vercel AI SDK。
- 通过 E2B SDK 在沙箱中执行 AI 生成的代码,README 表述为“securely execute code generated by AI”。
- 支持流式输出界面(Streaming in the UI)。
- 可按需安装并使用 npm、pip 中的任意包(README 原意如此)。
- 内置多种运行栈:Python 解释器、Next.js、Vue.js、Streamlit、Gradio,并说明可自行扩展。
- 支持多种 LLM 提供方:OpenAI、Anthropic、Google AI、Mistral、Groq、Fireworks、Together AI、Ollama,均可自行增加新模型与新提供方。
- 可选集成 Morph Apply 模型,用于更省 token、更快的代码编辑。
实际应用场景
适用场景
- 希望自建类似 Artifacts / v0 的“对话生成小应用并即时预览”平台的团队。
- 需要在受控沙箱中运行模型产出代码、避免直接在本机执行的研究或演示场景。
- 想研究多模型提供方接入、流式 UI 与代码沙箱结合的开发者。
安装与接入
README 给出的前置条件是 git、较新的 Node.js 与 npm、E2B API Key 以及所选 LLM 提供方的 API Key。基本步骤为:克隆仓库、进入目录执行 npm i 安装依赖、创建 .env.local 填写 E2B_API_KEY 与对应模型提供方的 Key,然后 npm run dev 启动开发服务器、npm run build 构建。Ollama 通过 OLLAMA_BASE_URL 接入本地服务;MORPH_API_KEY、NEXT_PUBLIC_SITE_URL、限流参数及 Vercel/Upstash KV、Supabase、PostHog 等为可选环境变量。
自定义运行栈需安装并登录 E2B CLI,在 sandbox-templates/ 下用 e2b template init 初始化模板,修改 e2b.Dockerfile 与 e2b.toml,再执行构建并在 lib/templates.json 登记。新增模型与提供方则修改 lib/models.ts。具体命令请以仓库 README 原文为准,本文不额外拼接。
使用条件与限制
- 是否需要部署
- 需自行准备运行环境,具体要求见正文
- 是否需要注册
- 账号和认证要求见正文;未明确说明的项目仍待核验
- 是否需要 API Key
- 待核验
- 费用与额度
- 费用边界见正文,项目许可不代表模型或托管服务免费
- 所需权限
- 待核验
- 许可证与服务条款
- 待核验
权限费用与限制
- 必须自行申请 E2B API Key 和至少一个 LLM 提供方的 API Key,两者均由第三方服务提供。
- README 未说明 E2B 沙箱、各模型提供方或 Morph 的收费方式与价格,费用需向对应官方核验。
- 代码执行发生在 E2B 沙箱中,数据会发送至所选模型提供方,隐私与合规边界需自行评估。
- 未提供 MCP 配置、服务端配置或发布版本资料,相关细节待核验。
- 未说明对 Windows 等具体桌面系统的支持情况,也未说明国内网络与国内模型适配情况,均待核验。
国内使用情况
网友核验 用户经验分享
与站长实测独立,不代表官方认证或本站已实测。
最近核验:暂无有效核验。参与人数按当前项目有效身份去重;不同核验项分别统计,不合并成用户总结果。仅统计审核通过且未过期的记录。
分项统计、有效期与样本量
| 核验项目 | 有效人数 | 成功 / 部分 / 失败 / 无法判断 | 成功率 | 最近核验 / 有效期 |
|---|---|---|---|---|
| 官方网站访问 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 7 天 |
| GitHub 仓库访问 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 7 天 |
| 安装与运行 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 官方服务国内连接 / MCP 连接 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 国内网络情况 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 7 天 |
| 国内模型兼容性 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 自定义 API | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 海外服务依赖 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 海外账号要求 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 中文界面 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 客户端兼容性 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 账号及费用信息 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
成功率 = 成功 ÷(成功 + 部分成功 + 失败);无法判断不计入分母。至少 5 份可判断结果才显示成功率。账号、费用、海外依赖与语言等事实项,成功表示核查结论与资料吻合,具体观察另行统计;不表示免费或没有海外依赖。不同网络、客户端和版本的结果不能直接等同。
最近有效核验
暂无审核通过且未过期的网友核验。欢迎提交真实使用记录。
查看全部有效核验 →国内实测状态:国内可用性待核验。协议兼容和官方资料说明不等于国内网络可用。
- 官方网站访问
- 尚未实测 待核验
- GitHub 仓库访问
- 尚未实测 待核验
- 官方服务国内连接
- 尚未实测 待核验
- 国内网络情况
- 尚未实测 待核验
- 国内模型兼容性
- 尚未实测 待核验
- 自定义 API
- 尚未实测 待核验
- 海外服务依赖
- 尚未实测 待核验
- 海外账号要求
- 尚未实测 待核验
- 中文界面
- 尚未实测 待核验
- 国内最后核验时间
- 尚未实测
许可与国内使用
仓库 LICENSE 为 Apache License 2.0,Copyright 2023 FoundryLabs, Inc.;该许可适用于仓库代码,不自动覆盖 E2B 托管服务、第三方模型或其他商业模块。开源仓库不代表相关云服务免费。国内使用涉及 E2B 沙箱服务与境外模型 API 的可达性、数据出境与合规问题,README 未作说明,需自行核验后判断。
项目资料与来源
字段依据与待核验事项
access:来源确认 · git clone https://github.com/e2b-dev/fragments.git
project_type:来源确认 · Fragments by E2B
原始 README(折叠技术参考)


# Fragments by E2B
This is an open-source version of apps like [Anthropic's Claude Artifacts](https://www.anthropic.com/news/claude-3-5-sonnet), Vercel [v0](https://v0.dev), or [GPT Engineer](https://gptengineer.app).
Powered by the [E2B SDK](https://github.com/e2b-dev/code-interpreter).
[→ Try on fragments.e2b.dev](https://fragments.e2b.dev)
## Features
- Based on Next.js 14 (App Router, Server Actions), shadcn/ui, TailwindCSS, Vercel AI SDK.
- Uses the [E2B SDK](https://github.com/e2b-dev/code-interpreter) by [E2B](https://e2b.dev/?utm_source=github&utm_medium=referral&utm_campaign=readme&utm_content=fragments) to securely execute code generated by AI.
- Streaming in the UI.
- Can install and use any package from npm, pip.
- Supported stacks ([add your own](#adding-custom-personas)):
- 🔸 Python interpreter
- 🔸 Next.js
- 🔸 Vue.js
- 🔸 Streamlit
- 🔸 Gradio
- Supported LLM Providers ([add your own](#adding-custom-llm-models)):
- 🔸 OpenAI
- 🔸 Anthropic
- 🔸 Google AI
- 🔸 Mistral
- 🔸 Groq
- 🔸 Fireworks
- 🔸 Together AI
- 🔸 Ollama
- Integrates with [Morph](https://morphllm.com/) Apply model for token efficient, accurate and faster code editing.
**Make sure to give us a star!**
<img width="165" alt="Screenshot 2024-04-20 at 22 13 32" src="https://github.com/mishushakov/llm-scraper/assets/10400064/11e2a79f-a835-48c4-9f85-5c104ca7bb49">
## Get started
### Prerequisites
- [git](https://git-scm.com)
- Recent version of [Node.js](https://nodejs.org) and npm package manager
- [E2B API Key](https://e2b.dev/?utm_source=github&utm_medium=referral&utm_campaign=readme&utm_content=fragments)
- LLM Provider API Key
### 1. Clone the repository
In your terminal:
```
git clone https://github.com/e2b-dev/fragments.git
```
### 2. Install the dependencies
Enter the repository:
```
cd fragments
```
Run the following to install the required dependencies:
```
npm i
```
### 3. Set the environment variables
Create a `.env.local` file and set the following:
```sh
# Get your API key here - https://e2b.dev/?utm_source=github&utm_medium=referral&utm_campaign=readme&utm_content=fragments
E2B_API_KEY="your-e2b-api-key"
# OpenAI API Key
OPENAI_API_KEY=
# Other providers
ANTHROPIC_API_KEY=
GROQ_API_KEY=
FIREWORKS_API_KEY=
TOGETHER_API_KEY=
GOOGLE_AI_API_KEY=
GOOGLE_VERTEX_CREDENTIALS=
MISTRAL_API_KEY=
XAI_API_KEY=
# Ollama server address, enables Ollama models (e.g. http://localhost:11434/api)
OLLAMA_BASE_URL=
### Optional env vars
# (on by default) Get your MORPH key here - https://morphllm.com/dashboard/api-keys
MORPH_API_KEY=
# Domain of the site
NEXT_PUBLIC_SITE_URL=
# Rate limit
RATE_LIMIT_MAX_REQUESTS=
RATE_LIMIT_WINDOW=
# Vercel/Upstash KV (short URLs, rate limiting)
KV_REST_API_URL=
KV_REST_API_TOKEN=
# Supabase (auth)
SUPABASE_URL=
SUPABASE_ANON_KEY=
# PostHog (analytics)
NEXT_PUBLIC_POSTHOG_KEY=
NEXT_PUBLIC_POSTHOG_HOST=
### Disabling functionality (when uncommented)
# Disable API key input in the chat
# NEXT_PUBLIC_NO_API_KEY_INPUT=
# Hide local models from the list of available models
# NEXT_PUBLIC_HIDE_LOCAL_MODELS=
```
### 4. Start the development server
```
npm run dev
```
### 5. Build the web app
```
npm run build
```
## Customize
### Adding custom personas
1. Make sure [E2B CLI](https://e2b.dev/docs/cli?utm_source=github&utm_medium=referral&utm_campaign=readme&utm_content=fragments) is installed and you're logged in.
2. Add a new folder under [sandbox-templates/](sandbox-templates/)
3. Initialize a new template using E2B CLI:
```
e2b template init
```
This will create a new file called `e2b.Dockerfile`.
4. Adjust the `e2b.Dockerfile`
Here's an example streamlit template:
```Dockerfile
# You can use most Debian-based base images
FROM python:3.19-slim
RUN pip3 install --no-cache-dir streamlit pandas numpy matplotlib requests seaborn plotly
# Copy the code to the container
WORKDIR /home/user
COPY . /home/user
```
5. Specify a custom start command in `e2b.toml`:
```toml
start_cmd = "cd /home/user && streamlit run app.py"
```
6. Deploy the template with the E2B CLI
```
e2b template build --name <template-name>
```
After the build has finished, you should get the following message:
```
✅ Building sandbox template <template-id> <template-name> finished.
```
7. Open [lib/templates.json](lib/templates.json) in your code editor.
Add your new template to the list. Here's an example for Streamlit:
```json
"streamlit-developer": {
"name": "Streamlit developer",
"lib": [
"streamlit",
"pandas",
"numpy",
"matplotlib",
"requests",
"seaborn",
"plotly"
],
"file": "app.py",
"instructions": "A streamlit app that reloads automatically.",
"port": 8501 // can be null
},
```
Provide a template id (as key), name, list of dependencies, entrypoint and a port (optional). You can also add additional instructions that will be given to the LLM.
4. Optionally, add a new logo under [public/thirdparty/templates](public/thirdparty/templates)
### Adding custom LLM models
1. Open [lib/models.json](lib/models.ts) in your code editor.
2. Add a new entry to the models list:
```json
{
"id": "mistral-large",
"name": "Mistral Large",
"provider": "Ollama",
"providerId": "ollama"
}
```
Where id is the model id, name is the model name (visible in the UI), provider is the provider name and providerId is the provider tag (see [adding providers](#adding-custom-llm-providers) below).
### Adding custom LLM providers
1. Open [lib/models.ts](lib/models.ts) in your code editor.
2. Add a new entry to the `providerConfigs` list:
Example for fireworks:
```ts
fireworks: () => createOpenAI({ apiKey: apiKey || process.env.FIREWORKS_API_KEY, baseURL: 'https://api.fireworks.ai/inference/v1' })(modelNameString),
```
3. Optionally, adjust the default structured output mode in the `getDefaultMode` function:
```ts
if (providerId === 'fireworks') {
return 'json'
}
```
4. Optionally, add a new logo under [public/thirdparty/logos](public/thirdparty/logos)
## Contributing
As an open-source project, we welcome contributions from the community. If you are experiencing any bugs or want to add some improvements, please feel free to open an issue or pull request.
历史前置条件说明(补充参考)
git;较新版本 Node.js 与 npm;E2B API Key;至少一个 LLM 提供方 API Key(OpenAI、Anthropic、Google AI、Mistral、Groq、Fireworks、Together AI、Ollama 等);可选 MORPH_API_KEY、Vercel/Upstash KV、Supabase、PostHog 配置;自定义运行栈需 E2B CLI 并登录;各服务费用与国内可用性待核验
项目来源与清单版权许可
https://github.com/e2b-dev/fragments
https://www.reddit.com/r/ClaudeAI/comments/1dmy6y2/open_source_version_of_anthropics_artifacts_ui/
https://github.com/e2b-dev/fragments
整理来源:https://github.com/slavakurilyak/awesome-ai-agents
清单版权与许可:
MIT License
Copyright (c) 2024 Slava Kurilyak
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.