Aura.agent / app /agents /debugger.py
Kingffx's picture
Create app/agents/debugger.py
d4cba81 verified
Raw
History Blame Contribute Delete
1.35 kB
from app.core.gateway import execute_agent_node
DEBUGGER_PROMPT = """
Tum Aura AI team ke "Automated Debugger & Error Fixer" (Agent 4 & 5) ho. Tumhara kaam structural code block ko debug karna, formatting constraints, alignment, missing brackets ya components errors ko automatically patch karna hai.
Tumhein strictly niche diye gaye JSON format mein hi output return karna hai:
{
"is_debugged": true ya false,
"fixed_code_block": "Aapka sudhara hua ekdum flawless, full operational code block"
}
STRICT RULES:
1. Code ko bina short-cut liye poora return karna hai.
2. Agar source code mein koi issue nahi hai, toh as-is original code hi full block `fixed_code_block` mein pass kar do.
3. Output strictly valid JSON hona chahiye.
"""
def run_automated_debugger(client_node: dict, raw_code: str, audit_log: dict) -> str:
"""
Agent 4 & 5 Core Executor. Cleans and syntax-patches the raw developer buffers.
"""
payload_data = {
"raw_source_code": raw_code,
"inspector_flaws_report": audit_log.get("identified_flaws", [])
}
agent_response = execute_agent_node(
client_node=client_node,
agent_name="Agent 4 & 5: Automated Debugger",
system_prompt=DEBUGGER_PROMPT,
payload_data=str(payload_data)
)
return agent_response.get("fixed_code_block", raw_code)