J. E. Lighter, The Random House Historical Dictionary of American Slang (1994) has this entry for the relevant sense of fed:
a federal official, esp. a member of the FBI.
1916 A. Stringer, Door of Dread 53: Seein' Kestner and yuh'd told me the Feds had ev'rything fixt, I give him the glassy eye. 1930 Irwin Tramp & Und[erworld] Sl[ang]: Feds...Federal law enforcement officers, especially those charged with suppressing the liquor or drug traffic. 1935 Mackenzie Been Places 44: They had the goods on him for bumping off the three Feds, 1955 PADS (No. 24) 47: The Feds got the letter where I sent him $400. 1984 Kagan & Summers Mute Evidence 89: Many...would have found it easy to believe that the Army, Air Force, CIA, or the feds were behind it. 1991 "R. Brown" & R. Angus A.K.A. Narc 205: The Fed strode in, three-piece suit, sunglasses and all.
There appears to be considerable overlap between feds and the now less common term G-men ("[federal] government men"), which Lighter defines (in its singular form) as follows:
G-man n. [government man, first applied (*a*1917) to political detectives in Ireland; see OEDS] 1. a special agent of the Federal Bureau of Investigation.
1930 Pasley Al Capone 33: He offered a G man (government agent) ten gran' to forget it. [other citations (through 1993) omitted]
Barbara Kipfer & Robert Chapman, Dictionary of American Slang, fourth edition (2007), meanwhile, offers this much more expansive definition of Fed:
Fed n Any federal government worker or agent, esp in law enforcement or taxation: right up to the day the Feds dragged him into court (1912+)
I don't think that feds has an inherently negative connotation, though a reader might detect something derisive or hostile (depending on the speaker or writer) in the use of the familiar short form "feds" instead of the formal "federal agents."
UPDATE: In a comment below, Drew asks, "When have you heard it [feds] used non-negatively? Rarely, if ever, is my guess." It's a fair question, since personal opinions without documentation tend to be rather insubstantial things. In hopes of finding some concrete examples where authors use feds non-negatively, I ran a Google Books search for the phrase "call in the feds." (I chose that phrase because it filters out irrelevant matches for "feds.") Here are some of the results I got.
From Analog Science Fact, Science Fiction, volume 57 (1956) [combined snippets]:
"I thought we were interested only in counterfeit currency and illegal transfers of capital. What has a heist to do with us? That’s for the police, isn’t it?”
The police are stuck with it.”
"Well, if the place was government insured they can call in the Feds."
"It's not insured. We offered to lend a hand. You are the boy who will lend it."
From Ward’s Auto World, volume 9 (1973) [combined snippets]:
So if by some hard-to-fathom reason Chrysler would really buck on the UAW demand, for a joint company/union safety & health program, all the UAW has to do is call in the feds. OSHA agents could be on hand quickly and legally, as a sort of third force, even though the UAW thinks there aren't enough of them.
From Herbert, H. Hand, Business Horizons (1975) [combined snippets]:
Call in the Feds—Both the Equal Employment Opportunity Commission (EEOC) and the Women's Bureau of the U.S. Department of Labor are generous in providing speakers and handouts related to this topic. Field investigators and attorneys from EEOC make particularly interesting speakers as they have been on the front line in trying to settle cases both in and out of court.
From John Bryan, This Soldier Still at War (1975) [combined snippets]:
Visitors to their nicely appointed home, including Bill’s stepfather, noticed the Maoist posters in the hall and the revolutionary books on the shelves but put it down as “only a passing fancy.” They did not see the guns and ammunition neatly stored away out of sight. (Emily's father had never visited the California apartment. All it took for him to call in the feds was a letter she sent him early in '74 proclaiming that she had entered a new life style and that "I have learned a lot from ... the people in prison and they, in turn, have learned a lot from me. One person in particular - a beautiful black man - has conveyed to me the torture of being black in this country and of being poor.
From John Striker & Andrew Shapiro, Power Plays: How to Deal Like a Lawyer in Person-to-Person Confrontations and Get Your Rights (1979) [combined snippets]:
Remember, a bill collector won’t always play by the rules, even though you clearly know them all. Therefore, it's good to know that you have two ultimate power plays left: you can call in the feds or you can sue. Calling in the feds may be enough to scare away a bill collector, even if the feds never actually intervene. Official enforcement of the Fair Debt Collection Practices Act was delegated by Congress to the Federal Trade Commission (FTC).
From J. Anthony Lukas, Common Ground: A Turbulent Decade in the Lives of Three American Families (1985):
According to fresh reports on Sunday, the Mullens were supplying Southie youths with guns. Convinced that the next day's march might be the critical moment in the entire busing saga, the Mayor and his advisers assembled at the Parkman House on Sunday afternoon. "We gotta call in the feds." Bob Kiley telephoned FBl Director Clarence Kelley, once Kevin White's choice for Boston Police Commissioner and always ready to help the Mayor out. At once Kelley ordered his Boston agents to knock on the wise guys’ doors, just to let them know the Bureau was watching.
From Palmer, Palmer & Stewart, The Encyclopedia of Martial Arts Movies (1995):
China (Cynthia Rothrock) quits the police force after accidentally killing a youngster in the line of duty and goes to visit her dad (David Blackwell), the sheriff of a small town. She finds the town under the control of a drug-dealing murderer named Sommers (Steven Kerby). Since the judge (Wil Hazlett) is also corrupt, Sheriff O'Brien is about to call in the Feds. His office is bugged by a deputy (Chad Walker) employed by Sommers. When her father and his trusted deputy are killed in a car explosion. China runs for sheriff against Sommers’ organization and cleans up the town with the help of two friends.
From William Satterthwait, Accustomed to the Dark (2004):
Carpenter used another telephone, this one at the hospital in Coral Gables, to call in the Feds.
Carpenter had been shot in the right shoulder, and his wound was more serious than mine. A couple of times, as we'd come out of the swamp, he'd blacked out, We had all been in the inflatable — him, me, and Martinez. If I hadn't been able to revive Carpenter, all of us would still be back in there somewhere.
The Feds came in, lots of them, and they took Martinez. For the next couple of days, from hospital beds in different rooms, Carpenter and I answered their questions.
From Doc Macomber, Wolf’s Remedy (2006):
They were collector items.
Gates looked at Hill. "Any more?"
"It's a regular arsenal in there."
"Yeah. Better call in the Feds. Some of these look like they may have been stolen from the military."
In the nine examples above, I don’t find even a hint that the authors intend their use of feds to be taken as hostile, derisive, skeptical, or pejorative. Instead, they appear to be using the term simply as a neutral synonym for “agents of the federal government.” But as I note in a comment below, interpretations will surely vary.