Spaces:
Build error
Build error
File size: 1,121 Bytes
83a8d8b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | import os
import json
import base64
import zipfile
import tempfile
from pathlib import Path
from datetime import datetime
from typing import Dict, List, Optional
import re
def create_agent_template(
agent_name: str,
agent_type: str,
generated_code: str,
programming_language: str = "Python"
) -> Dict[str, str]:
"""Create a complete agent template with all necessary files."""
files = {}
# Main agent file
if programming_language == "Python":
files[f"{agent_name}.py"] = generated_code
# Configuration file
files["config.json"] = json.dumps({
"name": agent_name,
"type": agent_type,
"language": programming_language,
"created": datetime.now().isoformat(),
"version": "1.0.0"
}, indent=2)
# Requirements file
files["requirements.txt"] = "daggr>=0.5.4\ngradio>=6.0.2\nstreamlit>=1.28.0"
# README
files["README.md"] = f"""# {agent_name}
## Description
{agent_type} agent built with natural language.
## Usage
Run the agent with: |