@@ -15,11 +15,51 @@ class Agents:
1515
1616 @staticmethod
1717 def _add_el (parent , name : str , value ) -> None :
18+ """
19+ Helper to add a sub-element with a value if the value is not None.
20+
21+ Args:
22+ parent: The XML parent element to which the new element is added.
23+ name: Name of the sub-element to create.
24+ value: Value to set as the text of the sub-element. If None, the
25+ element will not be created.
26+ """
1827 if value is not None :
1928 parent .add_element (name , str (value ))
2029
2130 @classmethod
2231 def _append_agent_config (cls , parent , config : Mapping [str , Any ]) -> None :
32+ """
33+ Append an agent configuration block to the given XML parent element.
34+
35+ Expected config structure::
36+
37+ {
38+ "agent_control": {
39+ "retry": {
40+ "attempts": 6,
41+ "delay_in_seconds": 60,
42+ "max_jitter_in_seconds": 10
43+ }
44+ },
45+ "agent_script_executor": {
46+ "bulk_size": 2,
47+ "bulk_throttle_time_in_ms": 300,
48+ "indexer_dir_depth": 100,
49+ "scheduler_cron_time": ["0 */12 * * *"]
50+ },
51+ "heartbeat": {
52+ "interval_in_seconds": 300,
53+ "miss_until_inactive": 1
54+ }
55+ }
56+
57+ Args:
58+ parent: The XML parent element to which the `<config>` element
59+ should be appended.
60+ config: Mapping containing the agent configuration fields to
61+ serialize.
62+ """
2363 xml_config = parent .add_element ("config" )
2464
2565 # agent_control.retry
@@ -101,10 +141,10 @@ def modify_agents(
101141 Args:
102142 agent_ids: List of agent UUIDs to modify.
103143 authorized: Whether the agent is authorized.
104- config: Nested config matching the new schema , e.g.:
144+ config: Nested config, e.g.:
105145 {
106146 "agent_control": {
107- "retry": {
147+ "retry": {
108148 "attempts": 6,
109149 "delay_in_seconds": 60,
110150 "max_jitter_in_seconds": 10,
@@ -114,7 +154,7 @@ def modify_agents(
114154 "bulk_size": 2,
115155 "bulk_throttle_time_in_ms": 300,
116156 "indexer_dir_depth": 100,
117- "scheduler_cron_time": ["0 */12 * * *"], # list[str]
157+ "scheduler_cron_time": ["0 */12 * * *"], # str or list[str]
118158 },
119159 "heartbeat": {
120160 "interval_in_seconds": 300,
@@ -196,8 +236,6 @@ def modify_agent_control_scan_config(
196236 "miss_until_inactive": 1,
197237 },
198238 }
199- Returns:
200- Request: Prepared XML command.
201239 """
202240 if not agent_control_id :
203241 raise RequiredArgument (
0 commit comments