From 8777ffd21a9d778bdde69a450da8a14a017df8f5 Mon Sep 17 00:00:00 2001 From: a2a-cloud Date: Mon, 13 Jul 2026 03:03:54 +0000 Subject: [PATCH] a2a-source-edit: write agent.py --- agent.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/agent.py b/agent.py index bdc4511..32b9b0e 100644 --- a/agent.py +++ b/agent.py @@ -1032,14 +1032,10 @@ async def _persist_text(ctx: RunContext[NoAuth], run_id: str, filename: str, tex sha = hashlib.sha256(data).hexdigest() artifact_uri: str | None = None try: - view = await ctx.workspace.open_view( - purpose="persist revenue recovery output", - hints=[rel_path], - max_files=1, - mode=WorkspaceMode.READ_WRITE_OVERLAY, - reason="write generated output under outputs/revenue-recovery", - ) - await view.write(rel_path, data) + writer = getattr(ctx.workspace, "write_bytes", None) + if writer is None: + raise RuntimeError("workspace client does not expose direct output writes") + writer(rel_path, data) except Exception as exc: # workspace may be unavailable in local smoke calls; artifact still persists. await ctx.emit_event(AgentEvent(kind="workspace_write_warning", payload={"path": rel_path, "message": str(exc)[:300]})) try: