Skip to main content

A shell for your agent. Track state and history, multiple shells, and more.

Lint and Test PyPI version

Installation

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.

Metadata

Release files for agentshell 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentshell 0.0.7
File Size Uploaded
agentshell-0.0.7.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentshell 0.0.7
File Interpreter ABI Platform
agentshell-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / agentshell-0.0.7.tar.gz

Download URL agentshell-0.0.7.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
37097878436d890f9a821a08dbef22529942268543ff2f881d2ab6d7db13c0ea
BLAKE2b-256 checksum
How to use checksums
f232fa3dd1d19178908df7d1f9bb3fb15950dfd1460d826f99cbe16355f2b787
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release files / agentshell-0.0.7-py3-none-any.whl

Download URL agentshell-0.0.7-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd2f751a0736031c64fc5ac96b1cd0e35eb90f3ff22e9fcf040a73aa0268ecf9
BLAKE2b-256 checksum
How to use checksums
181f263024dfa711beddf8ac35d0e96e912b6941400e98a42fe1cb093076d6b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.4

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page