From a769766ab422d716ad446366d5a5b98a1dc8d77d Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 28 May 2026 20:25:05 -0300 Subject: [PATCH] Commit pending workspace updates --- .gitignore | 1 + agent.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..930cce6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.codegraph/ diff --git a/agent.py b/agent.py index bd596ec..4da186f 100644 --- a/agent.py +++ b/agent.py @@ -290,6 +290,7 @@ class BlogOpenapiAgent(A2AAgent): "Call tools to get real results. Do not invent API responses.", "For write, update, or delete operations, explain the intended action before calling the tool.", "If an operation reports missing consumer setup, tell the user which setup field is required.", + "If an operation returns 404, 405, 410, or a schema/validation error that suggests the live API no longer matches these tools, tell the user this generated agent may need to be refreshed from the latest OpenAPI spec and ask whether they want to refresh it.", "", "Available operations:", ] @@ -346,12 +347,18 @@ class BlogOpenapiAgent(A2AAgent): except ValueError: payload = response.text if response.status_code >= 400: - return { + out = { "ok": False, "status_code": response.status_code, "operation_id": operation_id, "error": payload, } + if response.status_code in {404, 405, 410, 422}: + out["stale_openapi_hint"] = ( + "This generated OpenAPI agent may be stale. Ask the user " + "whether they want to refresh it from the latest OpenAPI spec." + ) + return out return { "ok": True, "status_code": response.status_code,