INNER CODE UNIT · Python

result

agentscope-ai/agentscope-runtime · src/agentscope_runtime/sandbox/manager/server/app.py:173

                result = await method(**data)
            else:
                # If sync, run it in a thread to avoid blocking the event loop
                result = await asyncio.to_thread(method, **data)

            if hasattr(result, "model_dump_json"):
                return JSONResponse(content={"data": result.model_dump_json()})
            return JSONResponse(content={"data": result})

        except Exception as e:
            error = f"Error in {method.__name__}: {str(e)}"
            logger.error(error)
            raise HTTPException(status_code=500, detail=error) from e

    return endpoint


def register_routes(_app, instance):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…