Building Code Research Agent avatar
Building Code Research Agent
Under maintenance

Pricing

Pay per usage

Go to Apify Store
Building Code Research Agent

Building Code Research Agent

Under maintenance

Pricing

Pay per usage

Rating

0.0

(0)

Developer

Max Xie

Max Xie

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

5 days ago

Last modified

Categories

Share

Building Code Deep Research Agent

An AI agent designed to research building codes and zoning requirements for specific construction tasks. It uses apify/rag-web-browser to search for relevant municipal or state codes (e.g., UpCodes, Municode, city websites) and extracts specific requirements.

How it works

This agent leverages a ReAct (Reason+Act) architecture using LangGraph:

  1. Search: It starts by performing a Google Search for the specific jurisdiction and building topic (e.g., "Antioch CA single family home building requirements").
  2. Navigate & Extract: It navigates to the most relevant search results (official city pages, code libraries) and extracts the text.
  3. Analyze: It uses an LLM (via OpenRouter) to analyze the text and extract specific requirements (setbacks, height limits, parking, etc.).
  4. Report: It outputs a structured BuildingCodeReport containing the findings.

How to use

Input a natural language query describing your construction task and location.

Example Query: "Search for zoning information for apartments in San Meteo County, CA, in california, south of San Francisco. Regarding where apartment is allowed to be built and what are the zoning code and requirements and all that."

The agent will output a JSON report with:

  • Jurisdiction: Detected location (e.g., "Antioch, CA").
  • Code Source: The document or website used (e.g., "Antioch Municipal Code").
  • Requirements: A list of specific requirements found.

For a more advanced multi-agent example, see the Finance Monitoring Agent actor or visit the LangGraph documentation.

Pay Per Event

This template uses the Pay Per Event (PPE) monetization model, which provides flexible pricing based on defined events.

To charge users, define events in JSON format and save them on the Apify platform. Here is an example schema with the task-completed event:

[
{
"task-completed": {
"eventTitle": "Task completed",
"eventDescription": "Cost per query answered.",
"eventPriceUsd": 0.1
}
}
]

In the Actor, trigger the event with:

await Actor.charge(event_name='task-completed')

This approach allows you to programmatically charge users directly from your Actor, covering the costs of execution and related services, such as LLM input/output tokens.

To set up the PPE model for this Actor:

  • Configure the OpenAI API key environment variable: provide your OpenAI API key to the OPENAI_API_KEY in the Actor's Environment variables.
  • Configure Pay Per Event: establish the Pay Per Event pricing schema in the Actor's Monetization settings. First, set the Pricing model to Pay per event and add the schema. An example schema can be found in .actor/pay_per_event.json.

Included features

  • Apify SDK for Python - a toolkit for building Apify Actors and scrapers in Python
  • Input schema - define and easily validate a schema for your Actor's input
  • Dataset - store structured data where each object stored has the same attributes
  • Key-value store - store any kind of data, such as JSON documents, images, or text files

Resources

Getting started

For complete information see this article. To run the Actor use the following command:

$apify run

Deploy to Apify

Connect Git repository to Apify

If you've created a Git repository for the project, you can easily connect to Apify:

  1. Go to Actor creation page
  2. Click on Link Git Repository button

Push project on your local machine to Apify

You can also deploy the project on your local machine to Apify without the need for the Git repository.

  1. Log in to Apify. You will need to provide your Apify API Token to complete this action.

    $apify login
  2. Deploy your Actor. This command will deploy and build the Actor on the Apify Platform. You can find your newly created Actor under Actors -> My Actors.

    $apify push

Documentation reference

To learn more about Apify and Actors, take a look at the following resources: