Hi, I'm relatively new to wasm and the component model and have some questions.
Basically, what I want to do is have two (or more) components composed and run them using the wasmtime Rust crate. The goal is to have give each component access to different WASI capabilities (E.g., provide component 1 access only to file A and provide component B access only to file B).
So I guess there are a few parts to my question:
1- Does anyone have an example of composing and running multiple components using the wasmtime Rust crate?
2- How can I define WASI capabilities for each component?
3- Could this work with WAC? As in, compose components using the WAC language and then provide each component with separate WASI capabilities?
Thank you :)
The end goal, while theoretically possible, is not easily achievable at this moment. You're not the only one asking for this though, others have had use cases as well. Currently though it's only easy to give one set of WASI capabilities to a component. To give it two sets what you'd have to do is be able to compose the component such that two WASI imports are present rather than just one, and then for each set you'd give it access to different state.
Otherwise though for examples it's probably best to break your idea into individual steps and look for examples of those. For example with composition the wac
CLI and/or crates will likely help. For running components there should then be examples throughout Wasmtime.
Again though you won't find an example of composing two components and running with two different sets of WASI capabilities because that's not supported easily just yet
Last updated: Apr 07 2025 at 23:03 UTC