feat: generate improvement proposals
This commit is contained in:
20
agent.py
20
agent.py
@@ -8,8 +8,9 @@ from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
import a2a_pack as a2a
|
||||
from a2a_pack import (
|
||||
A2AAgent, LLMProvisioning, NoAuth, Pricing, RunContext, skill,
|
||||
A2AAgent, LLMProvisioning, NoAuth, Pricing, RunContext,
|
||||
)
|
||||
|
||||
from agent_reviewer import ReviewerContext, build_reviewer_graph
|
||||
@@ -30,7 +31,7 @@ class AgentReviewer(A2AAgent[ReviewerConfig, NoAuth]):
|
||||
"repo from Gitea, applies security / best-practice / grant-scope "
|
||||
"skill bundles, and returns a structured ReviewReport."
|
||||
)
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
|
||||
config_model = ReviewerConfig
|
||||
auth_model = NoAuth
|
||||
@@ -46,7 +47,7 @@ class AgentReviewer(A2AAgent[ReviewerConfig, NoAuth]):
|
||||
),
|
||||
)
|
||||
|
||||
@skill(
|
||||
@a2a.tool(
|
||||
description=(
|
||||
"Audit an agent's source. Pass the target ``agent_name`` "
|
||||
"(kebab-case) and optional ``ref`` (defaults to ``main``). "
|
||||
@@ -63,6 +64,7 @@ class AgentReviewer(A2AAgent[ReviewerConfig, NoAuth]):
|
||||
agent_name: str,
|
||||
ref: str = "main",
|
||||
owner: str | None = None,
|
||||
mode: str = "audit",
|
||||
) -> dict[str, Any]:
|
||||
if not _is_valid_slug(agent_name):
|
||||
return {"error": f"invalid agent_name {agent_name!r} — use kebab-case"}
|
||||
@@ -120,11 +122,21 @@ class AgentReviewer(A2AAgent[ReviewerConfig, NoAuth]):
|
||||
completion_box=completion_box,
|
||||
)
|
||||
|
||||
improvement_brief = (
|
||||
" This is a daily improvement-discovery review. In addition to real "
|
||||
"defects, return at most three high-confidence, source-specific ideas "
|
||||
"that improve robustness, test coverage, tool usability, or operator "
|
||||
"ergonomics. Represent an idea as an info/ergonomics finding and put "
|
||||
"the concrete implementation in suggestion. Do not invent work for a "
|
||||
"clean agent."
|
||||
if str(mode).strip().lower() == "improvements"
|
||||
else ""
|
||||
)
|
||||
user_msg = (
|
||||
f"Review the agent at ``{gitea_owner}/{agent_name}`` ref ``{ref}``. "
|
||||
"Read the source, consult the bundled skills, run the sandbox checks, "
|
||||
"then call ``submit_review_report`` exactly once with the structured "
|
||||
"report."
|
||||
f"report.{improvement_brief}"
|
||||
)
|
||||
|
||||
async def _heartbeat() -> None:
|
||||
|
||||
Reference in New Issue
Block a user