Skip to content

Commit 7316480

Browse files
authored
Add workflow commands to CLI (#424)
### TL;DR Added workflow management commands to the MCP Agent CLI, including describe, suspend, resume, and cancel operations. ### What changed? - Added four new workflow management commands: - `describe_workflow`: Shows detailed information about a workflow execution - `suspend_workflow`: Pauses a running workflow execution - `resume_workflow`: Resumes a previously suspended workflow - `cancel_workflow`: Permanently stops a workflow execution - Implemented corresponding API client methods in `WorkflowAPIClient`: - `suspend_workflow` - `resume_workflow` - `cancel_workflow` - Updated the CLI structure to expose these commands under `mcp-agent cloud workflows` - Added an alias for `describe_workflow` as `status` for backward compatibility ### How to test? Test the new workflow commands with a running workflow: ``` # Get workflow details mcp-agent cloud workflows describe run_abc123 mcp-agent cloud workflows status run_abc123 # alias # Suspend a workflow mcp-agent cloud workflows suspend run_abc123 # Resume a workflow (with optional payload) mcp-agent cloud workflows resume run_abc123 mcp-agent cloud workflows resume run_abc123 --payload '{"data": "value"}' # Cancel a workflow (with optional reason) mcp-agent cloud workflows cancel run_abc123 mcp-agent cloud workflows cancel run_abc123 --reason "User requested cancellation" ``` ### Why make this change? These commands provide essential workflow lifecycle management capabilities to users, allowing them to monitor and control workflow executions through the CLI. The ability to suspend, resume, and cancel workflows gives users more control over long-running operations and helps manage resources more efficiently. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - New Features - Introduced “workflows” CLI group with commands: describe (alias: status), resume, suspend, and cancel. - Describe supports text, JSON, and YAML output; all commands work with server ID or URL and include improved error messages. - Refactor - Renamed CLI group from “workflow” to “workflows” and reorganized command registrations. - Consolidated internal utility imports (no behavior change). - Chores - Updated module descriptions. - Removed legacy workflow status package/exports in favor of the new workflows commands. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 8108d90 commit 7316480

File tree

17 files changed

+409
-128
lines changed

17 files changed

+409
-128
lines changed

src/mcp_agent/cli/cloud/commands/logger/tail/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from mcp_agent.cli.exceptions import CLIError
1919
from mcp_agent.cli.auth import load_credentials, UserCredentials
20-
from mcp_agent.cli.cloud.commands.servers.utils import setup_authenticated_client
20+
from mcp_agent.cli.cloud.commands.utils import setup_authenticated_client
2121
from mcp_agent.cli.core.api_client import UnauthenticatedError
2222
from mcp_agent.cli.core.utils import parse_app_identifier, resolve_server_url
2323
from mcp_agent.cli.utils.ux import print_error

src/mcp_agent/cli/cloud/commands/servers/delete/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from mcp_agent.cli.core.utils import run_async
66
from mcp_agent.cli.exceptions import CLIError
77
from mcp_agent.cli.mcp_app.api_client import MCPApp
8-
from ..utils import (
8+
from ...utils import (
99
setup_authenticated_client,
1010
resolve_server,
1111
handle_server_api_errors,

src/mcp_agent/cli/cloud/commands/servers/describe/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from mcp_agent.cli.exceptions import CLIError
99
from mcp_agent.cli.mcp_app.api_client import MCPApp, MCPAppConfiguration
10-
from ..utils import (
10+
from ...utils import (
1111
setup_authenticated_client,
1212
validate_output_format,
1313
resolve_server,

src/mcp_agent/cli/cloud/commands/servers/list/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from mcp_agent.cli.core.utils import run_async
1010
from mcp_agent.cli.mcp_app.api_client import MCPApp, MCPAppConfiguration
11-
from ..utils import (
11+
from ...utils import (
1212
setup_authenticated_client,
1313
validate_output_format,
1414
handle_server_api_errors,

src/mcp_agent/cli/cloud/commands/servers/utils.py renamed to src/mcp_agent/cli/cloud/commands/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Shared utilities for server commands."""
1+
"""Shared utilities for cloud commands."""
22

33
from functools import wraps
44
from typing import Union

src/mcp_agent/cli/cloud/commands/workflow/__init__.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/mcp_agent/cli/cloud/commands/workflow/status/__init__.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/mcp_agent/cli/cloud/commands/workflow/status/main.py

Lines changed: 0 additions & 106 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""MCP Agent Cloud workflows commands."""
2+
3+
from .describe import describe_workflow
4+
from .resume import resume_workflow, suspend_workflow
5+
from .cancel import cancel_workflow
6+
7+
__all__ = [
8+
"describe_workflow",
9+
"resume_workflow",
10+
"suspend_workflow",
11+
"cancel_workflow",
12+
]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""MCP Agent Cloud workflow cancel command."""
2+
3+
from .main import cancel_workflow
4+
5+
__all__ = ["cancel_workflow"]

0 commit comments

Comments
 (0)