The Hollywood writers-agents story could become a court drama.

The Writers Guild of America, whose members include Seth MacFarlane, Patton Oswalt, Tony Kushner and Tina Fey, is claiming in a lawsuit that Tinseltown’s most powerful agencies have profited on the backs of the writers through the use of so-called packaging fees.

The packaging fees collected by CAA, UTA, WME and ICM are connected to the agent’s involvement in developing a TV show or film.

For example, instead of shopping a new script to studios and getting the standard 10% of the best price offered, agents are cutting a production deal directly with studios for scripts as well as for bringing in the other talent, like actors and directors.

The guild cited packaged shows like “Madame Secretary,” “Beverly Hills, 90210,” “Homeland” and “Buffy the Vampire Slayer.”

The agencies note that packaging fees save writers a commission they’d otherwise pay and give them better access to producers and talent.

But the guild claimed in the suit that the deals violate state and federal laws and that its writers were “deprived of loyal, conflict-free representation.”

The suit comes after two weeks of talks in which the guild demanded that agents do away with packaging fees. Neither side could reach a deal, and the guild has since instructed writers to fire their agents.

Although most well-known writers from Shonda Rhimes to Aaron Sorkin have supported that mandate, sources said emerging writers are being strong-armed into taking action that could hurt their careers.

“I think the WGA has created a climate that does not allow for much dissent,” an insider said. “When elephants fight, it’s always the grass that gets trampled.”

WME, CAA, ICM and UTA declined to comment.