DEV Community

Cover image for Tech-Powered Grant Matching: A Full-Stack AI Agent in Action
Kevin
Kevin

Posted on

1 1 1

Tech-Powered Grant Matching: A Full-Stack AI Agent in Action

This is a submission for the Agent.ai Challenge: Full-Stack Agent (See Details)

What I Built

AspireMatch is an full-stack AI-powered agent designed for Agent.ai and to bridge the gap between organizations and the funding opportunities they need to thrive. The agent processes daily grant data from Grants.gov, analyzes it with AI, and matches grants to organizations based on their unique mission and needs. By leveraging an external API I built on Amazon Web Services (AWS) and advanced AI, AspireMatch ensures organizations find relevant funding opportunities quickly and efficiently.

I built AspireMatch to solve a critical problem: navigating the overwhelming number of grants available! Grants.gov publishes thousands, and clicking through each item in their database to find the description or eligibility criteria is a hassle. Many organizations, especially smaller nonprofits, struggle to identify grants they qualify for. AspireMatch automates this process, making it accessible and time-efficient.

How Aspire Match was built

How did I build a full-stack agent like AspireMatch? In this article, we will discuss how AspireMatch works and how its backend which can be deployed to AWS interacts with Agent.ai. AspireMatch combines several technologies into a seamless workflow:

  • Daily Grant Data Retrieval: AspireMatch uses a cloud-based Lambda function to retrieve grant data from Grants.gov. Grants.gov updates their database every day in a massive archive that can be retrieved from their website. Processing this data daily ensures the agent always processes the latest information without overburdening their servers. The function parses the XML data provided by Grants.gov and prepares it for AI analysis by extracting descriptions, links, and closing dates. It then puts the filtered data into an S3 bucket where it can be retrieved by subsquent invocations of the agent on Agent.ai that day. This way we only hit Grants.gov a single time per day and subsequent invocations are much faster, as Lambda simply returns the URL of the filtered JSON data on S3.
  • AI Matching via Claude 3.5: The agent sends the truncated grant data, along with a description of the user’s organization (provided by the user or scraped from their website), to Claude 3.5. Claude analyzes the data and identifies grants most aligned with the organization’s mission, explaining why each grant is a good match. Data is carefully truncated to keep inputs under the approximate maximum of 700,000 characters for Claude 3.5. Care was taken in prompt engineering to reduce hallucinations and provide an orderly output:
Given the following description of an organization and/or the text from their website, use the provided grant data to recommend grants that they would qualify for.

**Instructions:**
1. Analyze the organization description to understand their mission, goals, and activities.
2. Analyze the provided grant data to identify relevant grants.
3. Recommend grants that align with the organization's mission, goals, and activities.
4. Provide a brief explanation for each recommended grant, detailing why it is a good fit for the organization.

**Example Output:**
1. **Grant Title:** [Grant Title]
   - **Description:** [Grant Description]
   - **Close Date:** [Close Date]
   - **Website:** [URL if available]
   - **Reason for Recommendation:** [Explanation of why this grant is a good fit for the organization]
Enter fullscreen mode Exit fullscreen mode
  • User-Friendly Results: The agent outputs a curated list of matching grants, complete with contact information, eligibility details, and a brief explanation for each match. This saves users hours of manual research. Check out an example for a hypothetical environmental education organization below: A list of grants suggested for a green energy organization by AspireMatch
  • Streamlined Deployment: Using the Agent.ai platform, AspireMatch integrates seamlessly with external APIs and cloud services, ensuring reliability and scalability. The backend deploys in minutes using CloudFormation, producing an API Gateway endpoint that can be used with Agent.ai via its advanced actions feature. This endpoint returns where the agent can retrieve the list of latest grants after it either produces it or retrieves it.

Here is how the architecture works:

