Export agent for runtime
Export a fully-resolved, self-contained agent definition that the @runtypelabs/runtime package can consume directly at boot. Capabilities, flows, and nested sub-agents are inlined recursively (up to 3 levels). Skills bound to the agent are snapshotted into skills, each with the skill version it resolved to, and the runtime loads them with no host wiring. MCP credential values and external-agent auth credentials are replaced with secret-name references. A configured decision_judge tool carries its published question set (questions, model, version, input mapping and current calibration) at config.questionSet, resolved once at export so a self-hosted runtime never looks the question set up; a question set that is missing, unpublished, owned by another account, or pinned to an unpublished version is reported in warnings with reason question_set_unresolved instead of failing the export. An export that would carry a literal credential typed into a tool config or MCP server is refused with 422 and code raw_credential_in_export. Requires the RUNTIME:EXPORT scope and an Enterprise plan (the byoc entitlement); an unentitled account receives 403 with code BYOC_PLAN_REQUIRED in every environment.
The response carries hostDependencies: the runtime seams the exported artifact needs a host to wire before it can run everything it describes. A durable-class step (wait-until or crawl) anywhere in the agent’s executable closure declares a durable-pause-host dependency; a detached-capable dynamic subagent pool or a detached inline subagent tool declares a background-run-coordinator dependency. The array is empty when nothing needs wiring.
The response also carries warnings: each referenced sub-agent or flow the export could not embed, with the reason (not_found, claude_managed_unsupported, max_depth_exceeded for nesting deeper than 3 levels, invalid_flow_config, unresolved_tool_ref, or unsupported_mcp_auth), and each configured decision tool whose question set could not be resolved (question_set_unresolved). The export still returns 200 and leaves the referencing capability or tool out of the artifact; a decision tool stays in, without config.questionSet. The array is empty when every child was embedded.
Pass at most one release selector. versionId exports that published version; alias exports the version a release alias (for example staging, live or pr-42) currently points at, resolved exactly as the execution selector agent: { agentId, alias } resolves it. With neither, the export follows the agent’s default target: the version its live alias names when the org runs on release aliases, otherwise the agent’s current definition. A version-backed export carries release with the resolved versionId, plus alias and aliasRevision when an alias selected it. An unknown version or alias, or an archived or expired alias, answers 404.
Authentication
Path parameters
Query parameters
Export this published agent version. Mutually exclusive with alias.
Export the version this release alias currently points at. Mutually exclusive with versionId.
json (the default) returns the exported definition. bundle returns a vendorable application/zip with agent.json (the same definition), runtime/ (the prebuilt @runtypelabs/runtime ESM package for the platform runtime version, installable as file:./runtime), manifest.json, and LICENSE (the runtime ships under FSL-1.1-ALv2).
Response
Exported agent definition, or with format=bundle a zip archive. Two bundle exports of the same version are byte-identical. The bundle manifest.json records the runtime version and source commit, the agent versionId/alias, the entrypoints, hostDependencies, warnings, and contentHash: sha256 over the sha256sum listing (<sha256> <path> lines sorted by path) of every file except manifest.json. The same hash is sent in the X-Runtype-Bundle-Content-Hash header.
Referenced sub-agents, flows and question sets the export could not embed, each with the reason. The export still returns 200; a tool or capability that names a dropped child is absent from the artifact. Empty when every child was embedded.
The published version this export contains. alias and aliasRevision are present when a release alias selected it. Absent when the export read the agent’s current definition.
Skills bound to the agent, snapshotted with the skill version each resolved to. executeAgent loads them with no host wiring. Absent when the agent has no bound skills.