| layout | title | permalink |
|---|---|---|
page |
Examples |
/examples/ |
Explore real-world examples of SigmOS in action. Each example demonstrates different aspects of the language and showcases how to build intelligent, reactive systems.
A simple AI agent with personality and conversation capabilities.
spec "Agent" v1.0 {
description: "Defines an AI Agent with LLM prompt capabilities."
inputs:
name: string
tone: enum("friendly", "hostile")
api_key: string { secret: true }
computed:
greeting: -> "Hello, I'm {{name}}, and I'm {{tone}}."
events:
on_message: trigger {
when: input.message != null
action: respond
}
actions:
respond: prompt {
system: "You are {{name}} with a {{tone}} personality."
user: "{{input.message}}"
model: "gpt-4"
}
}
An AI-powered content generation and validation pipeline.
spec "ContentPipeline" v1.0 {
description: "AI-powered content generation with validation"
inputs:
topic: string
target_audience: enum("technical", "general", "academic")
content_type: enum("blog", "documentation", "tutorial")
computed:
content_prompt: -> "Write a {{content_type}} about {{topic}} for {{target_audience}} audience"
actions:
generate: prompt {
system: "You are an expert content creator."
user: "{{content_prompt}}"
model: "gpt-4"
}
validate: prompt {
system: "Review this content for quality and accuracy."
user: "Content: {{actions.generate.result}}"
model: "gpt-4"
}
}
Patient data processing, medical record analysis, and treatment recommendation systems.
View Examples →Risk assessment, fraud detection, and automated trading systems with AI-powered decision making.
View Examples →Product recommendations, inventory management, and customer service automation.
View Examples →Quality control, predictive maintenance, and supply chain optimization systems.
View Examples →Traffic management, energy optimization, and citizen service automation.
View Examples →Complete user lifecycle management with validation and security.
spec "UserManagement" v1.0 {
description: "Complete user lifecycle management system"
types:
User: struct {
id: string
email: string
role: enum("admin", "user", "guest")
created_at: string
permissions: list<string>
}
inputs:
action: enum("create", "update", "delete", "authenticate")
user_data: User { optional: true }
credentials: struct {
email: string
password: string { secret: true }
} { optional: true }
constraints:
valid_email: user_data.email ~= /^[^\s@]+@[^\s@]+\.[^\s@]+$/
strong_password: len(credentials.password) >= 8
events:
on_create: trigger {
when: input.action == "create"
action: create_user
}
on_auth: trigger {
when: input.action == "authenticate"
action: authenticate_user
}
actions:
create_user: block {
validate_input: -> constraints.valid_email && user_data.role != null
hash_password: -> hash(credentials.password)
store_user: rest.post("/api/users", user_data)
}
authenticate_user: block {
verify_credentials: rest.post("/api/auth", credentials)
generate_token: -> jwt.sign(verify_credentials.user_id)
}
}
- Start Simple: Begin with the basic Agent example
- Add Complexity: Explore the Content Pipeline
- Industry Focus: Choose an industry example that matches your domain
- Advanced Patterns: Study the User Management system
# Clone the repository
git clone https://github.com/copyleftdev/sigmos.git
cd sigmos
# Run any example
sigmos run examples/agent.sigmos
# Run with custom inputs
sigmos run examples/agent.sigmos --input name="Alice" --input tone="friendly"
# Validate an example
sigmos validate examples/user-management.sigmos- User Guide - Learn the language fundamentals
- Developer Guide - Build and extend SigmOS
- API Reference - Complete language reference