# Size a federal market by NAICS and agency

To size a federal market with an AI agent, ask it to call search_awards with the NAICS code, the agency and the fiscal year, paging with next_cursor, then total the obligated amounts and group them by recipient and set-aside. The result is spend, top vendors and small business share for that code at that agency, dated by the award load.

Founders entering the federal market, investors reading a contractor's pipeline, and capture teams choosing which agency to target. Market size by code and customer is the first number in any federal business plan, and it changes year to year with budgets.

## The prompt

```
How much did the Department of Veterans Affairs obligate under NAICS 541512 in fiscal year 2026? Give me the total, the top ten recipients with their share, and how much went through small business set-asides.
```

## What the agent calls

1. search_awards: Award rows for the code, agency and year; the agent pages until next_cursor is null and does the arithmetic.

```json
{"name":"search_awards","arguments":{"naics":"541512","agency":"Department of Veterans Affairs","fiscal_year":2026,"limit":100,"user_request":"size VA 541512 market FY2026"}}
```

## Sample output

Trimmed; field names and structure match the live response, values are shortened or illustrative.

```json
{
  "data": [
    {
      "piid": "36C10B26F0123",
      "recipient_name": "EXAMPLE SYSTEMS CORP",
      "awarding_agency": "Department of Veterans Affairs",
      "naics": "541512",
      "fiscal_year": 2026,
      "obligated": 2250000,
      "set_aside": "SBA"
    }
  ],
  "meta": {
    "credits_charged": 1,
    "next_cursor": "eyJ..."
  }
}
```

## How to read the answer

- Totals are only as complete as the pages fetched. The agent should report how many rows it summed and whether it reached the last page.
- set_aside is the set-aside on the award as reported; NONE means full and open, and blank means not reported.

## Make it yours

- Ask for several fiscal years to see the trend.
- Add min_amount to ignore small purchases and focus on contract-sized work.
- For a whole department across many codes, use a 4-digit NAICS prefix.

## Pitfalls

- Large markets have thousands of rows. Set a page budget in the prompt (for example ten pages) so the agent does not spend more credits than you expect.
- Obligations are not revenue: multi-year awards obligate funds in pieces.

## The same job over REST

```bash
curl "https://samgovapi.io/api/v1/awards?naics=541512&agency=Department%20of%20Veterans%20Affairs&fiscal_year=2026&limit=100" -H "Authorization: Bearer $SAMGOVAPI_API_KEY"
```

Plan: every plan. Credits: 1 credit per 100 rows returned, minimum 1; one credit per page of 100.

## Questions

### Why do my totals differ from USAspending's own charts?

Filters differ: agency versus funding agency, action date versus fiscal year, and which award types are included. Say which filters you used when you quote a number.

### Is there a cheaper way for very large markets?

The Scale plan's bulk CSV export returns awards in pages of up to 10,000 rows at a bulk credit rate.

All recipes: https://samgovapi.io/agents/recipes.md

Independent. Not affiliated with, endorsed by or sponsored by GSA, SAM.gov or any U.S. government agency. Registering in SAM.gov is free at sam.gov.
