Expand description
Skill execution context management.
This crate provides types and utilities for defining and managing execution contexts for skill-engine skills. An execution context defines the complete environment in which a skill’s tools execute, including:
- File and directory mounts
- Environment variables
- Secrets and credentials
- Resource limits (CPU, memory, network)
- Runtime-specific overrides
§Core Concepts
§Execution Context
An ExecutionContext is the central type that combines all configuration
needed to run a skill. Contexts can inherit from other contexts, allowing
for a hierarchy of configurations (e.g., base → development → production).
use skill_context::{ExecutionContext, EnvironmentConfig, ResourceConfig};
let context = ExecutionContext::new("my-context", "My Context")
.with_description("A production context")
.with_environment(
EnvironmentConfig::new()
.with_var("LOG_LEVEL", "info")
.with_passthrough_prefix("AWS_")
)
.with_resources(
ResourceConfig::new()
.with_memory_limit("1g")
.with_network_enabled()
.with_timeout(300)
)
.with_tag("production");§Mounts
Mounts define files and directories that should be accessible
within the execution environment:
use skill_context::Mount;
let data_mount = Mount::directory("data", "/host/data", "/app/data")
.as_read_write()
.with_description("Application data directory");
let config_mount = Mount::config_file(
"app-config",
r#"
[api]
endpoint = "${API_ENDPOINT}"
"#,
"/etc/app/config.toml"
);§Secrets
The SecretsConfig type manages secret definitions and providers:
use skill_context::{SecretsConfig, SecretDefinition};
let secrets = SecretsConfig::new()
.with_required_env_secret("api-key", "API_KEY", "API authentication key")
.with_required_file_secret("db-password", "/run/secrets/db", "Database password");§Resources
ResourceConfig defines limits and capabilities:
use skill_context::{ResourceConfig, NetworkConfig};
let resources = ResourceConfig::new()
.with_cpu_limit("2")
.with_memory_limit("1g")
.with_network(
NetworkConfig::enabled()
.allow_host("api.example.com")
.allow_host("*.amazonaws.com")
)
.with_timeout(300);§Features
vault- Enable HashiCorp Vault secret provideraws-secrets- Enable AWS Secrets Manager providerazure-keyvault- Enable Azure Key Vault providergcp-secrets- Enable GCP Secret Manager provider
Re-exports§
pub use context::ContextMetadata;pub use context::ExecutionContext;pub use environment::EnvFileRef;pub use environment::EnvValue;pub use environment::EnvironmentConfig;pub use environment::GeneratedValue;pub use environment::SecretRef;pub use mounts::Mount;pub use mounts::MountType;pub use resources::CpuConfig;pub use resources::ExecutionLimits;pub use resources::FilesystemConfig;pub use resources::MemoryConfig;pub use resources::NetworkConfig;pub use resources::RateLimit;pub use resources::ResourceConfig;pub use runtime::DockerOverrides;pub use runtime::NativeOverrides;pub use runtime::RuntimeOverrides;pub use runtime::WasmOverrides;pub use secrets::ExternalSecretProvider;pub use secrets::SecretDefinition;pub use secrets::SecretFileFormat;pub use secrets::SecretInjectionTarget;pub use secrets::SecretProviderConfig;pub use secrets::SecretsConfig;pub use inheritance::merge_environments;pub use inheritance::merge_mounts;pub use inheritance::merge_resources;pub use inheritance::merge_secrets;pub use inheritance::resolve_context;pub use inheritance::ContextResolver;pub use storage::BackupInfo;pub use storage::ContextIndex;pub use storage::ContextIndexEntry;pub use storage::ContextStorage;pub use providers::EnvironmentProvider;pub use providers::FileProvider;pub use providers::KeychainProvider;pub use providers::SecretManager;pub use providers::SecretProvider;pub use providers::SecretValue;pub use error::ContextError;
Modules§
- context
- Core execution context types.
- environment
- Environment variable configuration types.
- error
- Error types for the skill-context crate.
- inheritance
- Context inheritance and resolution logic.
- mounts
- Mount configuration types.
- providers
- Secret provider implementations.
- resources
- Resource configuration types.
- runtime
- Runtime-specific override types.
- secrets
- Secrets configuration types.
- storage
- Context storage and persistence.
Type Aliases§
- Result
- Result type for context operations.