optimistic-gold
optimistic-gold3mo ago

Shell Tool Exec Fails to extract outputs correctly

Hi, I am noticing the shell tool exec action for some complex commands fails to retrieve the output correctly. The outputs are in fact obtained in the next command's output.
workspace_config = WorkspaceType.Host(
composio_api_key=COMPOSIO_API_KEY,
composio_base_url="'https://backend.composio.dev/api'",
environment={},
persistent=True,
)

_workspace = WorkspaceFactory.new(config=workspace_config)

# 1. works correctly for quick commands
_workspace.execute_action(
action=Action.SHELLTOOL_EXEC_COMMAND,
request_data={
'cmd': 'pwd',
},
metadata={},
)

# 2. needs to initialize wandb and print project and run_url
_workspace.execute_action(
action=Action.SHELLTOOL_EXEC_COMMAND,
request_data={
'cmd': 'python -u wandb_logging.py',
},
metadata={},
)

"""
## output isnt captured correctly and exit code is shown as 0
{'data': {'stdout': '',
'stderr': '',
'exit_code': 0,
'current_shell_pwd': 'Currently in '},
'error': None,
'successful': True}
"""

# 3. Next command
_workspace.execute_action(
action=Action.SHELLTOOL_EXEC_COMMAND,
request_data={
'cmd': 'echo "Hello, World!"',
},
metadata={},
)

"""
# wandb erros show up now
'stderr': 'wandb: Using wandb-core as the SDK backend
"""
workspace_config = WorkspaceType.Host(
composio_api_key=COMPOSIO_API_KEY,
composio_base_url="'https://backend.composio.dev/api'",
environment={},
persistent=True,
)

_workspace = WorkspaceFactory.new(config=workspace_config)

# 1. works correctly for quick commands
_workspace.execute_action(
action=Action.SHELLTOOL_EXEC_COMMAND,
request_data={
'cmd': 'pwd',
},
metadata={},
)

# 2. needs to initialize wandb and print project and run_url
_workspace.execute_action(
action=Action.SHELLTOOL_EXEC_COMMAND,
request_data={
'cmd': 'python -u wandb_logging.py',
},
metadata={},
)

"""
## output isnt captured correctly and exit code is shown as 0
{'data': {'stdout': '',
'stderr': '',
'exit_code': 0,
'current_shell_pwd': 'Currently in '},
'error': None,
'successful': True}
"""

# 3. Next command
_workspace.execute_action(
action=Action.SHELLTOOL_EXEC_COMMAND,
request_data={
'cmd': 'echo "Hello, World!"',
},
metadata={},
)

"""
# wandb erros show up now
'stderr': 'wandb: Using wandb-core as the SDK backend
"""
2 Replies
optimistic-gold
optimistic-goldOP3mo ago
GitHub
Shell Tool Exec Fails to extract outputs correctly · Issue #1072 · ...
Hi, I am noticing the shell tool exec action fails to retrieve the output correctly for some complex commands. The outputs are in fact flushed in the next command's output leading to misleading...
fascinating-indigo
fascinating-indigo3mo ago
thanks for pointing this out - checking with the team.

Did you find this page helpful?