CoolFace
Apppublic

ekanshA/DeepResearchAgent

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
agents.py50 linesDownload Raw Back to root
1import uuid2from contextlib import asynccontextmanager3 4def gen_trace_id():5    return str(uuid.uuid4())6 7@asynccontextmanager8async def trace(name, trace_id=None):9    print(f"[TRACE START] {name} - {trace_id}")10    yield11    print(f"[TRACE END] {name} - {trace_id}")12 13class Runner:14    @staticmethod15    async def run(agent, input_text):16        print(f"Running agent: {getattr(agent, '__name__', agent)}")17        return DummyResult()18 19class DummyResult:20    def __init__(self):21        self.final_output = DummyOutput()22 23    def final_output_as(self, _type):24        return self.final_output25 26class DummyOutput:27    @property28    def searches(self):29        return []30 31    def __str__(self):32        return "Dummy search result"33 34 35class Agent:36    def __init__(self, *args, **kwargs):37        pass38 39class WebSearchTool:40    def __init__(self, *args, **kwargs):41        pass42 43class ModelSettings:44    def __init__(self, *args, **kwargs):45        pass46 47def function_tool(input_text):48    print(f"Running function_tool with input: {input_text}")49    return "Function tool result"50