Government Contracting Research Agent
Federal procurement is a $700B+ market that runs on public data — SAM.gov posts every solicitation, FPDS records every award, and USASpending publishes every dollar — but that data is scattered, hard to synthesize, and expensive to monitor through tools like GovWin, Bloomberg Government, or GovTribe. This guide builds a Python agent for business development teams, GovCon shops, proposal managers, and consultants chasing federal work. It chains all four Superhighway endpoints — /research for the contracting landscape, /search against official procurement sources and recent bid boards, /scrape for a specific opportunity or award record, and /news for budgets, awards, and protest decisions — then uses an LLM to emit a structured opportunity brief as JSON.
This guide is for business development research purposes only. It is not legal advice. Federal procurement is governed by the FAR (Federal Acquisition Regulation), agency-specific supplements (DFARS, HHSAR, etc.), and case law. Consult a qualified government contracts attorney for compliance questions, bid protests, teaming agreements, and regulatory matters.
Overview
The agent takes a capability area or market — "IT modernization services for defense agencies", "cybersecurity professional services federal government" — and produces a structured federal opportunity brief:
- Synthesizes the contracting landscape: agency spending patterns, incumbent contractors, contract vehicles (IDIQ, BPA, GWAC), set-aside eligibility, and recompete history
- Searches official procurement data — SAM.gov solicitations, FPDS award records, USASpending spend data
- Searches recent RFPs, awards, and solicitation announcements from bid boards and agency procurement offices
- Scrapes one relevant opportunity, award, or agency-profile page for specifics
- Pulls recent procurement news: budget moves, new awards, recompete announcements, and GAO/COFC protest decisions
- Uses an LLM to generate a structured brief — vehicles, NAICS codes, set-aside landscape, incumbents, recompetes, teaming, and evaluation patterns as JSON
Who it's for: BD and capture teams, small and mid-size GovCon shops, proposal and capture managers, and consultants helping clients break into or expand within the federal market.
How it works
Five endpoint calls feed one LLM synthesis:
/research— deep synthesis of the contracting landscape: agency spending patterns, incumbent contractors, typical contract vehicles, set-aside eligibility, recompete history./search(official sources) — federal procurement data scoped to SAM.gov, FPDS, and USASpending./search(recent,time=month) — recent RFPs, awards, and solicitation announcements from bid boards, GovWin/GovTribe-style trackers, and agency procurement offices./scrape— one relevant URL, e.g. a SAM.gov opportunity page, an FPDS award record, or a USASpending agency profile./news(time=month) — recent procurement news: budget cuts/increases, new awards, recompete announcements, and protest decisions.
Full example
pip install openai requests python-dotenv
Create a .env file with your two keys:
SUPERHIGHWAY_API_KEY=your_key_here
OPENAI_API_KEY=your_key_here
import requests, os, json
from openai import OpenAI
SUPERHIGHWAY_KEY = os.getenv("SUPERHIGHWAY_API_KEY")
BASE = "https://superhighway.walls.sh"
HEADERS = {"Authorization": f"Bearer {SUPERHIGHWAY_KEY}"}
llm = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
DISCLAIMER = (
"This is for business development research purposes only and is not legal advice. "
"Federal procurement law is complex; consult a qualified government contracts "
"attorney for compliance, bid protests, and regulatory questions."
)
# 1. Deep synthesis of the contracting landscape
def research_landscape(query: str) -> str:
"""Agency spending, incumbents, contract vehicles, set-asides, recompete history."""
r = requests.get(
f"{BASE}/research",
params={"q": f"{query} federal contract opportunities"},
headers=HEADERS,
)
data = r.json()
return data.get("summary", "")[:3000]
# 2. Official federal procurement data: SAM.gov, FPDS, USASpending
def search_official(query: str) -> list[dict]:
"""Solicitations (SAM.gov), awards (FPDS), spend data (USASpending)."""
r = requests.get(
f"{BASE}/search",
params={"q": f"{query} site:sam.gov OR site:fpds.gov OR site:usaspending.gov"},
headers=HEADERS,
)
return r.json().get("results", [])
# 3. Recent RFPs, awards, and solicitation announcements (last month)
def search_recent(query: str) -> list[dict]:
"""Recent RFPs/awards from bid boards and agency procurement offices."""
r = requests.get(
f"{BASE}/search",
params={
"q": f"{query} government contract award RFP solicitation NAICS",
"time": "month",
},
headers=HEADERS,
)
return r.json().get("results", [])
# 4. Scrape one relevant opportunity / award / agency-profile page
def scrape_page(url: str) -> dict:
"""Pull a SAM.gov opportunity, FPDS award record, or USASpending profile."""
r = requests.post(
f"{BASE}/scrape",
json={"url": url, "mode": "markdown"},
headers=HEADERS,
)
data = r.json()
return {
"url": url,
"title": data.get("title", ""),
"content": data.get("markdown", data.get("text", ""))[:2500],
}
# 5. Recent procurement news: budgets, awards, recompetes, protests (last month)
def get_news(query: str) -> list[dict]:
"""Agency budget moves, new awards, recompetes, GAO/COFC protest decisions."""
r = requests.get(
f"{BASE}/news",
params={
"q": f"{query} federal agency contract award budget",
"time": "month",
},
headers=HEADERS,
)
return r.json().get("results", [])
def generate_brief(
query: str,
landscape: str,
official: list[dict],
recent: list[dict],
scraped: dict | None,
news: list[dict],
) -> dict | None:
"""Generate a structured federal opportunity brief as JSON."""
official_text = "\n".join(
f"- {r.get('title', '')}: {r.get('snippet', '')} ({r.get('url', '')})"
for r in official[:6]
)
recent_text = "\n".join(
f"- {r.get('title', '')}: {r.get('snippet', '')}"
for r in recent[:6]
)
news_text = "\n".join(
f"- {n.get('title', '')}: {n.get('snippet', '')}"
for n in news[:6]
)
scraped_text = ""
if scraped and scraped.get("content"):
scraped_text = f"{scraped['title']}\n{scraped['content']}"
response = llm.chat.completions.create(
model="gpt-4o-mini",
messages=[
{
"role": "system",
"content": (
"You are a federal capture and BD analyst. Use ONLY the provided "
"sources. Do not invent NAICS codes, vehicle names, agency names, "
"incumbents, or award figures — if a detail is not in the sources, "
"say 'not found in sources.' This is research support, NOT legal "
"advice; never advise on bid protests, teaming agreements, or FAR "
"compliance. Always remind the reader to verify on SAM.gov and FPDS."
),
},
{
"role": "user",
"content": f"""Write a federal contracting opportunity brief for: {query}
Contracting Landscape (synthesis):
{landscape}
Official Procurement Sources (SAM.gov / FPDS / USASpending):
{official_text}
Recent RFPs / Awards / Solicitations:
{recent_text}
Scraped Opportunity / Award Page:
{scraped_text}
Recent Procurement News:
{news_text}
Return JSON with ALL of these fields:
- opportunity_overview: what the agency buys in this space, typical contract sizes, award frequency
- key_agencies: list of top agencies spending in this area
- typical_contract_vehicles: list (IDIQ, BPA, GWAC, SBIR, etc — contract mechanism used)
- naics_codes: list of relevant 6-digit NAICS codes for this work
- set_aside_landscape: small business, 8(a), SDVOSB, HUBZone, WOSB set-aside prevalence in this space
- incumbent_contractors: known prime contractors currently holding work in this space (from FPDS/USASpending)
- recompete_opportunities: known upcoming recompetes or expiring contracts
- teaming_considerations: typical teaming structures, subcontracting patterns, mentor-protege programs relevant here
- evaluation_criteria: typical evaluation factors (technical, past performance, price weighting patterns in this space)
- recent_awards: notable recent awards in this space (from news/FPDS)
- data_quality: "high" | "medium" | "low" — based on how well search results covered federal procurement sources
- disclaimer: always exactly the disclaimer string provided below""",
},
],
response_format={"type": "json_object"},
)
try:
brief = json.loads(response.choices[0].message.content)
brief["disclaimer"] = DISCLAIMER
return brief
except (json.JSONDecodeError, KeyError):
return None
def research_govcon(query: str) -> dict | None:
"""Run the full federal contracting research pipeline."""
print(f"Researching federal opportunities: {query}")
print("Synthesizing contracting landscape...")
landscape = research_landscape(query)
print("Searching official procurement sources...")
official = search_official(query)
print("Searching recent RFPs and awards...")
recent = search_recent(query)
print("Scraping a relevant opportunity/award page...")
scraped = None
for result in official + recent:
url = result.get("url")
if url and ("sam.gov" in url or "fpds.gov" in url or "usaspending.gov" in url):
scraped = scrape_page(url)
if scraped.get("content"):
break
print("Pulling recent procurement news...")
news = get_news(query)
print("Generating opportunity brief...")
return generate_brief(query, landscape, official, recent, scraped, news)
def print_brief(brief: dict):
if not brief:
print("Could not generate brief.")
return
print(f"\n{'='*60}")
print(f"Federal Opportunity Brief")
print(f"{'='*60}")
print(f"\nOpportunity Overview:\n{brief.get('opportunity_overview', '')}")
print(f"\nKey Agencies: {', '.join(brief.get('key_agencies', []))}")
print(f"Contract Vehicles: {', '.join(brief.get('typical_contract_vehicles', []))}")
print(f"NAICS Codes: {', '.join(brief.get('naics_codes', []))}")
print(f"\nSet-Aside Landscape:\n{brief.get('set_aside_landscape', '')}")
print(f"\nIncumbent Contractors:\n{brief.get('incumbent_contractors', '')}")
print(f"\nRecompete Opportunities:\n{brief.get('recompete_opportunities', '')}")
print(f"\nTeaming Considerations:\n{brief.get('teaming_considerations', '')}")
print(f"\nEvaluation Criteria:\n{brief.get('evaluation_criteria', '')}")
print(f"\nRecent Awards:\n{brief.get('recent_awards', '')}")
print(f"\nData Quality: {brief.get('data_quality', '?')}")
print(f"\n{brief.get('disclaimer', '')}")
if __name__ == "__main__":
import sys
query = sys.argv[1] if len(sys.argv) > 1 else "IT modernization services for defense agencies"
brief = research_govcon(query)
print_brief(brief)
Usage examples
- "IT modernization services for defense agencies" — surfaces the major IT contract vehicles (OASIS+, CIO-SP4, GSA MAS), which DoD components are spending, typical IT NAICS codes (e.g. 541512, 541519), and where small business and 8(a) set-aside lanes exist.
- "cybersecurity professional services federal government" — agency demand signals, relevant GWAC vehicles (NASA SEWP, GSA 8(a) STARS III), and the small business set-aside landscape for cyber work, plus recent awards and recompetes.
- "environmental consulting EPA contract opportunities" — EPA procurement patterns, relevant NAICS codes (e.g. 541620, 541330), typical award sizes, and recompete timelines for environmental IDIQs and BPAs.
Federal procurement rules change frequently. Always verify opportunity details directly on SAM.gov and FPDS.gov. This tool provides research starting points — not verified procurement data. Consult legal counsel for compliance questions.
Getting your API key
Grab a free Superhighway key at /pricing (1,000 calls/month, no credit card). For an agent that provisions its own access, skip the key entirely with x402: it pays $0.002 per call in USDC on Base — no signup, no key management. See the x402 pay-per-call guide for the wallet setup.
See also
The regulatory research agent applies the same four-endpoint pattern to compliance and regulatory questions, and the M&A research agent uses it for deal and transaction due diligence.