Files
gcp_solution_architecture_a…/app/agent.py
Jonathan Boniface b9a924cf4a
Some checks failed
validation / verify (push) Failing after 15s
fix: refactored manually
2026-09-02 16:08:12 +01:00

50 lines
1.3 KiB
Python

"""gcp_solution_architecture_agent: Starlette application wiring & CLI entrypoint."""
import logging
import click
import uvicorn
from starlette.applications import Starlette
from starlette.routing import Route
from app.config import get_settings
from app.workflows.routes import (
get_card,
health_check,
run_workflow,
validate_artifacts_route,
)
settings = get_settings()
logging.basicConfig(
level=getattr(logging, settings.LOG_LEVEL.upper(), logging.INFO),
format="%(asctime)s %(name)s %(levelname)s %(message)s",
)
logger = logging.getLogger(__name__)
routes = [
Route("/health", health_check, methods=["GET"]),
Route("/card", get_card, methods=["GET"]),
Route("/generate", run_workflow, methods=["POST"]),
Route("/validate", validate_artifacts_route, methods=["POST"]),
]
app = Starlette(
debug=True,
routes=routes,
)
@click.command()
@click.option("--host", default=settings.HOST, help="Host address to bind")
@click.option("--port", default=settings.PORT, type=int, help="Port to listen on")
def main(host: str, port: int) -> None:
"""Start the GCP Solution Architecture Agent Starlette REST server."""
logger.info("Starting GCP Solution Architecture Agent on %s:%d", host, port)
uvicorn.run(app, host=host, port=port, log_level=settings.LOG_LEVEL.lower())
if __name__ == "__main__":
main()