Bound builder runs and require a2a-pack 0.1.76
All checks were successful
build / build (push) Successful in 16s
All checks were successful
build / build (push) Successful in 16s
This commit is contained in:
43
agent.py
43
agent.py
@@ -39,6 +39,7 @@ class BuilderConfig(BaseModel):
|
||||
|
||||
_URL_RE = re.compile(r"https?://[a-zA-Z0-9._-]+\.[a-zA-Z]{2,}[\w/?#%&=.-]*")
|
||||
DEEPAGENTS_RECURSION_LIMIT = 500
|
||||
BUILDER_WALL_TIMEOUT_SECONDS = 25 * 60
|
||||
|
||||
|
||||
class AgentBuilder(A2AAgent[BuilderConfig, NoAuth]):
|
||||
@@ -165,8 +166,7 @@ class AgentBuilder(A2AAgent[BuilderConfig, NoAuth]):
|
||||
await asyncio.sleep(20)
|
||||
await ctx.emit_progress(f"agent-builder still working on {name!r}")
|
||||
|
||||
heartbeat_task = asyncio.create_task(_heartbeat())
|
||||
try:
|
||||
async def _run_build_graph() -> None:
|
||||
async for event in graph.astream_events(
|
||||
{"messages": [{"role": "user", "content": user_msg}]},
|
||||
version="v2",
|
||||
@@ -193,8 +193,43 @@ class AgentBuilder(A2AAgent[BuilderConfig, NoAuth]):
|
||||
out = data.get("output")
|
||||
if isinstance(out, dict):
|
||||
final_state = out
|
||||
|
||||
heartbeat_task = asyncio.create_task(_heartbeat())
|
||||
try:
|
||||
await asyncio.wait_for(
|
||||
_run_build_graph(),
|
||||
timeout=BUILDER_WALL_TIMEOUT_SECONDS,
|
||||
)
|
||||
except TimeoutError:
|
||||
return {
|
||||
"ok": False,
|
||||
"status": "failed",
|
||||
"stop_reason": "builder_timeout",
|
||||
"name": name,
|
||||
"workspace_dir": f"agents/{name}/",
|
||||
"error": (
|
||||
"agent-builder exceeded its wall-clock budget before "
|
||||
"reaching a terminal result"
|
||||
),
|
||||
}
|
||||
except asyncio.CancelledError:
|
||||
return {
|
||||
"ok": False,
|
||||
"status": "canceled",
|
||||
"stop_reason": "builder_canceled",
|
||||
"name": name,
|
||||
"workspace_dir": f"agents/{name}/",
|
||||
"error": "agent-builder was canceled before it reached a terminal result",
|
||||
}
|
||||
except Exception as exc: # noqa: BLE001
|
||||
return {"error": _build_failure_error(exc)}
|
||||
return {
|
||||
"ok": False,
|
||||
"status": "failed",
|
||||
"stop_reason": "builder_failed",
|
||||
"name": name,
|
||||
"workspace_dir": f"agents/{name}/",
|
||||
"error": _build_failure_error(exc),
|
||||
}
|
||||
finally:
|
||||
heartbeat_task.cancel()
|
||||
with suppress(asyncio.CancelledError):
|
||||
@@ -298,4 +333,4 @@ def _build_failure_error(exc: BaseException) -> str:
|
||||
"or a smaller build scope"
|
||||
)
|
||||
return f"build graph failed: {type(exc).__name__}: {exc}"
|
||||
# rebuild against a2a-pack 0.1.75 for source-grant-aware agent updates
|
||||
# rebuild against a2a-pack 0.1.76 for source-grant-aware agent updates
|
||||
|
||||
Reference in New Issue
Block a user