Spaces:
Paused
Paused
| from src.agents.base import BaseAgent | |
| from src.core.agent_middleware import AgentMiddleware | |
| class CoderAgent(BaseAgent): | |
| def __init__(self, engine, memory): | |
| super().__init__(engine, "coder") | |
| self.middleware = AgentMiddleware() | |
| def write_code(self, task: str, plan: str, feedback: str = ""): | |
| tools_def = self.middleware.get_workflow_tools() | |
| db_schema = self.middleware.get_db_schema() | |
| prompt = f'''<|im_start|>system | |
| You are the Lead Automation Engineer. Output VALID JSON Workflow definition. | |
| CONTEXT - SCHEMA: | |
| {db_schema} | |
| CONTEXT - PROTOCOL: | |
| {tools_def} | |
| RULES: Output ONLY JSON. No markdown. | |
| <|im_end|> | |
| <|im_start|>user | |
| TASK: {task} | |
| PLAN: {plan} | |
| <|im_end|> | |
| <|im_start|>assistant | |
| ''' | |
| return self.generate(prompt, max_new_tokens=1024, temperature=0.1) | |