Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shell Tool Exec Fails to extract outputs correctly #1072

Open
harshith2794 opened this issue Dec 22, 2024 · 1 comment
Open

Shell Tool Exec Fails to extract outputs correctly #1072

harshith2794 opened this issue Dec 22, 2024 · 1 comment

Comments

@harshith2794
Copy link

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 command outputs and exit-codes.

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, pwd is also incorrect
{'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
{'data': {'stdout': '1\n/usr/workspace\n0\nHello, World!\n',
  'stderr': 'wandb: Using wandb-core as the SDK backend. Please refer to https://wandb.me/wandb-core for more information.\n2024/12/22 13:42:22 INFO wandb: stream_init: failed to fetch credentials: couldn\'t get API key: settings: failed to get API key from netrc: $HOME is not defined\nBrokenPipeError: [Errno 32] Broken pipe\n',
  'exit_code': 0,
  'current_shell_pwd': 'Currently in /home/harshith2794/repos/deduction-dev/notebooks/workspace'},
 'error': None,
 'successful': True}
"""
@shreysingla11
Copy link
Collaborator

Thanks for creating the issue, we will look into it and update you in a few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants