SRE Components Reference
The SmythOS Runtime Environment (SRE) provides a library of production-ready components.
Components are the building blocks of AI agents. Each encapsulates a reusable function, such as prompting an LLM, filtering JSON, or exposing an API endpoint.
How to use components
AI & LLM Components
Work with large language models and multimodal features.
GenAILLM
— Unified interface for LLMs (OpenAI, Anthropic, Google, etc.)LLMAssistant
— Multi-turn conversationVisionLLM
— Image analysisMultimodalLLM
— Text, image, and audioHuggingFace
— Use Hugging Face-hosted modelsImageGenerator
— Text-to-image
Example: prompt and stream responses
{`import { Agent, TLLMEvent } from '@smythos/sdk';
const agent = new Agent({ name: 'LLM Demo', model: 'gpt-4o' });
const llm = agent.llm.OpenAI('gpt-4o');
// One-shot prompt
const answer = await llm.prompt('Who wrote The Great Gatsby?');
console.log(answer);
// Stream tokens
const stream = await llm.prompt('Stream this response.').stream();
stream.on(TLLMEvent.Content, (chunk) => process.stdout.write(chunk));
`}
External Integrations
Connect to web data and APIs.
APICall
— HTTP requests with headers and OAuthWebSearch
— Real-time searchWebScrape
— Extract site contentZapierAction
— Trigger automationsMCPClient
— Model Context Protocol client
When to use
Data Processing
Filter, clean, and prepare data.
Classifier
— Categorize into classesJSONFilter
— Extract or reshape JSONDataSourceIndexer
— Index documentsDataSourceLookup
— Retrieve from an indexDataSourceCleaner
— Normalize inputs
Example: parse documents
{`import { Doc } from '@smythos/sdk';
// Auto-detect parser by file type
const parsed = await Doc.auto.parse('./files/report.pdf');
// Or specify explicitly
const pdf = await Doc.pdf.parse('./files/report.pdf');
const md = await Doc.md.parse('./files/notes.md');
`}
Logic & Control Flow
Shape how workflows run.
LogicAND
,LogicOR
,LogicXOR
— Boolean logicLogicAtLeast
,LogicAtMost
— Threshold branchingForEach
— Iterate over listsAsync
,Await
— Run steps in parallel and then join
Design tip
Storage & File Operations
Work with files and code execution.
FileStore
— Read/write files (local or S3)Code
— Execute inline codeServerlessCode
— Run serverless functions
Example: local and S3 storage
{`import { Agent } from '@smythos/sdk';
const agent = new Agent({ name: 'Storage Demo', model: 'gpt-4o' });
// Local storage
const local = agent.storage.LocalStorage();
await local.write('hello.txt', 'Hello world');
const data = await local.read('hello.txt');
// S3 storage
const s3 = agent.storage.S3({
bucket: 'my-bucket',
region: 'us-east-1'
});
`}
Vector Databases
Embed, index, and search data.
- Pinecone
- Milvus
- RAMVec (in-memory)
Example: Pinecone search
{`import { Agent, Model } from '@smythos/sdk';
const agent = new Agent({ name: 'Vector Demo', model: 'gpt-4o' });
const pinecone = agent.vectorDB.Pinecone('my-namespace', {
indexName: 'my-index',
apiKey: process.env.PINECONE_API_KEY,
embeddings: Model.OpenAI('text-embedding-3-large'),
});
await pinecone.insertDoc('doc-1', 'Some text to index');
const results = await pinecone.search('Find similar content');
console.log(results);
`}
System Integration
Expose agents across protocols and services.
APIEndpoint
— Create custom HTTP endpointsComputerUse
— Automate system tasksGPTPlugin
— OpenAI plugin format- MCP transport — Run agent as an MCP server
Example: run as MCP
{`import { Agent, MCPTransport } from '@smythos/sdk';
const agent = new Agent({ name: 'MCP Demo', model: 'gpt-4o' });
// STDIO
await agent.mcp(MCPTransport.STDIO);
// Or SSE
const url = await agent.mcp(MCPTransport.SSE, 3388);
console.log('MCP listening at', url);
`}
Quick Reference
A condensed table for fast scanning.
Category | Components | What they do |
---|---|---|
AI & LLM | GenAILLM , LLMAssistant , VisionLLM , MultimodalLLM , HuggingFace , ImageGenerator | Prompting and multimodal |
External | APICall , WebSearch , WebScrape , ZapierAction , MCPClient | APIs and integrations |
Data | Classifier , JSONFilter , DataSourceIndexer , DataSourceLookup , DataSourceCleaner | Clean, transform, search |
Logic | LogicAND , LogicOR , LogicXOR , LogicAtLeast , LogicAtMost , ForEach , Async , Await | Control flow |
Storage | FileStore , Code , ServerlessCode | Files and compute |
VectorDB | Pinecone, Milvus, RAMVec | Embedding storage/search |
System | APIEndpoint , ComputerUse , GPTPlugin , MCP | Integrations and protocols |
What’s Next?
- Recipes — Combine components into workflows
- Building Agents — Full workflow design
- SDK Guide — Programmatic usage
- Architecture — Runtime internals