What is a Component?
A component is compiled code with a typed interface. You write it in a supported language (TypeScript, Python, Rust, Go, etc.), define its interface, and asterai compiles it to a portable format that runs in any asterai environment. Components can:- π€ Export functions for other components or AI agents to call
- π₯ Import and use other components
- π Access asteraiβs built-in capabilities (HTTP, storage, LLM calls)
Component Interface
Every component has an interface defined in WIT (WebAssembly Interface Types). This defines what functions your component exports and what types it uses. Example interface for a burger ordering tool:- Package: Your namespace, component name, and version
- Imports: Capabilities your component needs (here, the asterai host API)
- Exports: Functions your component provides
- Types: Data structures used by your functions
π Composability: Interfaces vs World Exports
If you want other components to be able to call your componentβs functions, you must put those functions inside a named interface. Functions exported directly at the world level (bare exports) can only be called by the host runtime, not by other components. What this means is that these functions can only be called externally, e.g. from other environments via the asterai API. β Not composable β only the host can callorder-burger:
your-username:burger-shop/api:
Component Implementation
The implementation is your actual code. Hereβs the TypeScript implementation for the interface above:π·οΈ Versioning
Components use semantic versioning. Each published version is immutableβyou canβt overwrite an existing version. This ensures reproducible builds and reliable dependencies.π Next Steps
- Hello World guide: Create and deploy your first component
- CLI reference: Learn the asterai CLI commands
- Registry: Publish and discover components