Louis C.K., the actor and comedian, has a knack for finding humor in unexpected places.

This week, that place is New York City Hall.

In what sounds like the setup for an absurdist comedy sketch, Louis C.K. is spending two days shadowing Mayor Bill de Blasio, traveling in the mayor’s official S.U.V. and observing his activities as research for an unspecified project.

It has not been the most glamorous itinerary. The comedian was first spotted at a meeting of an obscure state budget board, where Mr. de Blasio was giving a talk on city finance. He spent the afternoon exploring the mayor’s offices at City Hall, as reporters jostled for a glimpse of him.

Could the comedian share any details about his work? “I can’t, because I don’t know what it is yet,” Louis C.K. said in a brief interview in Brownsville, Brooklyn, on Tuesday night, where he had joined Mr. de Blasio for a community policing rally. “I’m just messing around with something, and we’ll see what happens.”