Skip to content

Conversation

@sswez02
Copy link

@sswez02 sswez02 commented Jan 12, 2026

Fixes #4143

Problem

Users need to get a JSON snapshot of the Client as a dictionary for sharing experiments programmatically (e.g., storing in databases, sending over network) without writing to a file. Currently they have to use the private method _to_json_snapshot().

Solution

Added a public to_json_snapshot() method to Client in ax/api/client.py that returns the JSON-serializable dictionary.

Usage

from ax.api.client import Client
import json

client = Client()
# ... configure experiment ...

# Get snapshot as dictionary (NEW)
snapshot = client.to_json_snapshot()

# Can now use programmatically
json_string = json.dumps(snapshot)  # Convert to string
# Or store in database, send over network, etc.

Previous Behavior

Users had to use the private method client._to_json_snapshot() which is not part of the public API and could change without notice.

New Behavior

Users can use the public method client.to_json_snapshot() which is part of the supported API.

@meta-cla meta-cla bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST]: function to save ax client to json object

1 participant