Appearance
Recipe: Federal RFP Scout
This recipe walks you through building an automated RFP scouting workflow using Pencel's built-in primitives. When you're done, you'll have a workflow that:
- Pulls federal contract opportunities from sam.gov
- Stages each opportunity as a typed record for in-context scoring
- Deduplicates against previous runs via promoted
seen_items - Scores each opportunity against your criteria using a guideline
- Produces a digest document with only the relevant opportunities
Time to set up: ~15 minutes Runs unattended afterward: Yes (schedule it)
Step 1: Get a sam.gov API key
- Go to https://sam.gov/content/entity-registration
- Register for an account (or sign in)
- Request an API key from https://open.gsa.gov/api/get-opportunities-public-api/
- Copy your API key — you'll need it in the next step
Step 2: Store your API key in Pencel
- Open Settings > Credentials
- Click Add Credential
- Fill in:
- Name:
sam-gov - Field:
apiKey - Value: (paste your API key)
- Name:
- Click Save
Your API key is now encrypted in your OS keychain. Pencel agents can access it via the use_credential tool, but the value is automatically redacted from all logs, traces, and memory.
Step 3: Create a scoring guideline
- Go to the Knowledge page
- Create a new guideline with these rules:
Score each federal opportunity 0-100 using these criteria:
- 40 points if the primary NAICS code is in [541330, 541512, 541511, 541519, 541690]
- 30 points if the estimated value is > $50,000 (or if no value is listed, give 15 points)
- 30 points if the response deadline is more than 5 business days away
Only recommend opportunities scoring 70 or higher. For each recommended opportunity, include:
- Title, solicitation number, and link
- NAICS code and estimated value
- Response deadline
- One-sentence summary of why it scored wellSet the activation mode to Always active (or scope it to your RFP scout agent).
Step 4: Create the workflow from template
- Go to Workflows
- Click New Workflow
- Select the RFP Scout template
- Review the instructions — they tell the agent exactly how to fetch, stage, score, and finalize
Step 5: Run it manually first
- Open the workflow and click Run
- Watch the agent:
- Call
use_credentialto get the API key - Call
fetch_webto pull opportunities from sam.gov - Call
filter_unseento drop duplicates from previous runs - Call
stage_recordfor each new opportunity (typed record with NAICS, value, deadline) - Call
query_recordsto pull all staged opportunities into context for scoring - Score each opportunity against your guideline
- Call
finalize_recordswithpromoteToSeenStream: "rfp:federal"for qualifying opportunities — this marks them as finalized AND adds them to the cross-run dedup stream in one call - Output a digest document
- Call
- Review the digest — does it match your expectations?
Step 6: Schedule it
- Open the workflow settings
- Add a Schedule trigger (e.g., every weekday at 8:00 AM)
- If the agent ever needs your input during a scheduled run, you'll get a desktop notification
How it works: the stage → query → finalize pattern
The key insight is that stage_record / query_records / finalize_records give the agent a working memory outside the conversation context:
- Stage each fetched opportunity as a typed record. This externalizes the data so the context window stays clean even with hundreds of items.
- Query the staged records back when it's time to score. The agent can filter, page, and review them without keeping everything in-context the whole time.
- Finalize the qualifying records. When you pass
promoteToSeenStream, finalization also marks the keys inseen_items— so the next run'sfilter_unseenautomatically skips them. No separatemark_seenstep needed.
Adapting for other sources
This same pattern works for any API that returns JSON:
- Store the credentials in Settings > Credentials
- Update the workflow instructions to call a different URL via
fetch_web - Adjust the scoring guideline for your criteria
- Use a different collection name in
stage_recordand a different stream inpromoteToSeenStream(e.g.,"rfp:state-dot")
No code changes needed — just update the workflow instructions and guideline text.
