Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions blog/2025-10-17-fork-buckets-like-code/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,50 @@ own copy of the data. Let's walk through the pattern using Tigris:
start_agent(agent_bucket_name)
```

</TabItem>
<TabItem value="boto3" label="Python (boto3)">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace the python tab with this one?

```python
# In your terminal, install the boto3 extension
pip install tigris-boto3-ext
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be outside the python code block into its own shell block

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's intentionally in the tabbed view so it is alongside the other code examples. I added a "In your terminal, install..." so it's more clear.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is not quickly copy-pastable then. Because copying it using the shortcut will end up copying the pip command as well.


# Now, the code
import boto3
from tigris_boto3_ext import (
TigrisSnapshotEnabled,
create_snapshot_bucket,
create_snapshot,
get_snapshot_version,
create_fork,
)

# Initialize boto3 S3 client for Tigris
s3_client = boto3.client(
's3',
endpoint_url='https://t3.storage.tigris.dev',
aws_access_key_id='your-access-key',
aws_secret_access_key='your-secret-key',
)

# Create a seed bucket
seed_bucket_name = 'agent-seed'
create_snapshot_bucket(s3, seed_bucket_name)

# Create snapshot
result = create_snapshot(s3_client, seed_bucket_name, snapshot_name='agent-seed-v1')
snapshot_version = get_snapshot_version(result)

# Fork the bucket from the snapshot for a new agent
agent_bucket_name = f"{seed_bucket_name}-agent-{agent_id}";
create_fork(s3_client, agent_bucket_name, seed_bucket_name, snapshot_version=snapshot_version)

# Start the agent using the forked bucket
start_agent(agent_bucket_name)

# Standard boto3 operations work normally:
s3_client.put_object(Bucket=seed_bucket_name, Key='config.json', Body=b'{}')
s3_client.put_object(Bucket=seed_bucket_name, Key='data.txt', Body=b'seed data')
```

</TabItem>
<TabItem value="javascript" label="JavaScript">
```javascript
Expand Down