# Research an agency before a capture

To research an agency before a capture with an AI agent, ask it to call search_awards, search_opportunities and recompetes with the agency and your NAICS codes. Together they show what the agency bought recently and from whom, what it is soliciting now, and which contracts end in the next year, in one dated briefing.

Business development leads preparing for a meeting with a small business specialist or an industry day. Arriving with the agency's own buying pattern (codes, vehicles, incumbents, timing) turns a generic pitch into a specific conversation.

## The prompt

```
Brief me on what the Department of Homeland Security buys under NAICS 541512 and 541519: top recipients and vehicles in the last fiscal year, what is open now, and which contracts end in the next 12 months.
```

## What the agent calls

1. search_awards: Who won and through which vehicles.

```json
{"name":"search_awards","arguments":{"agency":"Department of Homeland Security","naics":"541512","fiscal_year":2026,"limit":100,"user_request":"DHS IT agency briefing"}}
```

2. search_opportunities: What is out for bid or market research now.

```json
{"name":"search_opportunities","arguments":{"agency":"Department of Homeland Security","naics":"541512,541519","open":true,"user_request":"DHS IT agency briefing"}}
```

3. recompetes: Which awards end within the year.

```json
{"name":"recompetes","arguments":{"agency":"Department of Homeland Security","naics":"541512","months_ahead":12,"user_request":"DHS IT agency briefing"}}
```

## Sample output

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

```json
{
  "data": [
    {
      "awarding_sub_agency": "U.S. Customs and Border Protection",
      "recipient_name": "EXAMPLE SYSTEMS CORP",
      "potential_end_date": "2027-03-31",
      "parent_piid": "70B04C22A00000025",
      "award_type": "BPA CALL"
    }
  ]
}
```

## How to read the answer

- Sub-agencies buy differently. Group the briefing by awarding_sub_agency: a department-level view hides that one component buys most of the work.
- parent_piid repeated across many awards marks a vehicle the agency relies on; being on it may matter more than any single bid.

## Make it yours

- Use agency_code (from the agencies list) instead of a name for an exact match.
- Ask for a one-page briefing document the agent writes into your notes.

## Pitfalls

- Three calls on a busy agency can return hundreds of rows; set limits and ask for summaries.
- Agency forecasts of future buys are published separately by each agency and are not in this data.

## The same job over REST

```bash
curl "https://samgovapi.io/api/v1/recompetes?agency=Department%20of%20Homeland%20Security&naics=541512&months_ahead=12" -H "Authorization: Bearer $SAMGOVAPI_API_KEY"
```

Plan: every plan. Credits: 1 credit per 100 rows returned, minimum 1 per call.

## Questions

### Does the API include agency procurement forecasts?

No. Forecasts are published by each agency. This briefing uses awards, open notices and contract end dates.

### How do I get agency codes?

GET /api/v1/agencies lists departments and sub-agencies with their codes.

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.
