Skip to content

Commit 4c02803

Browse files
authored
Merge pull request #4 from shadowthreads/milestone/artifact-store-migration-v1
add quickstart example script
2 parents 4719763 + 334d471 commit 4c02803

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

first_run.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
from hashlib import sha256
2+
from shadowthreads import ArtifactReference, RevisionMetadata, ShadowClient
3+
4+
package_id = "readme-first-run"
5+
prompt_hash = sha256(b"Summarize the current workflow state.").hexdigest()
6+
started_at = "2026-03-12T09:00:00+00:00"
7+
finished_at = "2026-03-12T09:00:01+00:00"
8+
9+
with ShadowClient(base_url="http://localhost:3001") as client:
10+
artifact = client.capture_artifact(
11+
schema="artifact.task.state.v1",
12+
package_id=package_id,
13+
payload={"task": "example", "state": "ready"},
14+
)
15+
16+
ref = ArtifactReference(bundle_hash=artifact.bundle_hash, role="primary_state")
17+
18+
revision = client.create_revision(
19+
package_id=package_id,
20+
artifacts=[ref],
21+
metadata=RevisionMetadata(
22+
author="README example",
23+
message="Initial task state",
24+
created_by="python-sdk",
25+
timestamp=started_at,
26+
source="human",
27+
),
28+
)
29+
30+
execution = client.record_execution(
31+
package_id=package_id,
32+
revision_hash=revision.revision_hash,
33+
provider="local-example",
34+
model="shadow-demo-model",
35+
prompt_hash=prompt_hash,
36+
parameters={"temperature": 0},
37+
input_artifacts=[ref],
38+
output_artifacts=[ref],
39+
status="success",
40+
started_at=started_at,
41+
finished_at=finished_at,
42+
)
43+
44+
replay = client.replay_execution(execution.execution_id)
45+
print(replay.verified)

0 commit comments

Comments
 (0)