AspireMatch Architecture Diagram

  1. AWS CloudFormation: The CloudFormation template (cloudformation.yml) defines the infrastructure for the project. It includes resources such as an S3 bucket, IAM roles, a Lambda function, and API Gateway.
  2. GrantsS3Bucket: An S3 bucket is created to store the parsed grant data.
  3. GrantsS3BucketPolicy: A bucket policy is attached to allow public read access and specific permissions for the Lambda function.
  4. LambdaExecutionRole: An IAM role is created for the Lambda function with permissions to interact with S3 and CloudWatch Logs. The role allows the Lambda function to assume the role and perform actions such as s3:PutObject, s3:GetObject, s3:HeadObject, and logging actions.
  5. GrantsLambdaFunction: A Lambda function is created to process and analyze grant data. The function downloads, extracts, and parses XML data from Grants.gov, and then stores the relevant information in the S3 bucket. The function is triggered by API Gateway.
  6. API Gateway: ApiGatewayRestApi: An API Gateway REST API is created to provide an endpoint for querying grant data. ApiGatewayResource: A resource is created under the API for the /grants path. ApiGatewayMethod: A GET method is created for the /grants resource, integrated with the Lambda function using AWS_PROXY integration. ApiGatewayDeployment: The API is deployed to a stage named prod.
  7. Lambda Invoke Permission: A permission is added to allow API Gateway to invoke the Lambda function.
  8. Outputs: The CloudFormation template outputs the S3 bucket name, Lambda function ARN, and API Gateway invoke URL.

You can check out the code and deploy it for yourself using our repo!

GitHub logo kevinl95 / AspireMatch

Unlock Funding Potential with AI: Find the Right Grants, Faster

AspireMatch

A brain with a leaf in the middle, colored green. Below is the text Aspire Match

Lint CloudFormation Templates

AspireMatch is the backend service for an agent on Agent.ai that matches organizations with grants from Grants.gov based on their websites or textual descriptions.

Overview

AspireMatch leverages AWS Lambda and API Gateway to process and analyze grant data from Grants.gov. The service uses a Lambda function to download, extract, and parse XML data from grants.gov, and then stores the relevant information in an S3 bucket. The agent on Agent.ai can then use this data to recommend grants to organizations based on their mission, goals, and activities.

Features

  • Grant Data Extraction: Downloads and extracts grant data from grants.gov.
  • XML Parsing: Parses XML data to identify relevant grants.
  • S3 Storage: Stores parsed grant data in an S3 bucket.
  • API Gateway Integration: Provides an API endpoint for the Agent.ai agent to query grant data.
  • Grant Recommendations: Matches organizations with suitable grants based on their website or…

Demo

Try it today here!

Agent.ai Experience

Building AspireMatch on the Agent.ai platform was a rewarding experience. The platform’s support for web API integration made it straightforward to connect with Grants.gov and the wide variety of LLMs available on the platform made it possible to use massive context windows like the one provided by Claude 3.5.

Delightful Moments

  • Adding our API endpoint to Agent.ai was trivial, and although we could not parse the JSON output directly it was easy and fun to add another stage where o1-mini retrieved the results we wanted from the payload
  • The agent setup menu makes it easy and fun to market AI agents with graphics, videos, tags, and an icon
  • AI-Driven Results: Watching Claude 3.5 generate meaningful matches from complex data was truly satisfying.
  • I've never used another tool that made web scraping so easy, making it possible for us to delight our users by letting the agent scrape their website for information about their mission rather than need to summarize it for us.

Challenges

  • The Grants.gov database is massive. We needed the ability to give our Lambda function additional memory and a longer timeout, which led us to deploying our own backend using CloudFormation.
  • Context windows for LLMs remain small for tasks like this- fortunately we quickly learned that Agent.ai's Format Text actions can be used to ensure that we truncate potentially long outputs so that we still get meaningful answers from our prompts.

Overall, the platform’s flexibility and robust documentation helped overcome these challenges.

Next Steps

Future updates for AspireMatch include:

  • Expanded Grant Sources: Adding other grant databases to broaden the range of opportunities.
  • Enhanced AI Models: As context windows improve, we can pull in even more data from user sources and from the Grants.gov database, which is currently pre-filtered so it can fit.
  • User Feedback Loop: Allowing users to provide feedback to refine recommendations further.

AspireMatch is just the beginning of what’s possible with AI-driven tools for productivity and professional applications in the nonprofit, research, and business space!

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay