await SecretStore.create(**kwargs)123456from opencomputer import SecretStore store = await SecretStore.create( name='my-agent-secrets', egress_allowlist=['api.anthropic.com'], )
body namestrrequiredbody egress_allowlistlist[str] | Nonedictawait SecretStore.list(**kwargs)list[dict]await SecretStore.get(store_id, **kwargs)body store_idstrrequireddictawait SecretStore.update(store_id, **kwargs)12345updated = await SecretStore.update( 'store-uuid', name='new-name', egress_allowlist=['api.anthropic.com', '*.openai.com'], )
body store_idstrrequiredbody namestrbody egress_allowlistlist[str] | Nonedictawait SecretStore.delete(store_id, **kwargs)Noneawait SecretStore.set_secret(store_id, name, value, **kwargs)1234567await SecretStore.set_secret('store-uuid', 'ANTHROPIC_API_KEY', 'sk-ant-...') # Optionally restrict to specific hosts: await SecretStore.set_secret( 'store-uuid', 'ANTHROPIC_API_KEY', 'sk-ant-...', allowed_hosts=['api.anthropic.com'], )
body store_idstrrequiredbody namestrrequiredbody valuestrrequiredbody allowed_hostslist[str] | NoneNoneawait SecretStore.list_secrets(store_id, **kwargs)list[dict]await SecretStore.delete_secret(store_id, name, **kwargs)None12345678910111213sandbox = await Sandbox.create( secret_store='my-agent-secrets', timeout=600, ) # Secrets are available as sealed env vars result = await sandbox.commands.run('echo $ANTHROPIC_API_KEY') # stdout: "osb_sealed_abc123..." (sealed, not the real key) # Outbound HTTPS requests get the real value substituted by the proxy api_result = await sandbox.commands.run( 'curl -s https://api.anthropic.com/v1/messages -H "x-api-key: $ANTHROPIC_API_KEY" ...' )
123456789101112131415161718from opencomputer import Sandbox, Snapshots, Image # Pre-build a snapshot with dependencies snapshots = Snapshots() await snapshots.create( name='data-pipeline', image=Image.base().apt_install(['python3-pip']).pip_install(['pandas']), ) # Create sandboxes from the snapshot, each with their own credentials worker1 = await Sandbox.create( snapshot='data-pipeline', secret_store='worker-1-keys', ) worker2 = await Sandbox.create( snapshot='data-pipeline', secret_store='worker-2-keys', )
12345678910# Bake a base environment with git credentials base = await Sandbox.create(secret_store='git-creds') await base.exec.run('git clone https://github.com/org/repo /app') cp = await base.create_checkpoint('repo-cloned') # Fork with different credentials per sandbox (layered on top of git-creds) worker = await Sandbox.create_from_checkpoint( cp['id'], secret_store='worker-keys', # layered on top of git-creds )