-
Notifications
You must be signed in to change notification settings - Fork 768
Cloud/deployable temporal example #395
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
Changes from all commits
db01b79
5f8eb89
97c9bf4
dae5e11
6641a3a
33d9ae9
b9f1165
742e26c
ad28b59
2a8755d
9573453
4de01d4
22d1a5d
c643529
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# Core framework dependency | ||
mcp-agent @ file://../../ # Link to the local mcp-agent project root | ||
mcp-agent @ file://../../ # Link to the local mcp-agent project root. Remove @ file://../../ for cloud deployment | ||
rholinshead marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Additional dependencies specific to this example | ||
temporalio | ||
anthropic | ||
openai | ||
temporalio | ||
rholinshead marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from basic import SimpleWorkflow # noqa: F401 | ||
from evaluator_optimizer import EvaluatorOptimizerWorkflow # noqa: F401 | ||
from orchestrator import run_orchestrator # noqa: F401 | ||
from parallel import ParallelWorkflow # noqa: F401 | ||
from router import RouterWorkflow # noqa: F401 | ||
from interactive import WorkflowWithInteraction # noqa: F401 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -772,7 +772,7 @@ async def resume_workflow( | |
run_id: str | None = None, | ||
workflow_id: str | None = None, | ||
signal_name: str | None = "resume", | ||
payload: str | None = None, | ||
payload: Dict[str, Any] | None = None, | ||
) -> bool: | ||
Comment on lines
+775
to
776
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainBroadened payload type is fine; validate input and redact logs. Two guardrails:
@@
async def resume_workflow(
ctx: MCPContext,
run_id: str | None = None,
workflow_id: str | None = None,
signal_name: str | None = "resume",
- payload: Dict[str, Any] | None = None,
+ payload: Dict[str, Any] | None = None,
) -> bool:
@@
- logger.info(
- f"Resuming workflow ID {workflow_id or 'unknown'}, run ID {run_id or 'unknown'} with signal '{signal_name}' and payload '{payload}'"
- )
+ # Validate input payload
+ if payload is not None and not isinstance(payload, dict):
+ raise ToolError("payload must be a JSON object (dict).")
+
+ # Redact payload in logs (structure only, truncate to avoid giant logs)
+ try:
+ payload_summary = (
+ {"keys": sorted(list(payload.keys()))} if isinstance(payload, dict) else str(type(payload))
+ )
+ except Exception:
+ payload_summary = "uninspectable-payload"
+ logger.info(
+ f"Resuming workflow ID {workflow_id or 'unknown'}, run ID {run_id or 'unknown'} with signal '{signal_name}' and payload_summary '{payload_summary}'"
+ ) Run to find other callers assuming string payloads: 🏁 Script executed: #!/bin/bash
rg -nP -C2 '\bresume_workflow\s*\('
rg -nP -C2 '\bworkflows-resume\b|\"workflows-resume\"' Length of output: 12268 🏁 Script executed: #!/bin/bash
# Inspect CLI command signature and payload type declaration
rg -nP 'def resume_workflow' -C5 --type=py src/mcp_agent/cli/cloud/commands/workflows/resume/main.py
rg -nP 'payload:' -C3 --type=py src/mcp_agent/cli/cloud/commands/workflows/resume/main.py Length of output: 2354 Normalize and validate payload, redact logs 🤖 Prompt for AI Agents
|
||
""" | ||
Resume a paused workflow. | ||
|
Uh oh!
There was an error while loading. Please reload this page.