MCPcopy
hub / github.com/Agenta-AI/agenta / create_deployment

Function create_deployment

api/oss/src/services/db_manager.py:536–567  ·  view source on GitHub ↗

Create a new deployment. Args: app (str): The app to create the deployment for. project_id (str): The ID of the project to create the deployment for. uri (str): The URI of the service. Returns: DeploymentDB: The created deployment.

(
    app_id: str,
    project_id: str,
    uri: str,
)

Source from the content-addressed store, hash-verified

534
535
536async def create_deployment(
537 app_id: str,
538 project_id: str,
539 uri: str,
540) -> DeploymentDB:
541 """Create a new deployment.
542
543 Args:
544 app (str): The app to create the deployment for.
545 project_id (str): The ID of the project to create the deployment for.
546 uri (str): The URI of the service.
547
548 Returns:
549 DeploymentDB: The created deployment.
550 """
551
552 async with engine.core_session() as session:
553 try:
554 deployment = DeploymentDB(
555 app_id=uuid.UUID(app_id),
556 project_id=uuid.UUID(project_id),
557 uri=uri,
558 )
559
560 session.add(deployment)
561 await session.commit()
562 await session.refresh(deployment)
563
564 return deployment
565
566 except Exception as e:
567 raise Exception(f"Error while creating deployment: {e}")
568
569
570async def get_app_type_from_template_key(template_key: Optional[str]) -> Optional[str]:

Callers

nothing calls this directly

Calls 4

DeploymentDBClass · 0.90
core_sessionMethod · 0.80
addMethod · 0.80
commitMethod · 0.45

Tested by

no test coverage detected