Skip to main content

Retrieving Routine Artifacts

Author: Chris Bahr, Created: 2026-03-26

Retrieving Artifacts from a Run

Key Concepts

Every Run has two configuration properties that determine how artifacts are accessible:

  • Execution Type ("background" or "in-memory") -- how the routine executes.

  • Store Artifacts (true / false) -- whether artifacts are persisted to the file system.

After calling StartAndWaitForSuccessfulCompletionResultAsync(), each artifact in the RunResult is wrapped in an ArtifactInfo object that exposes two boolean flags:

  • HasInMemoryArtifact -- artifact data was returned inline (in-memory runs only).

  • HasArtifactStored -- artifact data was persisted to the file system.

The Two Retrieval Paths

Path 1: Stored Artifact (file-backed)

Works for both "background" and "in-memory" runs when StoreArtifacts = true.

RunResult rr = run.StartAndWaitForSuccessfulCompletionResultAsync().Result;
ArtifactInfo ai = rr.GetArtifactInfo("account_summary");

Artifact artifact = ai.GetArtifactAsync().Result;

// Deserialize into a .NET type (DataTable, string, JObject, or a custom class)
var data = artifact.GetDataAsObjectAsync<AccountSummaryResponse>().Result;

// Or get raw file paths for manual processing
List<string> paths = artifact.GetDataFilePathsAsync().Result;

Path 2: In-Memory JSON Artifact

Only available for "in-memory" runs.

RunResult rr = run.StartAndWaitForSuccessfulCompletionResultAsync().Result;
ArtifactInfo ai = rr.GetArtifactInfo("account_summary");

InMemoryJsonArtifact jsArtifact = ai.GetInMemoryJsonArtifactAsync().Result;

// Deserialize into a strongly typed object
var data = jsArtifact.GetArtifactData<AccountSummaryResponse>();

// Or access as raw JObject / string
JObject raw = jsArtifact.GetArtifactData();
string json = jsArtifact.GetArtifactDataAsString();

When Is Each Path Available?

Scenario

In-Memory Path

Stored Artifact Path

In-memory run, StoreArtifacts = true

Yes

Yes

In-memory run, StoreArtifacts = false

Yes

No

Background run, StoreArtifacts = true

No

Yes

Background run, StoreArtifacts = false

No

No

RunResult rr = run.StartAndWaitForSuccessfulCompletionResultAsync().Result;
ArtifactInfo ai = rr.GetArtifactInfo("account_summary");

if (ai.HasInMemoryArtifact)
{
// Fast path -- data already in memory, no API call
InMemoryJsonArtifact jsArtifact = ai.GetInMemoryJsonArtifactAsync().Result;
var data = jsArtifact.GetArtifactData<AccountSummaryResponse>();
}
else if (ai.HasArtifactStored)
{
// Fallback -- load from file system
Artifact artifact = ai.GetArtifactAsync().Result;
var data = artifact.GetDataAsObjectAsync<AccountSummaryResponse>().Result;
}

Summary

  • Stored Artifact (GetArtifactAsync) is the universal path -- it works across both execution types as long as StoreArtifacts is enabled.

  • In-Memory JSON (GetInMemoryJsonArtifactAsync) is a convenience shortcut that avoids a file system round-trip, but is only populated for in-memory runs.

  • When StoreArtifacts is false on a background run, artifacts are lost -- there is no retrieval path

Was this page helpful?