run_cell
Execute Python code in a persistent IPython kernel, sharing variables and imports across cells. Supports custom directives for wait time and full output retrieval.
Instructions
向持久 IPython kernel 提交一个原始 IPython cell。
请你使用 IPython 的思想来优雅使用本系列工具。
输入
接受一段 loommux IPython cell 源码。普通 Python 文本使用默认策略;若作者
需要声明本次 cell 的观察策略,使用位于物理行首的 # loommux: 控制
注释。Loommux 在提交前验证并完全消费有效控制注释,因此它们不会进入
IPython history 或下游 cell-magic body。变量、导入和其他 namespace 状态会
与当前持久 IPython 会话中的后续 cell 共享。
等待上限
本次调用默认最多等待 10 秒。# loommux: 的 --wait 正有限十进制
值只覆盖本次调用的等待上限::
# loommux: --wait 120
build_report()# loommux: --wait 120 与 # loommux: --full-output 可写在同一条
或不同的控制注释中。重复选项、未知选项、缺少值或非正值会返回
invalid_loommux_directive,不会分配 execution 或提交 kernel。等待
到期不会中断仍在运行的 cell;directive 不改变 Python runtime 或后续
调用的等待上限。
完整输出
若任一有效 # loommux: 控制注释包含 --full-output,该 execution
在终态时直接交付完整 combined 正文,不受默认 5,000-token 交付阈值限制::
# loommux: --full-output
print("\n".join(generate_manifest()))--wait 与 --full-output 可以组合为
# loommux: --wait 120 --full-output。这些选项只作用于本次
execution。有效控制注释在提交前被 Loommux 完全消费,不会进入 IPython
history、cell magic body 或 execution 响应。在明确需要完整阅读某些信息,
例如阅读某些文件、资料时,使用该选项避免无意义的反复阅读开销。
图像展示
IPython display() 产生的 PNG、JPEG、WEBP 或单帧 GIF 图像会按输出
顺序直接交付给agent。普通 display(image) 使用高视觉细节;本次展示
需要整体确认或密集文字时,分别书写 display(image, metadata={"detail": "low"}) 或 display(image, metadata={"detail": "original"})。detail 只作用于这一处 display() 调用。
执行编号与后续操作
每个已接受的提交都会获得一个连续递增的正整数 execution。后续工具
使用它定位当前持久 IPython 会话中的这次执行。若执行仍在运行,或未标记
--full-output 的 combined 输出超过 5,000 token,响应不携带完整输出
正文;行数、Unicode code point 字符数和 UTF-8 字节数描述同一份
normalized combined 文本。使用 wait 等待,使用 execution_status
查看状态,使用 read_output 或 search_output 读取或搜索保留的输出。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| freeform | Yes | 原始 IPython cell 源码文本。 |