This commit is contained in:
50
app/agent.py
50
app/agent.py
@@ -1 +1,49 @@
|
||||
"""gcp_solution_architecture_agent: create_agent_app wiring + REST route handlers only."""
|
||||
"""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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user