Skip to main content

synwire_agent/middleware/
environment.rs

1//! Environment middleware — exposes environment variable operations as agent tools.
2
3use synwire_core::agents::middleware::Middleware;
4use synwire_core::tools::Tool;
5
6/// Middleware that exposes environment variable operations to the agent.
7///
8/// Provides read access to environment variables and optionally write access
9/// for setting per-agent environment state.
10#[derive(Debug, Default)]
11pub struct EnvironmentMiddleware;
12
13impl Middleware for EnvironmentMiddleware {
14    fn name(&self) -> &'static str {
15        "environment"
16    }
17
18    fn tools(&self) -> Vec<Box<dyn Tool>> {
19        Vec::new()
20    }
21
22    fn system_prompt_additions(&self) -> Vec<String> {
23        vec![
24            "You have access to environment tools: get_env, set_env, list_env. \
25             Use get_env to read environment variable values, set_env to configure \
26             per-session variables, and list_env to enumerate available variables."
27                .to_string(),
28        ]
29    }
30}