Skip to content

Result Files

During execution of your bot, it can upload or download any type of files to/from the BotCity Maestro portal.

As a general term, we refer to those files are artifacts or result files.

They can be accessed via the menu Result Files on the BotCity Maestro portal.

You can download the files directly from the web interface or using the Maestro SDK.

Over the next steps we will show you how to upload and download artifacts using the SDK API.

Uploading an Artifact

In this example we will upload a file artifact to BotCity Maestro.

maestro.post_artifact(
    task_id=task.id,
    artifact_name="My Artifact",
    filepath="artifact.txt"
)
File artifact = new File("artifact.txt");
maestro.postArtifact(task.id, "My Artifact", artifact);
const filepath = "artifact.txt"
const artifact = await maestro.createArtifact(task.id, "My Artifact", filepath)
const filepath: string = "artifact.txt"
const artifact: Artifact = await maestro.createArtifact(task.id, "My Artifact", filepath)

Listing all Artifacts

Here is how we list all artifacts via the BotCity Maestro SDK:

artifacts = maestro.list_artifacts()

Note

The list of artifacts is a list of Artifact objects.

List<ArtifactVO> artifacts = maestro.listArtifact();
const artifacts = await maestro.getArtifacts("10", "5")
const artifacts: Artifacts = await maestro.getArtifacts("10", "5")

Downloading an Artifact

In order to download an artifact you will need the artifact id.

Here is how we download an artifact via the BotMaestro SDK:

# Define artifact ID
artifact_id = "1"

# Get artifact name and content
name, content = maestro.get_artifact(artifact_id=artifact_id)

# Write to disk
with open(name, "wb") as f:
    f.write(content)
// Define artifact ID
String artifactId = "1";

File artifact = new File("<path to file>/artifact.txt");

// Get artifact content
byte[] data = maestro.getArtifactFile(artifactId);

// Write to disk
Files.write(data, artifact);
// Define artifact ID
const artifactId = "1"

const filepath = "artifact.txt"

const data = await maestro.downloadArtifact(artifactId, filepath)
// Define artifact ID
const artifactId: string = "1"

const filepath: string = "artifact.txt"

const data: Buffer = await maestro.downloadArtifact(artifactId, filepath)