create-railcode-agent
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate Railcode Agent
创建Railcode Agent
Update First
先更新
Before answering a Railcode agent or CLI question or running a command, update
the installed Railcode skills and CLI, then confirm npm's published version:
railcodebash
npx skills add Railcode-HQ/railcode-skills
npm install -g railcode@latest
railcode --version
npm view railcode versionIf the skill changes, re-read this file from the top. If npm is unreachable, state that the
latest version could not be verified and do not claim this guidance is current. This version
was checked against published Railcode CLI 0.1.28. Agent input is free-form; the
prompt defines its contract. The backend validates manifest tools and limits, so save-time
validation is authoritative over this snapshot.
systemSince 0.1.28 the CLI self-updates within its major version — but only on an interactive
terminal, and agent-driven sessions are non-interactive, so keep running the explicit
above rather than assuming you're on the latest.
npm install -g railcode@latest在解答Railcode Agent或CLI相关问题,或执行命令前,请先更新已安装的Railcode技能和CLI,然后确认npm上的发布版本:
railcodebash
npx skills add Railcode-HQ/railcode-skills
npm install -g railcode@latest
railcode --version
npm view railcode version如果技能有更新,请从头重新阅读本文档。如果无法访问npm,请说明无法验证最新版本,且不要声称本指南为当前最新内容。本版本已与发布的Railcode CLI 0.1.28进行核对。Agent输入为自由格式;提示词定义了其约定。后端会验证清单工具和限制,因此保存时的验证结果比本文档快照更具权威性。
system从0.1.28版本开始,CLI会在其主版本范围内自动更新,但仅在交互式终端中生效,而Agent驱动的会话为非交互式,因此请持续执行上述显式的命令,不要假设已处于最新版本。
npm install -g railcode@latestMap The Request To Railcode
将请求映射到Railcode功能
Use this table before authoring the manifest. If the request names an external product or
data source, always check data connections/saved queries, service connectors, and personal
connectors before deciding what is available; the detailed discovery commands are in the
scoping step.
Hard file boundary: whenever AI must read, understand, extract, summarize, transform, or
generate a file, use a managed agent with and its sandbox. The companion
app may upload, store, list, download, and display files, but its in-page /
must never consume file contents, file URLs, file-derived payloads, or generate
file artifacts as a substitute. Publish durable results back through .
tools.app_filesllm.generate()llm.stream()tools.app_data_write| What the user asks for | Use this Railcode feature |
|---|---|
| "Analyze company metrics/orders/customers from our database" | |
| "Use our team's shared Stripe, CRM, or other SaaS account" | |
| "Use my Gmail, Slack, or another account I personally connected" | |
| "Connect my account to a product Railcode does not bundle" | A custom MCP personal connector works for an app, not an agent; offer a companion app, service connector, or data import path |
| "Read records people manage in a Railcode app" | |
| "Read, extract, summarize, transform, or generate a file with AI" | Managed agent with |
| "Edit this Word document / DOCX and preserve it as a file" | Managed agent + companion app: the app stores/manages source and output files; declare |
| "Create or revise a PowerPoint / PPTX deck" | Managed agent + companion app: the app manages templates, inputs, and generated decks; use the sandbox to create/edit the PPTX and |
| "Create a PDF report, form, or document" | Managed agent + companion app: the app manages inputs and downloadable outputs; generate and verify the PDF in the sandbox, then publish it through |
| "Analyze this Excel / XLSX workbook" | Managed agent + companion app: the app stores the workbook and results; load it through |
| "Write results or publish an artifact back to an app" | |
| "Remember state between runs" | |
| "Parse files, produce documents, or run code" | Managed-agent sandbox plus |
| "Email a report from the system" | |
| "Run every morning, from Slack, or after a browser closes" | Managed agent plus a cron schedule or the built-in Slack invocation path |
| "Give people a UI to upload inputs, trigger runs, or review results" | A companion Railcode app using |
| "Call an arbitrary website/API" | First look for service or bundled personal connectors; otherwise offer connector setup/import—a managed agent cannot fetch the open web or declare custom MCP toolkits |
在编写清单前,请使用下表。如果请求涉及外部产品或数据源,在决定可用功能前,请务必检查数据连接/已保存查询、服务连接器以及个人连接器;详细的发现命令在范围界定步骤中。
文件处理边界:每当AI需要读取、理解、提取、总结、转换或生成文件时,请使用带有和沙箱的托管Agent。配套应用可上传、存储、列出、下载和显示文件,但页面内的 / 绝不能处理文件内容、文件URL、文件衍生负载,也不能生成文件产物来替代。请通过发布持久化结果。
tools.app_filesllm.generate()llm.stream()tools.app_data_write| 用户需求 | 使用的Railcode功能 |
|---|---|
| "分析我们数据库中的公司指标/订单/客户数据" | 默认使用 |
| "使用我们团队共享的Stripe、CRM或其他SaaS账户" | |
| "使用我个人连接的Gmail、Slack或其他账户" | 在个人Agent上使用 |
| "将我的账户连接到Railcode未捆绑的产品" | 自定义MCP个人连接器适用于应用而非Agent;可提供配套应用、服务连接器或数据导入路径 |
| "读取用户在Railcode应用中管理的记录" | |
| "用AI读取、提取、总结、转换或生成文件" | 带 |
| "编辑此Word文档/DOCX并保留为文件格式" | 托管Agent + 配套应用:应用存储/管理源文件和输出文件;声明 |
| "创建或修改PowerPoint/PPTX演示文稿" | 托管Agent + 配套应用:应用管理模板、输入内容和生成的演示文稿;使用沙箱创建/编辑PPTX,通过 |
| "创建PDF报告、表单或文档" | 托管Agent + 配套应用:应用管理输入内容和可下载输出;在沙箱中生成并验证PDF,然后通过 |
| "分析此Excel/XLSX工作簿" | 托管Agent + 配套应用:应用存储工作簿和结果;通过 |
| "将结果写入或发布产物回应用" | |
| "在多次运行间保留状态" | |
| "解析文件、生成文档或运行代码" | 托管Agent沙箱 + |
| "从系统发送报告邮件" | |
| "每天早上运行、从Slack运行或在浏览器关闭后运行" | 托管Agent + cron调度或内置Slack调用路径 |
| "为用户提供上传输入、触发运行或查看结果的UI" | 使用 |
| "调用任意网站/API" | 首先查找服务或捆绑的个人连接器;否则提供连接器设置/导入方案——托管Agent无法访问开放网络或声明自定义MCP工具包 |
Sandbox Capabilities
沙箱功能
Managed agents run in a per-run code sandbox when sandboxing is configured for the deployment;
there is no manifest key or per-agent switch to request it. The sandbox provides shell and file
tools so the agent can write and run code, inspect and transform files, and use appropriate
libraries for tasks such as parsing Excel/CSV data, extracting or assembling PDFs, editing
documents, unpacking archives, and producing generated artifacts.
The sandbox is ephemeral and carries no credentials or standing org access. Bring tenant files
in with , reach other systems only through explicit manifest authorities, and
publish durable files or records back through . Anything left only in the
sandbox disappears when the run ends.
tools.app_filestools.app_data_write当部署配置了沙箱时,托管Agent会在每次运行的代码沙箱中执行;无需清单密钥或每个Agent的开关来请求沙箱。沙箱提供Shell和文件工具,使Agent能够编写和运行代码、检查和转换文件,并使用合适的库完成解析Excel/CSV数据、提取或组装PDF、编辑文档、解压归档以及生成产物等任务。
沙箱是临时的,不携带凭证或持续的组织访问权限。通过引入租户文件,仅通过明确的清单权限访问其他系统,并通过发布持久化文件或记录。仅留在沙箱中的任何内容会在运行结束后消失。
tools.app_filestools.app_data_writeWhen To Use A Managed Agent vs The In-Page LLM
何时使用托管Agent vs 页面内LLM
A managed agent (this skill) runs server-side under its own ratified manifest, with a
code sandbox and durable, auditable runs. The in-page LLM (/
with , via ) runs in the app viewer's tab with the app's SDK
authority and dies with the tab. Pick the first matching row:
llm.generatellm.streamtools$create-railcode-app| The AI feature… | Use |
|---|---|
| Summarizes / classifies / analyzes data the app already reads — user watching, done in seconds | In-page LLM |
| Reads, understands, extracts, summarizes, transforms, or generates any file | Managed agent ( |
| Writes and runs code | Managed agent (sandbox) |
| Is triggered outside the app (Slack, cron, API) | Managed agent |
| Runs unattended, must survive tab close, or needs retries | Managed agent |
| Has effects that must not depend on who's viewing (shared writes, send as the system) | Managed agent |
| Needs a run history someone will audit or debug | Managed agent |
The planes compose: the app keeps its chat shell in the page and delegates heavy steps by
calling / from an LLM tool's (the app manifest declares
; this agent declares to reach uploaded files).
agents.invokeagents.startrunagents: [name]app_files: [app]托管Agent(本技能)在服务器端运行,拥有已批准的清单,配备代码沙箱和持久化、可审计的运行记录。页面内LLM(通过使用的/搭配)在应用查看者的浏览器标签页中运行,使用应用的SDK权限,标签页关闭后即终止。请选择第一个匹配的场景:
$create-railcode-appllm.generatellm.streamtools| AI功能场景… | 使用方案 |
|---|---|
| 总结/分类/分析应用已读取的数据——用户实时查看,几秒内完成 | 页面内LLM |
| 读取、理解、提取、总结、转换或生成任何文件 | 托管Agent( |
| 编写并运行代码 | 托管Agent(沙箱) |
| 在应用外部触发(Slack、cron、API) | 托管Agent |
| 无人值守运行、需在标签页关闭后仍能运行或需要重试 | 托管Agent |
| 效果不依赖于查看者身份(共享写入、以系统身份发送) | 托管Agent |
| 需要可审计或调试的运行历史 | 托管Agent |
两者可组合使用:应用在页面中保留聊天界面,通过LLM工具的调用/来委托执行繁重步骤(应用清单声明;此Agent声明以访问上传的文件)。
runagents.invokeagents.startagents: [name]app_files: [app]Start From An Example
从示例开始
Railcode ships worked, deployable examples at
https://github.com/Railcode-HQ/railcode-examples. Read them to learn a pattern; copy one
when it covers much of what the user is asking for. Each example is a companion app
plus its agent manifests, which is the shape most agent work takes.
agents/| Example | What it is | Showcases |
|---|---|---|
| An app for uploading company materials, paired with an agent that writes a polished pitch-deck PDF from them. | App-paired managed agents: |
| An app that imports Granola client meetings, paired with an agent that drafts editable | Personal connectors (Granola), cron-triggered agent runs, connector calls made directly from the app without an agent. |
They pair an app with a managed agent because agents can't own files or storage directly — they
work through an app they have data access to. The repo's directory holds plain-app
examples (kanban, data chat, CRM); reach for those through .
apps/$create-railcode-appAsk, don't assume. When the request substantially overlaps an example, put the choice in the
step 1 scoping batch, naming the example in the user's own terms:
"Railcode provides an example that already generates client proposals from meeting notes. Should I use that as a starting point, or build from scratch?"
Ask once, alongside the other scoping questions. Never copy an example unprompted, and don't
raise the question when nothing matches.
Railcode在https://github.com/Railcode-HQ/railcode-examples**提供了可部署的完整示例。阅读示例以学习模式;当示例覆盖用户需求的大部分内容时,可直接复制。每个`agents/`示例都是**配套应用 + Agent清单,这是大多数Agent工作的典型结构。
| 示例 | 说明 | 展示内容 |
|---|---|---|
| 用于上传公司资料的应用,搭配可从资料生成精美的PDF演示文稿的Agent。 | 应用配对托管Agent: |
| 导入Granola客户会议记录的应用,搭配可从会议记录和存储资料生成可编辑 | 个人连接器(Granola)、cron触发的Agent运行、直接从应用调用连接器(无需Agent)。 |
它们将应用与托管Agent配对,因为Agent无法直接拥有文件或存储——它们通过有权访问数据的应用开展工作。仓库的目录包含纯应用示例(看板、数据聊天、CRM);请通过使用这些示例。
apps/$create-railcode-app询问而非假设。当请求与某个示例高度重叠时,在第1步范围界定环节中,用用户能理解的术语提及该示例,将选择权交给用户:
"Railcode提供了一个可从会议记录生成客户提案的示例。我应该以此为起点,还是从零开始构建?"
与其他范围界定问题一起一次性询问。切勿未经提示就复制示例,且当没有匹配示例时不要提出此问题。
Copying an example
复制示例
Copy only the one directory, as plain files — never the repo into the user's
project, add it as a submodule, or leave a behind:
git clone.gitbash
mkdir -p my-proposals
curl -fsSL https://github.com/Railcode-HQ/railcode-examples/archive/refs/heads/main.tar.gz \
| tar -xz --strip-components=3 -C my-proposals railcode-examples-main/agents/proposals--strip-components=3railcode-examples-main/agents/<example>/my-proposals/https://raw.githubusercontent.com/Railcode-HQ/railcode-examples/main/agents/proposals/agents/proposal-writer/agent.yamlThe agent manifests live at ; the app around them is a normal
Railcode app ( + ). Make the copy the user's own before
authoring behavior:
agents/<agent-name>/agent.yamlrailcode.jsonmanifest.yaml- Rename each directory and the manifest's
agents/<name>/, so the copy doesn't collide with an agent that already exists in the org.name - Point /
tools.app_data/app_filesat the renamed companion app slug, and keepapp_data_writeright for the tools declared (visibilityneedspersonal_connectors).personal - Cut every tool the new agent doesn't need — a copied manifest carries the example's authority,
not the narrowest set for this job — and re-size for the new workload.
limits - Rewrite the prompt and
systemfor the new contract; the example's prompt encodes its own step-by-step procedure and input shape.input_schema - In the app: set in
app, renamerailcode.json'spackage.json, runname, update thenpm installlist inagents:and everymanifest.yaml/agents.invokecall, and replace the example'sagents.startif it ships one.README.md
Then test the draft () before creating anything, exactly as in the
build workflow below. If the download fails, say so and build from scratch — don't reconstruct
an example from memory.
railcode agent test --file …仅复制单个目录作为普通文件——绝不要仓库到用户项目中、添加为子模块或留下目录:
git clone.gitbash
mkdir -p my-proposals
curl -fsSL https://github.com/Railcode-HQ/railcode-examples/archive/refs/heads/main.tar.gz \
| tar -xz --strip-components=3 -C my-proposals railcode-examples-main/agents/proposals--strip-components=3railcode-examples-main/agents/<example>/my-proposals/https://raw.githubusercontent.com/Railcode-HQ/railcode-examples/main/agents/proposals/agents/proposal-writer/agent.yamlAgent清单位于;其配套应用是普通的Railcode应用( + )。在编写行为逻辑前,请先将副本改为用户专属:
agents/<agent-name>/agent.yamlrailcode.jsonmanifest.yaml- 重命名每个目录和清单中的
agents/<name>/,避免与组织中已存在的Agent冲突。name - 将/
tools.app_data/app_files指向重命名后的配套应用slug,并确保声明的工具app_data_write设置正确(visibility需要personal_connectors)。personal - 删除新Agent不需要的所有工具——复制的清单携带示例的权限,而非当前任务所需的最小权限集——并根据新工作负载调整。
limits - 重写提示词和
system以适配新约定;示例的提示词包含其自身的分步流程和输入格式。input_schema - 在应用中:设置中的
railcode.json、重命名app的package.json、执行name、更新npm install中的manifest.yaml列表以及所有agents:/agents.invoke调用,并替换示例自带的agents.start(如果有的话)。README.md
然后按照下面的构建流程,在创建任何内容前先测试草稿()。如果下载失败,请告知用户并从零开始构建——不要凭记忆重构示例。
railcode agent test --file …Build Workflow
构建流程
1. Scope the agent
1. 界定Agent范围
Ask the scoping questions first, all in one batch — this is the moment the user is
still present; questions dribbled out mid-build risk landing after they've stepped away.
Phrase them for a non-technical user who knows nothing of Railcode internals: ask
about intent and let the answers pick the primitives without naming them. "Should the
whole team be able to run this, or just you?" — not "org or personal visibility?".
"Should it also run by itself every morning?" — not "do you want a cron schedule?". The
bullets below are what you need to learn from the answers, not the words to use.
If the request needs something agents can't do (scraping the open web, reacting to data
changes, running continuously — see Hard Limits), say so up front and
propose the nearest supported shape. Clarify only choices that materially change the
definition:
External source discovery is mandatory. Whenever the user asks for an agent that reads,
writes, syncs, searches, or acts on data from a named product or system ("X"), do not jump
straight to a manifest or conclude that X is unsupported. Before choosing tools, inspect every
Railcode integration plane available to the signed-in user:
bash
railcode db list # database/data-source connections
railcode query list # admin-published saved queries over those sources
railcode connector list # org service connectors
railcode personal-connectors list # per-user bundled and custom toolkits + connection statusInspect any plausible match before authoring ( and/or
), and copy exact connector names, endpoints,
tool slugs, and schemas rather than guessing. Prefer saved queries over . A bundled
personal toolkit requires and runs as the agent owner; an org agent
cannot declare personal connectors. If you cannot authenticate or reach the instance, ask what
is configured and give the user these discovery commands rather than treating the failed check
as evidence that no integration exists.
railcode connector docs <name>railcode personal-connectors tools <toolkit>adhoc_sqlvisibility: personalIf no suitable source exists, explain the gap and offer concrete paths: have an admin connect a
database and publish a saved query; enable or create an org service connector for a shared
credential/API; or connect a bundled personal toolkit and make the agent personal. Also mention
a remote custom MCP personal connector when X provides one, but state the boundary clearly:
connectors are callable by Railcode apps only, not managed-agent manifests.
For an agent workflow, offer a companion app that calls the custom MCP as its viewer, an
admin-configured service connector, or importing the needed data into a connected database/app
store the agent can read. If X exposes none of those supported surfaces, say Railcode cannot
connect to it directly and ask which alternative source the user wants to use.
custom_<slug>- the job it owns and the output expected;
- the input it accepts — free-form JSON or text; the prompt is the input contract;
system - the model and tools it needs;
- whether it runs on demand, from an app, on a schedule, or by Slack mention;
- whether it needs a companion app (see Companion Apps);
- whether to start from an example — when one in Start From An Example covers much of the request, ask: "Railcode provides an example that already generates client proposals from meeting notes. Should I use that as a starting point, or build from scratch?";
- what real systems, data, spend, or side effects a test may touch;
- its visibility — (the default: shared, invokable by anyone with an invoke grant, managed by its creator or any admin) or
org(owned and invoked by its creator alone, admins included — no grant makes it shared, and it cannot later becomepersonal). Pickorgonly when the agent needspersonal(its owner's own Gmail/Slack/etc.) or should otherwise be usable by exactly one person.tools.personal_connectors
Use the narrowest useful tool set and explicit instructions — but size the other
way: match the token budget to the task and leave headroom. Document-editing and
file-analysis runs use far more tokens than the defaults; a run that hits a cap dies as
, while an unused ceiling costs nothing (see
manifest tools reference, "Sizing ").
Do not invent tool identifiers,
provider names, or manifest fields; managed-agent manifest fields are server-defined (author
the file in JSON or YAML — see step 2). See
manifest tools reference for the current vocabulary
and — a snapshot of the server schema, not a contract; a save-time error always wins
over this file.
limitslimit_exceededlimitstools.*limits首先一次性批量询问范围界定问题——此时用户仍在场;在构建过程中零散提问可能会在用户离开后才收到回复。请以不了解Railcode内部机制的非技术用户的角度措辞:询问意图,让答案选择合适的功能,而非直接提及功能名称。例如问"整个团队都能运行它,还是只有你可以?"——而非"组织或个人可见性?"。问"它需要每天早上自动运行吗?"——而非"你需要cron调度吗?"。下面的要点是你需要从答案中了解的信息,而非提问的措辞。
如果请求需要Agent无法完成的功能(如抓取开放网络、响应数据变化、持续运行——请查看硬限制),请提前说明并提出最接近的支持方案。仅澄清会实质性改变定义的选项:
必须发现外部数据源。每当用户要求Agent读取、写入、同步、搜索或操作指定产品或系统("X")的数据时,不要直接编写清单或断定X不受支持。在选择工具前,请检查登录用户可用的所有Railcode集成渠道:
bash
railcode db list # 数据库/数据源连接
railcode query list # 管理员发布的基于这些数据源的已保存查询
railcode connector list # 组织服务连接器
railcode personal-connectors list # 每个用户的捆绑和自定义工具包 + 连接状态在编写清单前,请检查任何可能匹配的内容(和/或),并复制准确的连接器名称、端点、工具slug和模式,而非猜测。优先使用已保存查询而非。捆绑的个人工具包需要,并以Agent所有者身份运行;组织Agent无法声明个人连接器。如果无法认证或访问实例,请询问已配置的内容并向用户提供这些发现命令,不要将检查失败视为无集成的证据。
railcode connector docs <name>railcode personal-connectors tools <toolkit>adhoc_sqlvisibility: personal如果没有合适的数据源,请说明差距并提供具体方案:让管理员连接数据库并发布已保存查询;启用或创建组织服务连接器以使用共享凭证/API;或连接捆绑的个人工具包并将Agent设为个人版。当X提供远程自定义MCP个人连接器时也可提及,但需明确边界:连接器仅可被Railcode 应用调用,不可在托管Agent清单中声明。对于Agent工作流,可提供一个配套应用,由其查看者调用自定义MCP,或使用管理员配置的服务连接器,或导入所需数据到Agent可读取的连接数据库/应用存储中。如果X不支持上述任何方式,请说明Railcode无法直接连接,并询问用户想使用哪个替代数据源。
custom_<slug>- 它负责的工作和预期输出;
- 它接受的输入——自由格式JSON或文本;提示词是输入约定;
system - 它需要的模型和工具;
- 它是按需运行、从应用触发、按调度运行还是通过Slack提及触发;
- 是否需要配套应用(请查看配套应用);
- 是否从示例开始——当从示例开始中的某个示例覆盖了请求的大部分内容时,询问:"Railcode提供了一个可从会议记录生成客户提案的示例。我应该以此为起点,还是从零开始构建?";
- 测试可能涉及的真实系统、数据、费用或副作用;
- 可见性——(默认:共享,任何拥有调用权限的人都可调用,由创建者或任何管理员管理)或
org(仅由创建者拥有和调用,包括管理员——无法通过授权使其共享,且之后无法转为personal)。仅当Agent需要org(所有者自己的Gmail/Slack等)或仅允许一人使用时,才选择tools.personal_connectors。personal
使用最窄的有用工具集和明确指令——但设置相反:将令牌预算与任务匹配并预留余量。文档编辑和文件分析运行比默认值消耗更多令牌;达到上限的运行会以终止,而未使用的上限不会产生任何费用(请查看清单工具参考中的"调整大小")。不要发明工具标识符、提供商名称或清单字段;托管Agent清单字段由服务器定义(请以JSON或YAML格式编写文件——查看步骤2)。请查看清单工具参考获取当前词汇和——这是服务器模式的快照,而非约定;保存时的错误始终优先于本文档。
limitslimit_exceededlimitstools.*limits2. Authenticate and inspect
2. 认证和检查
Run if the CLI has no usable saved token. Agent commands use the selected
organization context and work from any directory; agents can have or
visibility and do not use .
railcode loginorgpersonalrailcode.jsonManifest file format. (on //) reads the manifest as JSON
or YAML; the CLI picks the parser by extension (/ → YAML, anything else →
JSON), and both parse to the same object the API stores. There is no local manifest-schema
validator — treat server validation and ratification warnings as authoritative.
--filecreateupdatetest.yaml.ymlFor an existing agent, pull its exact stored manifest before editing:
bash
railcode agent show <agent>
railcode agent pull <agent> --output agent.jsonpullshow --manifestagent.yaml--fileFor a new agent, author the manifest in the current server-supported shape — or, if the user
chose an example in step 1, copy that example's and adapt it (see
Start From An Example). Write the prompt as described in
Writing The System Prompt. Ask the user
whether to save the definition in the current working directory. If yes, write it there as
YAML () and feed that file to /; if no, keep it in a scratch
location outside their project.
agent.yamlsystemagent.yamltestcreate如果CLI没有可用的保存令牌,请运行。Agent命令使用选定的组织上下文,可在任何目录中运行;Agent可设置或可见性,无需使用。
railcode loginorgpersonalrailcode.json清单文件格式。(用于//命令)读取JSON或YAML格式的清单;CLI根据扩展名选择解析器(/ → YAML,其他 → JSON),两者解析为API存储的同一对象。没有本地清单模式验证器——请以服务器验证和批准警告为准。
--filecreateupdatetest.yaml.yml对于现有Agent,请在编辑前拉取其准确的存储清单:
bash
railcode agent show <agent>
railcode agent pull <agent> --output agent.jsonpullshow --manifestagent.yaml--file对于新Agent,请按照当前服务器支持的格式编写清单——或者,如果用户在步骤1中选择了示例,请复制该示例的并进行调整(请查看从示例开始)。按照编写System提示词中的描述编写提示词。询问用户是否要将定义保存到当前工作目录。如果是,将其保存为YAML格式()并在/命令中使用该文件;如果否,请将其保存在用户项目外的临时位置。
agent.yamlsystemagent.yamltestcreate3. Test the draft
3. 测试草稿
Test an unsaved manifest before creating or replacing an agent:
bash
railcode agent test --file agent.json --input '{"key":"value"}' --traceUse for larger or sensitive test payloads. Testing invokes real configured
models and tools, so it may incur spend, read real data, or cause tool side effects. Get any
needed authorization before running a side-effecting test.
--input-fileAn agent that reads a companion app through / proves nothing against an
empty app. Seed it first with and
(CLI 0.1.28+, app owner or org admin), using the shape the
app itself writes, then clean up anything throwaway.
app_dataapp_filesrailcode app kv set <collection> <key> '<json>'railcode app files upload <path>Do not rely only on the process exit code: a request that reached the runtime can exit 0 even
when the run's printed status is failed. Check or inspect .
Status:--jsonA draft test does not persist writes. tools run against a per-run in-memory
overlay, while tools are omitted because no saved agent exists yet. An untouched
store after is expected; use + to verify persistence. See
manifest tools reference.
app_data_writeagent_kvtestcreaterun在创建或替换Agent前,测试未保存的清单:
bash
railcode agent test --file agent.json --input '{"key":"value"}' --trace对于较大或敏感的测试负载,请使用。测试会调用真实配置的模型和工具,因此可能产生费用、读取真实数据或导致工具副作用。在运行有副作用的测试前,请获得必要的授权。
--input-file通过/读取配套应用的Agent,在空应用上测试无法验证功能。请先使用和(CLI 0.1.28+,应用所有者或组织管理员)填充测试数据,使用应用自身写入的格式,然后清理临时数据。
app_dataapp_filesrailcode app kv set <collection> <key> '<json>'railcode app files upload <path>不要仅依赖进程退出代码:即使运行的打印状态为失败,已到达运行时的请求也可能以0退出。请检查或查看输出。
Status:--json草稿测试不会保留写入操作。工具针对每次运行的内存覆盖层执行,而工具会被省略,因为尚未保存Agent。测试后存储未被修改是预期的;请使用 + 验证持久性。请查看清单工具参考。
app_data_writeagent_kvcreaterun4. Publish or update
4. 发布或更新
bash
railcode agent create --file agent.yaml # or agent.json — format is picked by extension
railcode agent create --file agent.yaml --visibility personal
railcode agent update <agent> --file agent.yamlupdaterailcode agent pullsystem--visibility <org|personal>createupdatetestcreatetestorgupdateorgpersonalagent:createorgagent:create_orgpersonal -> orgorg -> personalbash
railcode agent create --file agent.yaml # 或agent.json — 格式由扩展名决定
railcode agent create --file agent.yaml --visibility personal
railcode agent update <agent> --file agent.yamlupdaterailcode agent pullsystemcreateupdatetest--visibility <org|personal>createtestorgupdateorgpersonalagent:createorgagent:create_orgpersonal -> orgorg -> personal5. Verify the saved agent
5. 验证已保存的Agent
bash
railcode agent run <agent> --input '{"key":"value"}' --trace
railcode agent show <agent> --manifestConfirm the saved manifest, run status, output, and relevant trace steps. For organization
observability logs, use ; its workflow is an
admin capability rather than part of agent authoring.
$manage-railcode-orgrailcode logs agent ...When the agent writes back through , a clean run status is not proof the
data landed. Check the companion app's stores directly (CLI 0.1.28+, app owner or an org
admin):
tools.app_data_writebash
railcode app kv collections --app <app> # collections + record counts
railcode app kv list <collection> --app <app> # what app_kv_set actually wrote
railcode app files list --app <app> # what publish_artifact_to_app produced
railcode app files download <name> --app <app> # open the generated .docx/.pdf yourselfAdd or to inspect a
non-shared namespace; lists across every scope with owner attribution. This is
also the fastest way to catch a personal agent writing into its owner's private scope when
the team expected shared records.
--scope user --user <member-uuid>--scope role --role <role-uuid>--scope allbash
railcode agent run <agent> --input '{"key":"value"}' --trace
railcode agent show <agent> --manifest确认已保存的清单、运行状态、输出和相关跟踪步骤。对于组织可观测性日志,请使用;其工作流是管理员权限,不属于Agent编写流程的一部分。
$manage-railcode-orgrailcode logs agent ...当Agent通过写入数据时,运行状态正常并不代表数据已成功写入。请直接检查配套应用的存储(CLI 0.1.28+,应用所有者或组织管理员):
tools.app_data_writebash
railcode app kv collections --app <app> # 集合 + 记录数
railcode app kv list <collection> --app <app> # app_kv_set实际写入的内容
railcode app files list --app <app> # publish_artifact_to_app生成的内容
railcode app files download <name> --app <app> # 自行打开生成的.docx/.pdf文件添加或以查看非共享命名空间;列出所有范围的内容并显示所有者归属。这也是快速发现个人Agent写入所有者私有范围,而团队期望共享记录的最快方式。
--scope user --user <member-uuid>--scope role --role <role-uuid>--scope all6. Schedule only when requested
6. 仅在请求时设置调度
Each managed agent currently has at most one cron schedule. Inspect it first, then use
to upsert or a stricter create/update alias when that distinction matters.
schedule setbash
railcode agent schedule show <agent>
railcode agent schedule set <agent> --cron "0 9 * * *" --timezone UTCUse an IANA timezone and a five-field cron expression. Verify the stored schedule after every
mutation. executes synchronously against real services.
run-nowA scheduled run passes null input — there is no per-schedule payload. Write the
prompt so a run with no input knows exactly what to do. See
example agents ().
systemdaily-metrics-report每个托管Agent目前最多有一个cron调度。请先检查现有调度,然后使用更新,或在需要区分时使用更严格的创建/更新别名。
schedule setbash
railcode agent schedule show <agent>
railcode agent schedule set <agent> --cron "0 9 * * *" --timezone UTC使用IANA时区和五位cron表达式。每次修改后请验证存储的调度。会同步针对真实服务执行。
run-now调度运行会传递null输入——没有每个调度的负载。请编写提示词,使无输入的运行明确知道要执行的操作。请查看示例Agent()。
systemdaily-metrics-reportWriting The System Prompt
编写System提示词
The prompt is the agent's whole contract: what job it owns, how to read its input,
and what to return. Two habits keep it working as it evolves.
systemPrefer positive instruction. Say what the agent should do rather than what it shouldn't.
"Quote figures only from the uploaded materials, and write a bracketed placeholder where one
is missing" gives the model something to aim at; "don't invent figures" forbids one path and
leaves the rest to guesswork. This is an encouragement, not a rule — a real boundary ("never
email anyone outside the attendee list") is worth stating outright, and hard limits should
stay hard. But when a "don't" is standing in for a "do", write the "do".
Audit the whole prompt on every update. Each run reads the prompt cold. The agent has no
memory of previous versions, earlier runs, or the bug being chased last week — so prompts
accumulate debris that reads fine to us and misleads the agent:
- Corrections phrased as history — "We no longer do X, do Y instead." This agent never did X; the sentence introduces X and asks it to carry both. State only Y.
- Debug leftovers — a temporary "for now, only process the first three rows", or a workaround for a bug that has since been fixed.
- Orphaned steps — instructions naming a tool, app, connector, or field the manifest no longer declares.
- The same rule three times in slightly different words, each added during a different test round. Restatements compete; keep the clearest one.
So before , read the stored end to end from
— not from memory of what you last wrote — and rewrite it as the
procedure someone encountering it cold would follow. A system prompt should read as a
specification, never as a changelog.
railcode agent updatesystemrailcode agent pullsystem优先使用正向指令。说明Agent应该做什么,而非不应该做什么。例如"仅引用上传材料中的数据,缺失的地方请写入带括号的占位符"为模型提供了明确目标;而"不要编造数据"只禁止了一种路径,其余路径仍需猜测。这是一种建议而非规则——真正的边界(如"绝不要向参会名单外的人发送邮件")值得直接说明,且硬限制应保持严格。但当"不要"可以替换为"要"时,请编写"要"的内容。
每次更新时审核整个提示词。每次运行都会重新读取提示词。Agent没有对之前版本、早期运行或上周修复的bug的记忆——因此提示词会积累对我们来说看似正常,但会误导Agent的冗余内容:
- 以历史形式表述的修正——例如"我们不再做X,改为做Y"。此Agent从未做过X;这句话引入了X并要求它同时记住两者。请仅说明Y。
- 调试遗留内容——临时的"目前仅处理前三行",或针对已修复bug的临时解决方案。
- 孤立步骤——提及清单中不再声明的工具、应用、连接器或字段的指令。
- 同一规则重复三次,每次表述略有不同,分别在不同测试轮次添加。重复表述会产生冲突;请保留最清晰的版本。
因此在执行前,请从中读取存储的提示词从头到尾——不要凭记忆回忆你上次编写的内容——并将其重写为初次接触的人会遵循的流程。System提示词应作为规范,而非变更日志。
railcode agent updaterailcode agent pullsystemSlack (On By Default)
Slack(默认启用)
Once an org admin has connected the org's Slack workspace, every active agent is
reachable from Slack with no per-agent setup. Members run one by mentioning the bot in a
channel it has been invited to:
@Railcode $<agent-name> summarize this threadThe agent name takes a leading and must be the first token after the mention (a
bare name gets a usage hint instead of silently running something). What this means for
agent design:
$- Authority is unchanged. The Slack caller is resolved by verified email to a live org
member and must hold the normal invoke grant — no match, no run. A agent is therefore reachable on Slack only by its owner.
personal - Input arrives as . Agent input is free-form, so any agent can be mentioned; its
{ text: <message> }prompt must explain how to interpret that input.system - The platform posts the final reply into the mentioning thread, on success and on
failure. Whatever the agent returns IS the Slack reply (a Slack-triggered run is told so
in its system prompt and to write Slack mrkdwn); it does not need the connector to answer — that connector, when granted, is for interim progress updates only.
slack
So any agent a team will use conversationally should handle free-text input and produce a
final answer that reads well as a Slack message.
一旦组织管理员连接了组织的Slack工作区,所有活跃Agent都可从Slack访问,无需每个Agent单独设置。成员可在Agent已加入的频道中提及机器人来运行Agent:
@Railcode $<agent-name> summarize this threadAgent名称前需加,且必须是提及后的第一个令牌(不带的名称会显示使用提示而非静默运行)。这对Agent设计的意义:
$$- 权限不变。Slack调用者会通过验证邮箱解析为组织的活跃成员,且必须拥有正常的调用权限——无匹配则无法运行。因此Agent仅可由其所有者在Slack中访问。
personal - 输入格式为。Agent输入为自由格式,因此任何Agent都可被提及;其
{ text: <message> }提示词必须说明如何解释该输入。system - 平台会将最终回复发布到提及的线程中,无论成功或失败。Agent返回的内容即为Slack回复(Slack触发的运行会在其system提示词中被告知要编写Slack mrkdwn格式);它不需要连接器来回复——授予该连接器权限仅用于临时进度更新。
slack
因此,团队会以对话方式使用的任何Agent都应处理自由文本输入,并生成适合作为Slack消息的最终答案。
Companion Apps
配套应用
An agent often needs a companion app — a small static app ()
deployed alongside it. Reach for this pattern whenever the agent relies on files or
records someone must manage, or people need a place to trigger it and see its output:
$create-railcode-app- Storage the agent relies on — the app is the UI for uploading and managing the files
and records the agent reads: /
files.upload()in the app;db/app_files: [<app-slug>]in the agent's manifest.app_data: [<app-slug>] - A surface for results — the agent writes back via (
app_data_write,app_kv_set) and the app renders run outputs.publish_artifact_to_app - An easy way to test and trigger — a button wired to (app manifest:
agents.invoke(name, input)) exercises the agent end-to-end far faster than hand-crafting CLI runs, and doubles as the interactive production trigger.agents: [<agent-name>]
Name the app after the agent (e.g. agent , app
), declare the narrowest slugs on both sides, and build the app
with . The rows in Start From An Example
are working versions of exactly this pairing — read or copy one instead of assembling it
from scratch.
report-extractorreport-extractor-console$create-railcode-appagents/Agent通常需要配套应用——一个部署在其旁边的小型静态应用()。当Agent依赖用户必须管理的文件或记录,或用户需要触发Agent和查看输出的界面时,请使用此模式:
$create-railcode-app- Agent依赖的存储——应用是上传和管理Agent读取的文件和记录的UI:应用中使用/
files.upload();Agent清单中使用db/app_files: [<app-slug>]。app_data: [<app-slug>] - 结果展示界面——Agent通过(
app_data_write、app_kv_set)写入数据,应用渲染运行输出。publish_artifact_to_app - 便捷的测试和触发方式——连接到的按钮(应用清单:
agents.invoke(name, input))比手动编写CLI运行命令更快地端到端测试Agent,同时可作为交互式生产触发方式。agents: [<agent-name>]
请以Agent名称命名应用(例如Agent为,应用为),在双方声明最窄的slug,并使用构建应用。从示例开始中的示例正是这种配对的工作版本——请阅读或复制一个示例,而非从零开始组装。
report-extractorreport-extractor-console$create-railcode-appagents/Hard Limits
硬限制
What a managed agent cannot do, regardless of manifest (the full platform-wide list is
in → "Limitations"):
$create-railcode-app- Reach the open web. Sandbox egress is an allowlist (PyPI, npm, the presigned
download host with ); the
app_filestool reaches only ratified endpoints. No scraping, no arbitrary APIs.connector - Run long or continuously. Runs are bounded — at most 300 steps / 1200 s / the token
caps in . No daemons, no monitors; recurring work is a cron schedule.
limits - React to events. Triggers are app/API call, cron, and Slack mention only — no data-change or inbound-webhook triggers.
- Invoke other agents. There is no agent→agent tool; compose pipelines through an app or an external caller instead.
- Use custom MCP personal connectors. A user-added by-URL MCP connector
() works for its owner and for apps, but is not declarable in an agent manifest — ratification checks the static registry. Bundled toolkits only.
custom_<slug> - Keep sandbox state. The sandbox filesystem is per-run; anything worth keeping must
be published () or written to KV before the run ends.
publish_artifact_to_app
无论清单如何配置,托管Agent无法完成的操作(完整的平台范围限制请查看 → "限制"):
$create-railcode-app- 访问开放网络。沙箱出口为白名单(PyPI、npm、使用的预签名下载主机);
app_files工具仅可访问已批准的端点。无法抓取网页,无法调用任意API。connector - 长时间或持续运行。运行有边界限制——最多300步/1200秒/中的令牌上限。无法运行守护进程或监视器;重复工作需使用cron调度。
limits - 响应事件。仅支持应用/API调用、cron和Slack提及触发——不支持数据变化或入站Webhook触发。
- 调用其他Agent。没有Agent→Agent工具;请通过应用或外部调用者组合流水线。
- 使用自定义MCP个人连接器。用户通过URL添加的MCP连接器()适用于所有者和应用,但不可在Agent清单中声明——批准检查会验证静态注册表。仅支持捆绑工具包。
custom_<slug> - 保留沙箱状态。沙箱文件系统为每次运行独有;任何需要保留的内容必须在运行结束前发布()或写入KV存储。
publish_artifact_to_app
Permissions and Boundaries
权限和边界
- ,
list, andshowonly ever return org agents plus the caller's own personal agents — someone else's personal agent is invisible (a 404, never a 403, to avoid confirming it exists), admins included.pull - For an org agent: needs an invoke grant for that agent;
run/update/delete/ schedule mutations are allowed for the agent's own creator, or any org owner/admin — not every member. Creating (or transitioning an existing agent to)testadditionally needs theorgcapability.agent:create_org - For a personal agent: invoke and manage are both owner-only, with no admin
override — there is no break-glass, so even an org owner/admin can't reach someone else's.
Creating one needs the broadly-grantable capability, not owner/admin.
agent:create - archives the agent while keeping run history and requires
deleteoutside a TTY.--yes - Use when building a static app that invokes an agent through
$create-railcode-app. A privileged app manifest declaresagents.invoke(name, input).agents: [name] - An app can also run its own agentic loop in the page with /
llm.generate({ tools })— no managed agent involved. See When To Use A Managed Agent vs The In-Page LLM at the top of this skill for the split.llm.stream({ tools }) - Use for members, roles/grants, apps/access, connections, service connectors, analytics, and organization logs.
$manage-railcode-org
- 、
list和show仅返回组织Agent以及调用者自己的个人Agent——其他人的个人Agent是不可见的(返回404,而非403,以避免确认其存在),包括管理员。pull - 对于组织Agent:需要该Agent的调用权限;
run/update/delete/调度变更仅允许Agent的创建者或任何组织所有者/管理员执行——并非所有成员。创建(或将现有Agent转换为)test还需要org权限。agent:create_org - 对于个人Agent:调用和管理均为仅所有者可用,无管理员覆盖权限——没有应急权限,因此即使组织所有者/管理员也无法访问他人的个人Agent。创建个人Agent需要广泛授予的权限,而非所有者/管理员权限。
agent:create - 会归档Agent并保留运行历史,在非TTY环境中需要
delete参数。--yes - 当构建通过调用Agent的静态应用时,请使用
agents.invoke(name, input)。特权应用清单需声明$create-railcode-app。agents: [name] - 应用也可在页面内通过/
llm.generate({ tools })运行自己的Agent循环——无需托管Agent。请查看本文档顶部的何时使用托管Agent vs 页面内LLM了解区分方式。llm.stream({ tools }) - 请使用管理成员、角色/权限、应用/访问、连接、服务连接器、分析和组织日志。
$manage-railcode-org
Reference
参考
Read CLI reference for the exact agent commands, aliases,
schedule behavior, inputs, outputs, and failure semantics. Read
manifest tools reference for the vocabulary,
what each grants, its permission gate, and . Read
example agents for worked, runnable manifests covering a minimal
agent and a scheduled query-to-email workflow. For complete agent-plus-companion-app projects
(pitch decks, client proposals), read or copy from — see
Start From An Example.
tools.*limitsrailcode-examples请阅读CLI参考获取准确的Agent命令、别名、调度行为、输入、输出和失败语义。请阅读清单工具参考获取词汇、每个工具的权限、权限门限和。请阅读示例Agent获取涵盖最小Agent和调度查询到邮件工作流的可运行清单。如需完整的Agent加配套应用项目(演示文稿、客户提案),请阅读或复制中的内容——查看从示例开始。
tools.*limitsrailcode-examples