The actress has a meaty part reprising her role from "The Avengers" in the pilot of Joss Whedon's upcoming drama.

It's official: Cobie Smulders is joining ABC's Joss Whedon superhero drama series Marvel's Agents of SHIELD.

The Hollywood Reporter has learned that the How I Met Your Mother star has worked out a deal with producer ABC Studios and Marvel Television to reprise her role as Agent Maria Hill from Whedon's The Avengers film.

Sources tell THR that Smulders is so far set for a one-off cameo role in the pilot because she's contractually committed to CBS' How I Met Your Mother, though the actress could return for another similar spot in the future.

PHOTOS: ABC's 2013-14 Season: 'S.H.I.E.L.D.,' 'Once Upon a Time in Wonderland,' More

On Friday at Comic-Con in San Diego, ABC and Marvel were to screen the pilot for SHIELD during a panel set for Ballroom 20. The pilot was not included in the typical freshman series screeners sent to critics in May in an effort to keep the news under wraps. Whedon is slated to be joined by "surprise guests" during the session. It was unclear if Smulders, who will be at Comic-Con for How I Met Your Mother's panel on Saturday, will participate in the SHIELD panel.

"I wanted very much to have Cobie in the pilot because as much as anyone else, she IS SHIELD. She's cool and commanding and has the dry humor that plays so well with Clark's [Gregg]. Also, if she's in it, I get to hang out with Cobie," Whedon said in a statement to THR.

The news comes as Smulders is in production on the ninth and final season of How I Met Your Mother, which hails from producer 20th Century Fox Television.

SHIELD is based on Marvel Comics' secret intelligence organization that has appeared in countless titles including Iron Man, Captain America and The Ultimates since being introduced in the 1960s. The military law-enforcement agency's moniker stands for Strategic Homeland Intervention Enforcement and Logistics Division, which also has evolved over time in the comics.

Agent Hill was last seen in the 2012 blockbuster Avengers, and Smulders has already signed on to reprise her role in Marvel's Captain America: The Winter Soldier, with rumors that she could also appear in Whedon's Avengers sequel.

PHOTOS: Broadcast TV's Returning Shows 2013-14

Smulders becomes the second Avengers star to join SHIELD. Gregg became the first to sign on to SHIELD in October when he agreed to reprise his Avengers role as Agent Phil Coulson. The character is a key member of the elite task force in Iron Man, Iron Man 2, Thor and Disney XD's Ultimate Spider-Man. The role brings Coulson, who died in Avengers, mysteriously back to life.

Confirmation of Smulders' role in the pilot comes months after the actress opened the door to participate in Whedon's first TV series since Dollhouse, telling THR in January that there have been "some talks" about involving Hill in the ABC series.

"Joss Whedon is a genius, and any opportunity that I have to say words that he has written, I will take. ... I love Clark and want to be a part of it, but we'll see," she said.

Previews for the ABC series, which will air Tuesdays in the fall, have included glimpses at the superheroes from the feature films -- including Captain America, Iron Man, Thor and The Hulk -- though the actors who have played the heroes in the films (Chris Evans, Robert Downey Jr., Chris Hemsworth and Mark Ruffalo, respectively) do not appear.

Whether any of the big-screen talent could follow Smulders and Gregg and pop up on the ABC series remains unclear. Meanwhile, Samuel L. Jackson -- who played Nick Fury in The Avengers and in the upcoming Captain America sequel -- has noted that he'd be open to having some sort of role with the series.

Whedon is on board to co-pen the pilot alongside his brother Jed Whedon and Jed's wife, Maurissa Tancharoen; the trio previously teamed on the three-part web series Dr. Horrible's Sing-Along Blog. Joss Whedon directed the pilot. SHIELD is executive produced by Joss and Jed Whedon, Tancharoen, Jeffrey Bell and Marvel TV's Jeph Loeb.

Smulders is repped by UTA, ROAR and Gang Tyre.

E-mail: Lesley.Goldberg@THR.com

Twitter: @Snoodit