Skip to main content

tycode_core/steering/
autonomy.rs

1use crate::agents::defaults::get_autonomy_instructions;
2use crate::module::{PromptComponent, PromptComponentId};
3use crate::settings::config::{AutonomyLevel, Settings};
4
5pub const ID: PromptComponentId = PromptComponentId("autonomy");
6
7/// Provides autonomy-level instructions for the system prompt.
8pub struct AutonomyComponent {
9    level: AutonomyLevel,
10}
11
12impl AutonomyComponent {
13    pub fn new(level: AutonomyLevel) -> Self {
14        Self { level }
15    }
16}
17
18impl PromptComponent for AutonomyComponent {
19    fn id(&self) -> PromptComponentId {
20        ID
21    }
22
23    fn build_prompt_section(&self, _settings: &Settings) -> Option<String> {
24        Some(get_autonomy_instructions(self.level).to_string())
25    }
26}