MCPcopy Index your code
hub / github.com/google/adk-python / _create_session

Method _create_session

src/google/adk/cli/api_server.py:845–870  ·  view source on GitHub ↗
(
      self,
      *,
      app_name: str,
      user_id: str,
      session_id: Optional[str] = None,
      state: Optional[dict[str, Any]] = None,
  )

Source from the content-addressed store, hash-verified

843 )
844
845 async def _create_session(
846 self,
847 *,
848 app_name: str,
849 user_id: str,
850 session_id: Optional[str] = None,
851 state: Optional[dict[str, Any]] = None,
852 ) -> Session:
853 try:
854 session = await self.session_service.create_session(
855 app_name=app_name,
856 user_id=user_id,
857 state=state,
858 session_id=session_id,
859 )
860 logger.info("New session created: %s", session.id)
861 return session
862 except AlreadyExistsError as e:
863 raise HTTPException(
864 status_code=409, detail=f"Session already exists: {session_id}"
865 ) from e
866 except Exception as e:
867 logger.error(
868 "Internal server error during session creation: %s", e, exc_info=True
869 )
870 raise HTTPException(status_code=500, detail=str(e)) from e
871
872 def get_fast_api_app(
873 self,

Callers 2

create_sessionMethod · 0.95

Calls 2

create_sessionMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected