Building Agents with SRE
The SmythOS Runtime Environment (SRE) supports multiple ways to build and run agents. You can work visually in Studio, write agents with the SDK, or manage projects using the CLI. All three connect to the same runtime, so you can move between them without changing platforms.
Choosing a Workflow
Method | Best for | What it offers |
---|---|---|
Studio | Non-developers, rapid iteration, collaborative teams | Drag and drop components, test in browser, share with teammates |
SDK | Developers, automation, CI/CD pipelines | Type-safe workflows in TypeScript, custom logic, programmatic testing |
CLI | Scripting, project setup, running Studio exports | Scaffold new projects, run .smyth files locally, integrate with build pipelines |
Building with Studio
Studio is the fastest way to get an agent running.
- Build workflows visually with components
- Test agents directly using chat, form preview, or API modes
- Collaborate by inviting others into a space
For a hands-on walkthrough, see the Studio Quickstart.
Building with the SDK
The SDK gives you full programmatic control in TypeScript.
Minimal example
{`import { Agent, Component } from '@smythos/sdk';
const agent = new Agent({ name: 'ClassifierAgent', model: 'gpt-4o' });
const llm = Component.GenAILLM({ model: 'gpt-4o' }, agent);
const classifier = Component.Classifier({ classes: ['positive', 'negative'] }, agent);
// Connect outputs
classifier.in({ Input: llm.out.Reply });
`}
- Define workflows as code and keep them version-controlled
- Add custom components or expose new skills
- Run tests locally or in CI/CD
Explore more in the SDK Guide and examples in the repo.
Building with the CLI
The CLI helps automate and bridge Studio and SDK workflows.
- Create new projects with
sre create
- Run Studio-exported
.smyth
files locally withsre run
- Add commands into
package.json
or pipeline scripts
See the CLI Guide and Getting Started for installation and setup.
Extending with Custom Components and Skills
Custom Components
Write reusable blocks by extending the Component
base class.
{`import { Component } from '@smythos/sdk';
export class Uppercase extends Component {
async process(input) {
return { result: input.toUpperCase() };
}
}
`}
Details are in the Component Reference.
Agent Skills
Expose functions that your agent can call directly.
{`agent.addSkill({
name: 'getWeather',
description: 'Return a simple weather forecast',
ai_exposed: true,
process: async (city) => ({ forecast: 'Sunny in ' + city })
});
`}
See more patterns in the SDK Guide.
Monitoring and Debugging
SRE provides built-in observability:
- Execution traces for every component
- Real-time logs via SSE streams
- Debug mode for step-through inspection
- Performance metrics such as tokens, memory, and latency
Monitoring is available both in Studio and in SDK projects. For internals, see the Runtime Overview.
Hybrid Workflows
You can combine approaches:
- Export a Studio workflow to extend it in the SDK
- Import an SDK-built agent into Studio for visualization and debugging
- Use Studio for orchestration and SDK for specialized custom logic
See the Hybrid Workflow Guide for concrete patterns.
Next Steps
- Start with the Studio Quickstart
- Learn the SRE Architecture
- Explore code in the SRE GitHub repo