Use Sandbox Mounts for filesystem access
mainLangSmith sandboxes can access external data (like S3, GCS, or Git repositories) using mount_config.
- S3 Mounts: Require AWS authentication via
aws_authwithin themount_config.authlist. - GCS Mounts: Require GCP authentication via
gcp_authwithin themount_config.authlist. - Git Mounts: Public Git repositories can be mounted using
git_mountwithout explicit AWS/GCP auth. For private repositories, useproxy_configrules.
Note: Explicit AWS/GCP proxy auth rules in proxy_config will conflict with mount_config auth for the same provider.
# Example: S3 Mount
from langsmith.sandbox import (
aws_auth,
mount_config,
s3_mount,
workspace_secret,
)
mount_cfg = mount_config(
auth=[
aws_auth(
access_key_id=workspace_secret("SANDBOX_AWS_ACCESS_KEY_ID"),
secret_access_key=workspace_secret("SANDBOX_AWS_SECRET_ACCESS_KEY"),
)
],
mounts=[
s3_mount(
id="customer_data",
mount_path="/mnt/mounts/customer-data",
bucket="example-bucket",
prefix="datasets/customer-data",
region="us-east-1",
endpoint_url="https://s3.amazonaws.com",
path_style=False,
read_only=False,
)
],
)
# Example: Git Mount
from langsmith.sandbox import git_mount, mount_config
mount_cfg_git = mount_config(
mounts=[
git_mount(
id="repo",
mount_path="/mnt/repo",
remote_url="https://github.com/langchain-ai/langsmith-sdk.git",
ref={"type": "branch", "name": "main"},
refresh_interval_seconds=60,
)
],
)