1"""

2 Config Presets — Ready-to-use configuration profiles for common AgentOS scenarios.

3

4 Each preset provides sensible defaults for specific use cases:

5 development, production, testing, and budget-constrained environments.

6"""

7

8 from __future__ import annotations

9

10 from dataclasses import dataclass, field

11 from typing import Optional

12

13

14@dataclass

15 class AgentOSPreset:

16 """A named preset configuration for AgentOS."""

17

18 name: str

19 description: str

20 model: str = "gpt-4o-mini"

21 max_iterations: int = 10

22 temperature: float = 0.7

23 enable_cache: bool = True

24 enable_rate_limit: bool = True

25 enable_guardrails: bool = False

26 enable_streaming: bool = False

27 enable_cost_tracking: bool = True

28 memory_window_size: int = 20

29 max_retries: int = 3

30 log_level: str = "INFO"

31

32

33 PRESETS: dict[str, AgentOSPreset] = {

34 "development": AgentOSPreset(

35 name="development",

36 description="Local development with verbose logging, guardrails disabled, and GPT-4o-mini for fast iteration.",

37 model="gpt-4o-mini",

38 max_iterations=15,

39 temperature=0.8,

40 enable_cache=True,

41 enable_rate_limit=False,

42 enable_guardrails=False,

43 enable_streaming=True,

44 enable_cost_tracking=True,

45 memory_window_size=30,

46 max_retries=2,

47 log_level="DEBUG",

48 ),

49 "production": AgentOSPreset(

50 name="production",

51 description="Production deployment with guardrails, rate limiting, and cost tracking. Uses GPT-4o for reliability.",

52 model="gpt-4o",

53 max_iterations=20,

54 temperature=0.3,

55 enable_cache=True,

56 enable_rate_limit=True,

57 enable_guardrails=True,

58 enable_streaming=False,

59 enable_cost_tracking=True,

60 memory_window_size=50,

61 max_retries=5,

62 log_level="WARNING",

63 ),

64 "testing": AgentOSPreset(

65 name="testing",

66 description="Testing environment with determinism (temperature=0), guardrails off, and mock-friendly settings.",

67 model="gpt-4o-mini",

68 max_iterations=5,

69 temperature=0.0,

70 enable_cache=False,

71 enable_rate_limit=False,

72 enable_guardrails=False,

73 enable_streaming=False,

74 enable_cost_tracking=False,

75 memory_window_size=10,

76 max_retries=1,

77 log_level="ERROR",

78 ),

79 "budget": AgentOSPreset(

80 name="budget",

81 description="Cost-optimized: GPT-4o-mini, minimal iterations, aggressive caching, rate limits enabled.",

82 model="gpt-4o-mini",

83 max_iterations=5,

84 temperature=0.5,

85 enable_cache=True,

86 enable_rate_limit=True,

87 enable_guardrails=True,

88 enable_streaming=False,

89 enable_cost_tracking=True,

90 memory_window_size=10,

91 max_retries=2,

92 log_level="WARNING",

93 ),

94 "creative": AgentOSPreset(

95 name="creative",

96 description="Creative mode: high temperature, streaming, Claude 3.5 Sonnet for nuanced output.",

97 model="claude-3.5-sonnet",

98 max_iterations=12,

99 temperature=0.95,

100 enable_cache=True,

101 enable_rate_limit=False,

102 enable_guardrails=False,

103 enable_streaming=True,

104 enable_cost_tracking=True,

105 memory_window_size=25,

106 max_retries=3,

107 log_level="INFO",

108 ),

109 "deep_research": AgentOSPreset(

110 name="deep_research",

111 description="Deep research: Claude 3 Opus, many iterations, large memory window, guardrails off for exploration.",

112 model="claude-3-opus",

113 max_iterations=30,

114 temperature=0.4,

115 enable_cache=True,

116 enable_rate_limit=True,

117 enable_guardrails=False,

118 enable_streaming=False,

119 enable_cost_tracking=True,

120 memory_window_size=80,

121 max_retries=5,

122 log_level="INFO",

123 ),

124 "gemini_fast": AgentOSPreset(

125 name="gemini_fast",

126 description="High-speed: Gemini 2.0 Flash, many iterations, streaming enabled, minimal cost.",

127 model="gemini-2.0-flash",

128 max_iterations=25,

129 temperature=0.7,

130 enable_cache=True,

131 enable_rate_limit=True,

132 enable_guardrails=True,

133 enable_streaming=True,

134 enable_cost_tracking=True,

135 memory_window_size=40,

136 max_retries=4,

137 log_level="INFO",

138 ),

139 "gemini_pro": AgentOSPreset(

140 name="gemini_pro",

141 description="Gemini Pro with 2M context: massive memory window, guardrails enabled, streaming.",

142 model="gemini-1.5-pro",

143 max_iterations=20,

144 temperature=0.5,

145 enable_cache=True,

146 enable_rate_limit=True,

147 enable_guardrails=True,

148 enable_streaming=True,

149 enable_cost_tracking=True,

150 memory_window_size=100,

151 max_retries=4,

152 log_level="INFO",

153 ),

154}

155

156

157 def get_preset(name: str) -> Optional[AgentOSPreset]:

158 """Get a preset by name. Returns None if not found."""

159 return PRESETS.get(name.lower())

160

161

162 def list_presets() -> list[AgentOSPreset]:

163 """List all available presets."""

164 return list(PRESETS.values())

165

166

167 def get_preset_names() -> list[str]:

168 """List all preset names."""

169 return list(PRESETS.keys())

170

171

172 def apply_preset(preset_name: str, config: dict) -> dict:

173 """

174 Apply a preset to an existing config dict.

175

176 Only overrides keys present in the preset; preserves all other keys.

177

178 Args:

179 preset_name: Name of the preset to apply.

180 config: Existing configuration dict.

181

182 Returns:

183 Updated configuration dict.

184 """

185 preset = get_preset(preset_name)

186 if not preset:

187 raise ValueError(

188 f"Unknown preset: '{preset_name}'. Available: {list(PRESETS.keys())}"

189 )

190

191 mapping = {

192 "model": "model",

193 "max_iterations": "max_iterations",

194 "temperature": "temperature",

195 "enable_cache": "enable_cache",

196 "enable_rate_limit": "enable_rate_limit",

197 "enable_guardrails": "enable_guardrails",

198 "enable_streaming": "enable_streaming",

199 "enable_cost_tracking": "enable_cost_tracking",

200 "memory_window_size": "memory_window_size",

201 "max_retries": "max_retries",

202 "log_level": "log_level",

203 }

204

205 for preset_key, config_key in mapping.items():

206 config[config_key] = getattr(preset, preset_key)

207

208 return config