tinyagent-py 0.0.15__tar.gz → 0.0.16__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/PKG-INFO +25 -1
  2. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/README.md +24 -0
  3. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/pyproject.toml +1 -1
  4. tinyagent_py-0.0.16/tinyagent/code_agent/providers/__init__.py +17 -0
  5. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/code_agent/providers/base.py +29 -1
  6. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/code_agent/providers/modal_provider.py +9 -0
  7. tinyagent_py-0.0.16/tinyagent/code_agent/providers/seatbelt_provider.py +1065 -0
  8. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/code_agent/tiny_code_agent.py +674 -5
  9. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/code_agent/utils.py +187 -22
  10. tinyagent_py-0.0.16/tinyagent/prompts/truncation.yaml +13 -0
  11. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/tiny_agent.py +402 -49
  12. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent_py.egg-info/PKG-INFO +25 -1
  13. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent_py.egg-info/SOURCES.txt +2 -0
  14. tinyagent_py-0.0.15/tinyagent/code_agent/providers/__init__.py +0 -4
  15. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/LICENSE +0 -0
  16. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/setup.cfg +0 -0
  17. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/__init__.py +0 -0
  18. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/code_agent/__init__.py +0 -0
  19. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/code_agent/example.py +0 -0
  20. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/code_agent/helper.py +0 -0
  21. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/code_agent/modal_sandbox.py +0 -0
  22. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/code_agent/safety.py +0 -0
  23. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/code_agent/tools/__init__.py +0 -0
  24. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/code_agent/tools/example_tools.py +0 -0
  25. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/hooks/__init__.py +0 -0
  26. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/hooks/gradio_callback.py +0 -0
  27. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/hooks/jupyter_notebook_callback.py +0 -0
  28. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/hooks/logging_manager.py +0 -0
  29. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/hooks/rich_code_ui_callback.py +0 -0
  30. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/hooks/rich_ui_callback.py +0 -0
  31. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/hooks/token_tracker.py +0 -0
  32. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/mcp_client.py +0 -0
  33. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/memory_manager.py +0 -0
  34. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/prompts/code_agent.yaml +0 -0
  35. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/prompts/summarize.yaml +0 -0
  36. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/storage/__init__.py +0 -0
  37. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/storage/base.py +0 -0
  38. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/storage/json_file_storage.py +0 -0
  39. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/storage/postgres_storage.py +0 -0
  40. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/storage/redis_storage.py +0 -0
  41. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent/storage/sqlite_storage.py +0 -0
  42. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent_py.egg-info/dependency_links.txt +0 -0
  43. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent_py.egg-info/requires.txt +0 -0
  44. {tinyagent_py-0.0.15 → tinyagent_py-0.0.16}/tinyagent_py.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinyagent-py
3
- Version: 0.0.15
3
+ Version: 0.0.16
4
4
  Summary: TinyAgent with MCP Client, Code Agent (Thinking, Planning, and Executing in Python), and Extendable Hooks, Tiny but powerful
5
5
  Author-email: Mahdi Golchin <golchin@askdev.ai>
6
6
  Project-URL: Homepage, https://github.com/askbudi/tinyagent
@@ -274,6 +274,30 @@ agent = TinyCodeAgent(
274
274
  )
275
275
  ```
276
276
 
277
+ ### Automatic Git Checkpoints
278
+
279
+ TinyCodeAgent can automatically create Git checkpoints after each successful shell command execution. This helps track changes made by the agent and provides a safety net for reverting changes if needed.
280
+
281
+ ```python
282
+ # Enable automatic Git checkpoints during initialization
283
+ agent = TinyCodeAgent(
284
+ model="gpt-4.1-mini",
285
+ auto_git_checkpoint=True # Enable automatic Git checkpoints
286
+ )
287
+
288
+ # Or enable/disable it later
289
+ agent.enable_auto_git_checkpoint(True) # Enable
290
+ agent.enable_auto_git_checkpoint(False) # Disable
291
+
292
+ # Check current status
293
+ is_enabled = agent.get_auto_git_checkpoint_status()
294
+ ```
295
+
296
+ Each checkpoint includes:
297
+ - Descriptive commit message with the command description
298
+ - Timestamp of when the command was executed
299
+ - The actual command that was run
300
+
277
301
  For detailed documentation, see the [TinyCodeAgent README](tinyagent/code_agent/README.md).
278
302
 
279
303
  ## How the TinyAgent Hook System Works
@@ -232,6 +232,30 @@ agent = TinyCodeAgent(
232
232
  )
233
233
  ```
234
234
 
235
+ ### Automatic Git Checkpoints
236
+
237
+ TinyCodeAgent can automatically create Git checkpoints after each successful shell command execution. This helps track changes made by the agent and provides a safety net for reverting changes if needed.
238
+
239
+ ```python
240
+ # Enable automatic Git checkpoints during initialization
241
+ agent = TinyCodeAgent(
242
+ model="gpt-4.1-mini",
243
+ auto_git_checkpoint=True # Enable automatic Git checkpoints
244
+ )
245
+
246
+ # Or enable/disable it later
247
+ agent.enable_auto_git_checkpoint(True) # Enable
248
+ agent.enable_auto_git_checkpoint(False) # Disable
249
+
250
+ # Check current status
251
+ is_enabled = agent.get_auto_git_checkpoint_status()
252
+ ```
253
+
254
+ Each checkpoint includes:
255
+ - Descriptive commit message with the command description
256
+ - Timestamp of when the command was executed
257
+ - The actual command that was run
258
+
235
259
  For detailed documentation, see the [TinyCodeAgent README](tinyagent/code_agent/README.md).
236
260
 
237
261
  ## How the TinyAgent Hook System Works
@@ -12,7 +12,7 @@ tinyagent = ["prompts/*.yaml"]
12
12
 
