Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SmythOS provides a complete **Operating System for Agentic AI**. Just as traditi

### Unified Resource Abstraction

SmythOS provides a **unified interface for all resources**, ensuring consistency and simplicity across your entire AI platform. Whether you're storing a file locally, on S3, or any other storage provider, you don't need to worry about the underlying implementation details. SmythOS offers a powerful abstraction layer where all providers expose the same functions and APIs.
SmythOS provides a **unified interface for all resources**, ensuring consistency and simplicity across your entire AI platform. Whether you're storing a file locally, on AWS S3, Azure Blob Storage or any other storage provider, you don't need to worry about the underlying implementation details. SmythOS offers a powerful abstraction layer where all providers expose the same functions and APIs.

This principle applies to **all services** - not just storage. Whether you're working with VectorDBs, cache (Redis, RAM), LLMs (OpenAI, Anthropic), or any other resource, the interface remains consistent across providers.

Expand Down
47 changes: 47 additions & 0 deletions examples/06-Storage-no-agent/03-AzureBlobStorage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import 'dotenv/config';
import { Storage } from '@smythos/sdk';

async function main() {
// Ensure environment variables are loaded
if (!process.env.AZURE_STORAGE_ACCOUNT_NAME || !process.env.AZURE_STORAGE_ACCESS_KEY) {
console.error("Error: Missing Azure credentials in your .env file.");
return;
}

// Initialize the Azure Blob Storage connector with credentials from the .env file
const azureStorage = Storage.AzureBlobStorage({
storageAccountName: process.env.AZURE_STORAGE_ACCOUNT_NAME,
storageAccountAccessKey: process.env.AZURE_STORAGE_ACCESS_KEY,
blobContainerName: process.env.AZURE_BLOB_CONTAINER_NAME!,
});

const resourceId = 'smythos-azure-test.txt';
const content = 'Hello, world from Azure!';

console.log(`=== Running Azure Blob Storage Example ===`);

// Write a file to your container.
console.log(`Writing "${content}" to "${resourceId}"...`);
await azureStorage.write(resourceId, content);
console.log('Write operation complete.');

// Read the file back.
console.log(`Reading "${resourceId}"...`);
const data = await azureStorage.read(resourceId);
console.log('Read operation complete.');

// Log the content to verify it's correct.
const dataAsString = data?.toString();
console.log(`Content read from blob: "${dataAsString}"`);

if (dataAsString !== content) {
throw new Error("Verification failed: Read content does not match written content!");
}

console.log('Verification successful!');
console.log(`=== Example Finished ===`);
}

main().catch(error => {
console.error("An error occurred:", error.message);
});
45 changes: 45 additions & 0 deletions packages/core/docs/connectors/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,48 @@ SRE.init({
- Store credentials securely using environment variables or AWS Secrets Manager
- Configure appropriate bucket policies and CORS settings
- Enable encryption at rest and in transit for sensitive data

-----

### Azure Blob Storage

**Role**: Microsoft Azure Blob Storage cloud connector
**Summary**: Provides highly scalable and secure cloud storage using Azure Blob Storage, ideal for production workloads integrated with the Microsoft Azure ecosystem.

| Setting | Type | Required | Default | Description |
|:--------------------------|:-------|:---------|:--------|:---------------------------------------------|
| `storageAccountName` | string | Yes | - | The name of your Azure Storage Account |
| `storageAccountAccessKey` | string | Yes | - | Access key for the storage account |
| `blobContainerName` | string | Yes | - | The container name for storing blobs (files) |


**Example Configuration:**

```typescript
import { SRE } from '@smythos/sre';

SRE.init({
Storage: {
Connector: 'AzureBlobStorage',
Settings: {
storageAccountName: 'myappstorageaccount',
storageAccountAccessKey: process.env.AZURE_STORAGE_ACCESS_KEY,
blobContainerName: 'my-app-blobs',
},
},
});
```

**Use Cases:**

* Production environments, especially those hosted on Microsoft Azure
* Applications requiring durable, high-availability, and geo-redundant storage
* Integration with the Azure ecosystem (Azure Functions, Logic Apps, etc.)
* Storing large-scale unstructured data like images, videos, and documents

**Security Notes:**

* Use Managed Identities when running on Azure infrastructure for the most secure, keyless authentication.
* Store credentials securely using environment variables or Azure Key Vault.
* Configure container access policies and use Shared Access Signatures (SAS) for fine-grained, temporary access.
* Enable encryption at rest and in transit for sensitive data.
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"@aws-sdk/client-lambda": "^3.835.0",
"@aws-sdk/client-s3": "^3.826.0",
"@aws-sdk/client-secrets-manager": "^3.826.0",
"@azure/storage-blob": "^12.28.0",
"@faker-js/faker": "^9.8.0",
"@google-cloud/vertexai": "^1.7.0",
"@google/genai": "^1.10.0",
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export * from './subsystems/IO/Router.service/connectors/ExpressRouter.class';
export * from './subsystems/IO/Router.service/connectors/NullRouter.class';
export * from './subsystems/IO/Storage.service/connectors/LocalStorage.class';
export * from './subsystems/IO/Storage.service/connectors/S3Storage.class';
export * from './subsystems/IO/Storage.service/connectors/AzureBlobStorage.class'
export * from './subsystems/IO/VectorDB.service/connectors/MilvusVectorDB.class';
export * from './subsystems/IO/VectorDB.service/connectors/PineconeVectorDB.class';
export * from './subsystems/IO/VectorDB.service/connectors/RAMVecrtorDB.class';
Expand Down
Loading