A shell for your agent. Track state and history, multiple shells, and more.
[](https://github.com/AutonomousResearchGroup/agentshell/actions/workflows/test.yml)
[](https://badge.fury.io/py/agentshell)
# Installation
```bash
pip install agentshell
```
# Documentation
## `get_files_in_cwd(shell_id=None)`
Returns a list of files in the current directory of a specific shell. If `shell_id` is not specified, uses the current shell.
**Parameters:**
- `shell_id`: The unique identifier of the shell.
**Returns:**
- A list of filenames in the current directory.
## `get_current_shell()`
Returns the unique identifier of the current shell. If no shell is currently active, creates a new shell and returns its identifier.
**Returns:**
- The unique identifier of the current shell.
## `set_cwd(cwd, shell_id=None)`
Sets the current working directory of a specific shell. If `shell_id` is not specified, uses the current shell.
**Parameters:**
- `cwd`: The new current working directory.
- `shell_id`: The unique identifier of the shell.
## `set_current_shell(shell_id)`
Sets the current shell to the shell with the specified identifier.
**Parameters:**
- `shell_id`: The unique identifier of the shell to be made current.
## `get_history(shell_id=None, n_limit=20)`
Returns the command history of a specific shell. If `shell_id` is not specified, uses the current shell.
**Parameters:**
- `shell_id`: The unique identifier of the shell.
- `n_limit`: The maximum number of history entries to return.
**Returns:**
- A list of dictionaries, each representing a command and its result.
## `get_history_formatted(shell_id=None)`
Returns the command history of a specific shell in a human-readable format. If `shell_id` is not specified, uses the current shell.
**Parameters:**
- `shell_id`: The unique identifier of the shell.
**Returns:**
- The command history in human-readable format.
## `add_to_shell_history(shell_id, command, success, output, error=None)`
Adds a command and its result to the history of a specific shell.
**Parameters:**
- `shell_id`: The unique identifier of the shell.
- `command`: The command that was executed.
- `success`: Whether the command was successful.
- `output`: The output of the command.
- `error`: Any error messages produced by the command.
## `clear_history(shell_id)`
Clears the command history of a specific shell.
**Parameters:**
- `shell_id`: The unique identifier of the shell.
## `wipe_all()`
Clears all shell and shell history data.
## `list_active_shells()`
Returns a list of active shells.
**Returns:**
- A list of shell identifiers.
## `close_shell(shell_id)`
Closes a specific shell, clearing its history.
**Parameters:**
- `shell_id`: The unique identifier of the shell.
## `new_shell()`
Creates a new shell and returns its unique identifier.
**Returns:**
- The unique identifier of the new shell.
## `get_cwd(shell_id=None)`
Returns the current working directory of a specific shell. If `shell_id` is not specified, uses the current shell.
**Parameters:**
- `shell_id`: The unique identifier of the shell.
**Returns:**
- The current working directory of the shell.
## `run_command(command, shell_id=None)`
Runs a command in a specific shell and adds it to the shell's history. If `shell_id` is not specified, uses the current shell.
**Parameters:**
- `command`: The command to execute.
- `shell_id`: The unique identifier of the shell.
**Returns:**
- `True` if the command was successful, `False` otherwise.
# Contributions Welcome
If you like this library and want to contribute in any way, please feel free to submit a PR and I will review it. Please note that the goal here is simplicity and accesibility, using common language and few dependencies.
Raw data
{
"_id": null,
"home_page": "https://github.com/AutonomousResearchGroup/agentshell",
"name": "agentshell",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Moon",
"author_email": "shawmakesmagic@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f2/32/fa3dd1d19178908df7d1f9bb3fb15950dfd1460d826f99cbe16355f2b787/agentshell-0.0.7.tar.gz",
"platform": null,
"description": "\nA shell for your agent. Track state and history, multiple shells, and more.\n\n\n[](https://github.com/AutonomousResearchGroup/agentshell/actions/workflows/test.yml)\n[](https://badge.fury.io/py/agentshell)\n\n# Installation\n\n```bash\npip install agentshell\n```\n\n# Documentation\n\n## `get_files_in_cwd(shell_id=None)`\n\nReturns a list of files in the current directory of a specific shell. If `shell_id` is not specified, uses the current shell.\n\n**Parameters:**\n\n- `shell_id`: The unique identifier of the shell.\n\n**Returns:**\n\n- A list of filenames in the current directory.\n\n## `get_current_shell()`\n\nReturns the unique identifier of the current shell. If no shell is currently active, creates a new shell and returns its identifier.\n\n**Returns:**\n\n- The unique identifier of the current shell.\n\n## `set_cwd(cwd, shell_id=None)`\n\nSets the current working directory of a specific shell. If `shell_id` is not specified, uses the current shell.\n\n**Parameters:**\n\n- `cwd`: The new current working directory.\n- `shell_id`: The unique identifier of the shell.\n\n## `set_current_shell(shell_id)`\n\nSets the current shell to the shell with the specified identifier.\n\n**Parameters:**\n\n- `shell_id`: The unique identifier of the shell to be made current.\n\n## `get_history(shell_id=None, n_limit=20)`\n\nReturns the command history of a specific shell. If `shell_id` is not specified, uses the current shell.\n\n**Parameters:**\n\n- `shell_id`: The unique identifier of the shell.\n- `n_limit`: The maximum number of history entries to return.\n\n**Returns:**\n\n- A list of dictionaries, each representing a command and its result.\n\n## `get_history_formatted(shell_id=None)`\n\nReturns the command history of a specific shell in a human-readable format. If `shell_id` is not specified, uses the current shell.\n\n**Parameters:**\n\n- `shell_id`: The unique identifier of the shell.\n\n**Returns:**\n\n- The command history in human-readable format.\n\n## `add_to_shell_history(shell_id, command, success, output, error=None)`\n\nAdds a command and its result to the history of a specific shell.\n\n**Parameters:**\n\n- `shell_id`: The unique identifier of the shell.\n- `command`: The command that was executed.\n- `success`: Whether the command was successful.\n- `output`: The output of the command.\n- `error`: Any error messages produced by the command.\n\n## `clear_history(shell_id)`\n\nClears the command history of a specific shell.\n\n**Parameters:**\n\n- `shell_id`: The unique identifier of the shell.\n\n## `wipe_all()`\n\nClears all shell and shell history data.\n\n## `list_active_shells()`\n\nReturns a list of active shells.\n\n**Returns:**\n\n- A list of shell identifiers.\n\n## `close_shell(shell_id)`\n\nCloses a specific shell, clearing its history.\n\n**Parameters:**\n\n- `shell_id`: The unique identifier of the shell.\n\n## `new_shell()`\n\nCreates a new shell and returns its unique identifier.\n\n**Returns:**\n\n- The unique identifier of the new shell.\n\n## `get_cwd(shell_id=None)`\n\nReturns the current working directory of a specific shell. If `shell_id` is not specified, uses the current shell.\n\n**Parameters:**\n\n- `shell_id`: The unique identifier of the shell.\n\n**Returns:**\n\n- The current working directory of the shell.\n\n## `run_command(command, shell_id=None)`\n\nRuns a command in a specific shell and adds it to the shell's history. If `shell_id` is not specified, uses the current shell.\n\n**Parameters:**\n\n- `command`: The command to execute.\n- `shell_id`: The unique identifier of the shell.\n\n**Returns:**\n\n- `True` if the command was successful, `False` otherwise.\n\n# Contributions Welcome\n\nIf you like this library and want to contribute in any way, please feel free to submit a PR and I will review it. Please note that the goal here is simplicity and accesibility, using common language and few dependencies.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A shell for your agent.",
"version": "0.0.7",
"project_urls": {
"Homepage": "https://github.com/AutonomousResearchGroup/agentshell"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "181f263024dfa711beddf8ac35d0e96e912b6941400e98a42fe1cb093076d6b6",
"md5": "72a23f9209d7cf0941102d26cecdbc56",
"sha256": "cd2f751a0736031c64fc5ac96b1cd0e35eb90f3ff22e9fcf040a73aa0268ecf9"
},
"downloads": -1,
"filename": "agentshell-0.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "72a23f9209d7cf0941102d26cecdbc56",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6892,
"upload_time": "2023-08-01T23:28:32",
"upload_time_iso_8601": "2023-08-01T23:28:32.733727Z",
"url": "https://files.pythonhosted.org/packages/18/1f/263024dfa711beddf8ac35d0e96e912b6941400e98a42fe1cb093076d6b6/agentshell-0.0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f232fa3dd1d19178908df7d1f9bb3fb15950dfd1460d826f99cbe16355f2b787",
"md5": "2815a2a8e59056587256daff60165803",
"sha256": "37097878436d890f9a821a08dbef22529942268543ff2f881d2ab6d7db13c0ea"
},
"downloads": -1,
"filename": "agentshell-0.0.7.tar.gz",
"has_sig": false,
"md5_digest": "2815a2a8e59056587256daff60165803",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6466,
"upload_time": "2023-08-01T23:28:33",
"upload_time_iso_8601": "2023-08-01T23:28:33.733802Z",
"url": "https://files.pythonhosted.org/packages/f2/32/fa3dd1d19178908df7d1f9bb3fb15950dfd1460d826f99cbe16355f2b787/agentshell-0.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-01 23:28:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AutonomousResearchGroup",
"github_project": "agentshell",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "agentshell"
}