13
13
  [project]
14
14
  name = "tinyagent-py"
15
- version = "0.0.15"
15
+ version = "0.0.16"
16
16
  description = "TinyAgent with MCP Client, Code Agent (Thinking, Planning, and Executing in Python), and Extendable Hooks, Tiny but powerful"
17
17
  readme = "README.md"
18
18
  authors = [
@@ -0,0 +1,17 @@
1
+ from .base import CodeExecutionProvider
2
+ from .modal_provider import ModalProvider
3
+
4
+ # Import SeatbeltProvider conditionally to avoid errors on non-macOS systems
5
+ import platform
6
+ if platform.system() == "Darwin":
7
+ try:
8
+ from .seatbelt_provider import SeatbeltProvider
9
+ except ImportError:
10
+ # If there's an issue importing, just don't make it available
11
+ pass
12
+
13
+ __all__ = ["CodeExecutionProvider", "ModalProvider"]
14
+
15
+ # Add SeatbeltProvider to __all__ if it was successfully imported
16
+ if platform.system() == "Darwin" and "SeatbeltProvider" in globals():
17
+ __all__.append("SeatbeltProvider")
@@ -21,6 +21,9 @@ class CodeExecutionProvider(ABC):
21
21
  pip_packages: List[str] = None,
22
22
  secrets: Dict[str, Any] = None,
23
23
  lazy_init: bool = True,
24
+ bypass_shell_safety: bool = False,
25
+ additional_safe_shell_commands: Optional[List[str]] = None,
26
+ additional_safe_control_operators: Optional[List[str]] = None,
24
27
  **kwargs
25
28
  ):
26
29
  self.log_manager = log_manager
@@ -35,15 +38,36 @@ class CodeExecutionProvider(ABC):
35
38
  self._locals_dict = kwargs.get("locals_dict", {})
36
39
  self._user_variables = {}
37
40
  self.code_tools_definitions = []
41
+
42
+ # Shell safety configuration
43
+ self.bypass_shell_safety = bypass_shell_safety
44
+
38
45
  # Safe shell commands that don't modify the system or access sensitive data
39
46
  self.safe_shell_commands: Set[str] = {
40
47
  "ls", "cat", "grep", "find", "echo", "pwd", "whoami", "date",
41
48
  "head", "tail", "wc", "sort", "uniq", "tr", "cut", "sed", "awk",
42
- "ps", "df", "du", "uname", "which", "type", "file", "stat","rg","if",
49
+ "ps", "df", "du", "uname", "which", "type", "file", "stat", "rg", "if",
43
50
  "tree"
44
51
  }
52
+
53
+ # Add additional safe shell commands if provided
54
+ if additional_safe_shell_commands:
55
+ if "*" in additional_safe_shell_commands:
56
+ # If wildcard is provided, allow all commands (effectively bypassing the check)
57
+ self.bypass_shell_safety = True
58
+ else:
59
+ self.safe_shell_commands.update(additional_safe_shell_commands)
60
+
45
61
  # Safe control operators for shell commands
46
62
  self.safe_control_operators: Set[str] = {"&&", "||", ";", "|"}
63
+
64
+ # Add additional safe control operators if provided
65
+ if additional_safe_control_operators:
66
+ if "*" in additional_safe_control_operators:
67
+ # If wildcard is provided, allow all operators
68
+ self.safe_control_operators = set("*")
69
+ else:
70
+ self.safe_control_operators.update(additional_safe_control_operators)
47
71
 
48
72
  @abstractmethod
49
73
  async def execute_python(
@@ -102,6 +126,10 @@ class CodeExecutionProvider(ABC):
102
126
  - safe: Boolean indicating if command is safe
103
127
  - reason: Reason why command is not safe (if applicable)
104
128
  """
129
+ # If shell safety checks are bypassed, consider all commands safe
130
+ if self.bypass_shell_safety:
131
+ return {"safe": True}
132
+
105
133
  if type(command) == str:
106
134
  command = command.split(" ")
107
135
  if not command or not isinstance(command, list) or len(command) == 0:
@@ -47,6 +47,9 @@ class ModalProvider(CodeExecutionProvider):
47
47
  sandbox_name: str = "tinycodeagent-sandbox",
48
48
  local_execution: bool = False,
49
49
  check_string_obfuscation: bool = True,
50
+ bypass_shell_safety: bool = False, # Default to False for ModalProvider
51
+ additional_safe_shell_commands: Optional[List[str]] = None,
52
+ additional_safe_control_operators: Optional[List[str]] = None,
50
53
  **kwargs
51
54
  ):
52
55
  """
@@ -67,6 +70,9 @@ class ModalProvider(CodeExecutionProvider):
67
70
  sandbox_name: Name of the Modal sandbox
68
71
  local_execution: Whether to execute code locally
69
72
  check_string_obfuscation: If True (default), check for string obfuscation techniques. Set to False to allow legitimate use of base64 encoding and other string manipulations.
73
+ bypass_shell_safety: If True, bypass shell command safety checks (default: False for modal)
74
+ additional_safe_shell_commands: Additional shell commands to consider safe
75
+ additional_safe_control_operators: Additional shell control operators to consider safe
70
76
  **kwargs: Additional keyword arguments
71
77
 
72
78
  Note:
@@ -114,6 +120,9 @@ class ModalProvider(CodeExecutionProvider):
114
120
  pip_packages=final_packages,
115
121
  secrets=modal_secrets or {},
116
122
  lazy_init=lazy_init,
123
+ bypass_shell_safety=bypass_shell_safety,
124
+ additional_safe_shell_commands=additional_safe_shell_commands,
125
+ additional_safe_control_operators=additional_safe_control_operators,
117
126
  **kwargs
118
127
  )
119
128