Export Run files

View as Markdown

Create one private archive File from Files associated with a Run. Use this to keep the artifacts from one execution together after the Run finishes.

Export Run files

1const result = await bctrl.tools.call("run.files.export", {
2 runId: run.id,
3 fileIds: ["file_01JQXYZ8ABCD1234EFGH5678JK"],
4 name: "checkout-artifacts.zip",
5});
6
7console.log(result.fileId, result.name, result.size);

fileIds is optional and accepts up to 500 File IDs. When omitted, the Tool exports all eligible Files associated with the Run.

Request parameters

ParameterTypeRequiredDescription
runIdRunIdYesRun whose Files are being exported.
fileIdsFileId[]NoFiles to include, up to 500 IDs.
namestringNoArchive File name, from 1 to 255 characters.

Response

FieldTypeAlways presentDescription
fileIdFileIdYesNew archive File identifier.
namestringYesArchive File name.
sizenumberYesArchive size in bytes.

Run asynchronously

1const call = await bctrl.tools.start("run.files.export", {
2 runId: run.id,
3 fileIds: ["file_01JQXYZ8ABCD1234EFGH5678JK"],
4});
5
6const result = await bctrl.toolCalls.result(call.id, {
7 waitSeconds: 60,
8});

Use bctrl.toolCalls.get(call.id) to inspect progress or bctrl.toolCalls.cancel(call.id) to cancel an active export.

Next

  • Runs — inspect the execution and its Files
  • Files — manage the resulting archive
  • Tools — understand ToolCalls