Testing modern web applications can be difficult, with frequent changes and complex features making it hard to keep up. That's where Hercules comes in. Hercules is the world's first open-source testing agent, built to handle the toughest testing tasks so you don't have to. It turns simple, easy-to-write Gherkin steps into fully automated end to end tests—no coding skills needed. Whether you're working with tricky enterprise platforms or running tests in your CI/CD pipeline, Hercules adapts to your needs and takes care of the details. With Hercules, testing becomes simple, reliable, and efficient, helping teams everywhere deliver better software. Here's a quick demo of lead creation using natural english language test (without any code):
As you saw, using Hercules is as simple as feeding in your Gherkin features, and getting the results:
At TestZeus, we believe that trustworthy and open-source code is the backbone of innovation. That's why we've built Hercules to be transparent, reliable, and community-driven.
Our mission? To democratize and disrupt test automation, making top-tier testing accessible to everyone, not just the elite few. No more gatekeeping—everyone deserves a hero on their testing team!
Video Tutorials: @TestZeus
-
Introduction to TestZeus Hercules
Learn about the core features of TestZeus Hercules and how it can streamline end-to-end testing for your projects.
-
Installation and Setup Guide
Step-by-step instructions for installing and configuring TestZeus Hercules in your environment.
Watch now
- Creating BDD Test Cases
Learn how to write Behavior-Driven Development (BDD) test cases for Hercules and use dynamic testdata.
Watch now
- Testing Multilingual content
Learn how Hercules interacts with web browsers to perform Testing on Multilingual content via Multilingual testcase.
Watch now
- Enhancing Hercules with Community-Driven Tools
Discover how to customize Hercules and incorporate additional tools provided by the community.
Watch now
- API testing all the way, new ways to do end to end
Watch now
- Security Testing done end to end
Watch now
- Using vision capabilities to check snapshots and components on the application
Watch now
- Execute custom Python scripts directly from Gherkin tests
Run complex automation workflows, custom business logic, and reusable components with full Playwright access. Perfect for scenarios that need advanced selector strategies, conditional logic, or data processing. Read the docs
Quick Example:
# In your feature file
And execute the apply_filter function from script at "scripts/apply_filter.py" with filter_type as "Turtle Neck"# In opt/scripts/apply_filter.py
async def apply_filter(filter_type: str) -> dict:
"""Apply filter with multiple fallback strategies."""
# page, logger, and other tools automatically available!
await page.wait_for_selector('[data-filter-section]')
# Try multiple selector strategies
for selector in [f'input[value="{filter_type}"]',
f'label:has-text("{filter_type}") input']:
if await page.locator(selector).count() > 0:
await page.locator(selector).click()
break
return {"status": "success", "filter": filter_type}Features:
- 🎯 Full Playwright API access
- 🔒 Multi-tenant security (executor, data, API, restricted modes)
- 📦 Auto-injected modules (page, browser, logger, asyncio, etc.)
- 🔄 Reusable across multiple tests
- ⚙️ Configurable via environment variables
Configuration:
# Set tenant for module access
export SANDBOX_TENANT_ID="executor_agent" # Full access: requests, pandas, numpy, BeautifulSoup
# Or use CLI
testzeus-hercules --sandbox-tenant-id executor_agent --input-file test.featureHercules offers multiple ways to get started, catering to different user preferences and requirements. If you are new to the Python ecosystem and don't know where to begin, dont worry and read the footnotes on understanding the basics.
For a quick taste of the solution, you can try the notebook here:
- Note: Colab might ask you to restart the session after installing TestZeus Hercules dependencies. Please restart the session if required and continue the execution. Also, we recommend one of the approaches below for getting the full flavor of the solution.
Install Hercules from PyPI:
pip install testzeus-herculesHercules uses Playwright to interact with web pages, so you need to install Playwright and its dependencies:
playwright install --with-depsFor detailed information about project structure and running tests, please refer to our Run Guide. For migration-specific runtime behavior, see docs/Migration/MIGRATION.md and docs/Migration/ARCHITECTURE.md.
Once installed, you will need to provide some basic parameters to run Hercules:
--input-file INPUT_FILE: Path to the input Gherkin feature file to be tested.--output-path OUTPUT_PATH: Path to the output directory. The path of JUnit XML result and HTML report for the test run.--test-data-path TEST_DATA_PATH: Path to the test data directory. The path where Hercules expects test data to be present; all test data used in feature testing should be present here.--project-base PROJECT_BASE: Path to the project base directory. This is an optional parameter; if you populate this,--input-file,--output-path, and--test-data-pathare not required, and Hercules will assume all the three folders exist in the following format inside the project base:
PROJECT_BASE/
├── gherkin_files/
├── input/
│ └── test.feature
├── log_files/
├── output/
│ └── run_<timestamp>/
│ ├── test.feature_result.html
│ └── test.feature_result.xml
├── proofs/
│ └── User_opens_Google_homepage/
│ └── run_<timestamp>/
│ ├── network_logs.json
│ ├── screenshots/
│ └── videos/
└── test_data/
└── test_data.txt
--agents-llm-config-file AGENTS_LLM_CONFIG_FILE: Optional path to anagents_llm_config.jsonfile for per-agent model routing.--agents-llm-config-file-ref-key AGENTS_LLM_CONFIG_FILE_REF_KEY: Optional top-level provider/profile key inside that file.--llm-model,--llm-model-api-key,--llm-model-base-url, and related direct LLM flags are still supported for simple single-profile setups. Useagents_llm_config.jsonwhen you need separate planner, navigation, memory, and helper model settings.
In addition to command-line parameters, Hercules supports various environment variables for configuration:
LLM_MODEL_NAME: Model name for direct single-model setup. Example:gpt-4oLLM_MODEL_API_KEY: API key for the selected model provider.LLM_MODEL_BASE_URL: Optional OpenAI-compatible base URL.AGENTS_LLM_CONFIG_FILE: Optional path toagents_llm_config.jsonfor per-agent model routing.AGENTS_LLM_CONFIG_FILE_REF_KEY: Optional top-level provider/profile key to activate from that config file.BROWSER_TYPE: Type of browser to use (chromium,firefox,webkit). Default:chromiumHEADLESS: Run browser in headless mode (true,false). Default:trueBROWSER_RESOLUTION: Browser window resolution (format:width,height). Example:1920,1080BROWSER_COOKIES: Set cookies for the browser context. Format: JSON array of cookie objects. Example:[{"name": "session", "value": "123456", "domain": "example.com", "path": "/"}]RECORD_VIDEO: Record test execution videos (true,false). Default:trueTAKE_SCREENSHOTS: Take screenshots during test (true,false). Default:true
For a complete list of environment variables, see our Environment Variables Guide.
Set the direct model environment variables and run Hercules:
export LLM_MODEL_NAME=gpt-4o
export LLM_MODEL_API_KEY=replace-me
export LLM_MODEL_BASE_URL=https://api.openai.com/v1
testzeus-hercules \
--input-file opt/input/test.feature \
--output-path opt/output \
--test-data-path opt/test_dataUse agents_llm_config.json only when you need separate planner, navigation,
memory, and helper model settings; see docs/run_guide.md.
To set up and run Hercules on a Windows machine:
-
Open PowerShell in Administrator Mode:
- Click on the Start Menu, search for PowerShell, and right-click on Windows PowerShell.
- Select Run as Administrator to open PowerShell in administrator mode.
-
Navigate to the Helper Scripts Folder:
- Use the
cdcommand to navigate to the folder containing thehercules_windows_setup.ps1script. For example:cd path\to\helper_scripts
- Use the
-
Run the Setup Script:
- Execute the script to install and configure Hercules:
.\hercules_windows_setup.ps1
- Execute the script to install and configure Hercules:
-
Follow On-Screen Instructions:
- The script will guide you through installing Python, Playwright, FFmpeg, and other required dependencies.
-
Run Hercules:
- Once the setup is complete, you can run Hercules from PowerShell or Command Prompt using the following command:
testzeus-hercules --input-file opt/input/test.feature --output-path opt/output --test-data-path opt/test_data
- Once the setup is complete, you can run Hercules from PowerShell or Command Prompt using the following command:
- OpenAI: Use models with reliable tool-calling support, such as GPT-4o, GPT-4.1, o-series models, or GPT-5 family models where available.
- Anthropic: Use Claude models with tool-calling support.
- Gemini / Vertex AI: Supported through OpenAI-compatible gateways such as LiteLLM. Keep tool schemas simple; tuple-style public tool inputs are not provider-safe.
- Gemma: Supported through gateways or local providers that expose compatible chat and tool-calling behavior.
- Groq, Mistral, Ollama, DeepSeek, Bedrock, Azure, and other providers can be used when they support OpenAI-compatible chat and function/tool calling.
- Local: Ollama and other local providers can be used when their model reliably
returns strict planner JSON and supports the required tool-calling behavior.
The sample Ollama Modelfile lives at
docs/Migration/Modelfile.
The planner model should be strong at structured JSON reasoning. Navigation
models must support tool calling. For a quick run, direct LLM_MODEL_*
environment variables are enough. Use agents_llm_config.json only when you
need separate planner, navigation, memory, and helper model settings. See
docs/run_guide.md and docs/environment_variables.md for full examples,
including LiteLLM proxy setup.
Upon running the command:
- Hercules will start and attempt to open a web browser (default is Chromium).
SimpleHerculescreates a LangGraph state graph for the run.- The planner node turns the feature file into strict JSON containing the
current plan,
next_step,target_helper, and assertion fields. - The executor node routes the planner's
target_helperto a navigation helper such asbrowser_nav_agent,api_nav_agent,sec_nav_agent,sql_nav_agent,time_keeper_nav_agent,mcp_nav_agent, orexecutor_nav_agent. - Navigation helpers bind registered LangChain
StructuredToolobjects and run a bounded tool-call loop. Browser tasks use tools such asopen_url,click,get_interactive_elements,bulk_enter_text, andbulk_select_option. - Helper responses are fed back to the planner until the planner terminates or routes to assertion handling.
Once the execution is completed:
- Logs explaining the sequence of events are generated.
- The best place to start is the
output-path, which will have the JUnit XML result file as well as an HTML report regarding the test case execution. - You can also find proofs of execution such as video recordings, screenshots per event, and network logs in the
proofsfolder. - To inspect the planner and helper trace, start with
agent_inner_thoughts.jsonunderlog_files/<scenario_name>/run_<timestamp>/.
Here's a sample feature file:
Feature: Product Search on Demo Store
Scenario: Successfully find a product
Given I am on the demo store home page
When I enter "wireless headphones" in the search field
And I click on the "Search" button
And I open the first matching product result
Then I should see the product details page
And I should see "wireless headphones" in the product title or descriptionFor all the scale lovers, Hercules is also available as a Docker image.
docker pull testzeus/hercules:latestRun the container using:
docker run --env-file=.env \
-v ./agents_llm_config.json:/testzeus-hercules/agents_llm_config.json \
-v ./opt:/testzeus-hercules/opt \
--rm -it testzeus/hercules:latest- Environment Variables: All the required environment variables can be set by passing an
.envfile to thedocker runcommand. - LLM Configuration: Either pass direct
LLM_MODEL_*values in.envor mountagents_llm_config.jsonand setAGENTS_LLM_CONFIG_FILE=agents_llm_config.jsonplusAGENTS_LLM_CONFIG_FILE_REF_KEY=<provider-key>. LiteLLM is one useful provider profile when you run through an OpenAI-compatible proxy. - Mounting Directories: Mount the
optfolder to the Docker container so that all the inputs can be passed to Hercules running inside the container, and the output can be pulled out for further processing. The repository has a sampleoptfolder that can be mounted easily. - Simplified Parameters: In the Docker case, there is no need for using
--input-file,--output-path,--test-data-path, or--project-baseas they are already handled by mounting theoptfolder in thedocker runcommand.
- While running in Docker mode, understand that Hercules has access only to a headless web browser.
- If you want Hercules to connect to a visible web browser, try the CDP URL option in the environment file. This option can help you connect Hercules running in your infrastructure to a remote browser like BrowserBase or your self-hosted grid.
- Use
CDP_ENDPOINT_URLto set the CDP URL of the Chrome instance that has to be connected to the agent.
When running Hercules in Docker, you can connect to remote browser instances using various platforms:
- BrowserStack Integration:
export BROWSERSTACK_USERNAME=your_username
export BROWSERSTACK_ACCESS_KEY=your_access_key
export CDP_ENDPOINT_URL=$(python helper_scripts/browser_stack_generate_cdp_url.py)- LambdaTest Integration:
export LAMBDATEST_USERNAME=your_username
export LAMBDATEST_ACCESS_KEY=your_access_key
export CDP_ENDPOINT_URL=$(python helper_scripts/lambda_test_generate_cdp_url.py)- BrowserBase Integration:
export CDP_ENDPOINT_URL=wss://connect.browserbase.com?apiKey=your_api_key- AnchorBrowser Integration:
export CDP_ENDPOINT_URL=wss://connect.anchorbrowser.io?apiKey=your_api_keyNote: Video recording is only supported on platforms that use connect_over_cdp (BrowserBase, AnchorBrowser). Platforms using the connect API (BrowserStack, LambdaTest) do not support video recording.
After the command completion:
- The container terminates, and output is written in the mounted
optfolder, in the same way as described in the directory structure. - You will find the JUnit XML result file, HTML reports, proofs of execution, and logs in the respective folders.
For the hardcore enthusiasts, you can use Hercules via the source code to get a complete experience of customization and extending Hercules with more tools.
- Ensure you have Python 3.13 installed for the branch CI target. The
package metadata supports Python
>=3.11,<3.14.
-
Clone the Repository
git clone [email protected]:test-zeus-ai/testzeus-hercules.git
-
Navigate to the Directory
cd testzeus-hercules -
Use Make Commands
The repository provides handy
makecommands.- Use
make helpto check out possible options.
- Use
-
Install UV
make setup-uv
-
Install Dependencies
make install
-
Configure the model
export LLM_MODEL_NAME=gpt-4o export LLM_MODEL_API_KEY=replace-me export LLM_MODEL_BASE_URL=https://api.openai.com/v1
Use
agents_llm_config.jsononly when you need per-agent routing for planner, navigation, memory, and helper models. Seedocs/run_guide.md. -
Run Hercules
make run
-
This command reads the relevant feature files from the
optfolder and executes them, putting the output in the same folder. -
The
optfolder has the following format:opt/ ├── input/ │ └── test.feature ├── output/
│ └── run_/ │ ├── test.feature_result.html │ └── test.feature_result.xml ├── log_files/ ├── proofs/ │ └── User_opens_Google_homepage/ │ └── run_/ │ ├── network_logs.json │ ├── screenshots/ │ └── videos/ └── test_data/ └── test_data.txt
-
-
Interactive Mode
You can also run Hercules in interactive mode as an instruction execution agent, which is more useful for RPA and debugging test cases and Hercules's behavior on new environments while building new tooling and extending the agents.
make run-interactive
- This will trigger an input prompt where you can chat with Hercules, and it will perform actions based on your commands.
For those who want a fully automated setup experience on Linux/macOS
environments, create the script below locally. It installs TestZeus Hercules and
sets up the base opt project directories with direct LLM_MODEL_*
environment variables for a simple local run.
- Ensure you have Python 3.13 installed, or another supported Python
version in the
>=3.11,<3.14range.
- Download or Create the Script You can copy the script below into a file named helper_script_custom.sh:
#!/bin/bash
# set -ex
# curl -sS https://bootstrap.pypa.io/get-pip.py | python3.13
# Create a new Python virtual environment named 'test'
python3.13 -m venv test
# Activate the virtual environment
source test/bin/activate
# Upgrade the 'testzeus-hercules' package
pip install --upgrade testzeus-hercules
playwright install --with-deps
# create a new directory named 'opt'
mkdir -p opt/input opt/output opt/test_data
# Create a minimal environment file. For per-agent model routing, see
# docs/run_guide.md and docs/environment_variables.md.
cat > .env <<'ENV'
LLM_MODEL_NAME=gpt-4o
LLM_MODEL_API_KEY=replace-me
LLM_MODEL_BASE_URL=https://api.openai.com/v1
LLM_MODEL_API_TYPE=openai
HEADLESS=true
RECORD_VIDEO=true
TAKE_SCREENSHOTS=true
ENV
# prompt user that they need to edit the .env file, halt the script and open the file in an editor
echo "The '.env' file is located at $(pwd)/.env"
read -p "Press Enter if file is updated"
# Create starter input files.
cat > opt/input/test.feature <<'FEATURE'
Feature: Example browser check
Scenario: Open a public page
Given I open the page "https://example.com"
Then the page should contain "Example Domain"
FEATURE
cat > opt/test_data/test_data.txt <<'DATA'
{}
DATA
# Run the 'testzeus-hercules' command with the specified parameters
testzeus-hercules --project-base=opt- Make the Script Executable and Run
chmod +x helper_script_custom.sh
./helper_script_custom.sh- The script will:
- Create a Python virtual environment named
test. - Install
testzeus-herculesand Playwright dependencies. - Create the
optfolder structure for input, output, and test data. - Create sample
.env, feature, and test data files. - Prompt you to edit
.envbefore running.
- Create a Python virtual environment named
- Script Output
- After completion, the script automatically runs
testzeus-hercules --project-base=opt. - Your logs and results will appear in
opt/output,opt/log_files, andopt/proofs.
- After completion, the script automatically runs
For a comprehensive guide to all environment variables and configuration options available in TestZeus Hercules, please refer to our Environment Variables and Configuration Guide. This document provides detailed information about core environment variables, LLM configuration, browser settings, testing configuration, device configuration, logging options, and more.
To disable telemetry in the current branch, set ENABLE_TELEMETRY to 1.
The current implementation treats unset or 0 as enabled:
export ENABLE_TELEMETRY=1If AUTO_MODE is set to 1, Hercules will not request an email during the run:
export AUTO_MODE=1To configure Hercules in detail:
-
Copy the base environment file:
cp .env-example .env
Hercules includes an MCP Navigation Agent that can connect to MCP servers over stdio, sse, and streamable-http. It works out of the box with Composio-generated MCP servers.
- Quick start guide: see
docs/MCP_Usage.md - LangGraph lifecycle details: see
docs/Migration/ARCHITECTURE.md#MCP-Runtime - Composio docs: https://docs.composio.dev/docs/quickstart
Minimal setup:
- Create
mcp_servers.jsonat the repo root:
{
"mcpServers": {
"server_name": {
"transport": "streamable-http",
"url": "<session.mcp.url>",
"headers": {
"Authorization": "Bearer <token-if-required>"
}
}
}
}
- In
.env:
MCP_ENABLED=true
MCP_SERVERS=mcp_servers.json
MCP_TIMEOUT=30
Then, run Hercules as usual. The MCP helper waits for server readiness before
binding tools, discovers each server tool, and exposes it as a dynamic
LangChain StructuredTool while preserving the server tool's input schema.
Feature: Read emails from Gmail
Scenario: Retrieve OTP from Gmail using MCP
Given Gmail is configured using MCP
When I connect to Gmail
And I read the email with OTP
For more testcases visit MCP docs.
Hercules can also run as an MCP server for other MCP clients:
testzeus-hercules-mcpThis starts a FastMCP streamable HTTP server at
http://0.0.0.0:8000/mcp by default and exposes tools such as
generate_gherkin, run_test, and get_test_results.
-
Hercules considers a base folder that is by default
./optbut can be changed by the environment variablePROJECT_SOURCE_ROOT. -
Connecting to an Existing Chrome Instance
- This is extremely useful when you are running Hercules in Docker for scale.
- You can connect Hercules running in your infrastructure to a remote browser like BrowserBase or your self-hosted grid.
- Use
CDP_ENDPOINT_URLto set the CDP URL of the Chrome instance that has to be connected to the agent.
-
Controlling Other Behaviors
You can control other behaviors of Hercules based on the following environment variables:
HEADLESS=trueRECORD_VIDEO=falseTAKE_SCREENSHOTS=falseBROWSER_TYPE=chromium(options:firefox,chromium)CAPTURE_NETWORK=false
For example: If you would like to run with a "Headful" browser, you can set the environment variable with export HEADLESS=false before triggering Hercules.
-
How to Use Tracing in Playwright
Tracing in Playwright allows you to analyze test executions and debug issues effectively. To enable tracing in your Playwright tests, follow these steps:
- Ensure that tracing is enabled in the configuration.
- Traces will be saved to the specified path:
{proof_path}/traces/trace.zip.
To enable tracing, set the following environment variable:
export ENABLE_PLAYWRIGHT_TRACING=true
Use direct LLM_MODEL_* environment variables for the simplest local runs.
Use agents_llm_config.json only when you need per-agent model routing across
planner_agent, nav_agent, and helper_agent. The full schema and examples
live in docs/run_guide.md and docs/environment_variables.md.
Hercules can route its LangGraph agents through a LiteLLM proxy. This provides one compatible endpoint for models from multiple providers while preserving separate model and generation settings for the planner, navigation, and helper roles.
Create agents_llm_config.json with a top-level litellm profile:
{
"litellm": {
"planner_agent": {
"model_name": "<proxy-model-name>",
"model_api_key": "<proxy-api-key>",
"model_base_url": "http://localhost:4000/v1",
"model_api_type": "litellm",
"llm_config_params": { "temperature": 0, "max_tokens": 4096 }
},
"nav_agent": {
"model_name": "<proxy-model-name>",
"model_api_key": "<proxy-api-key>",
"model_base_url": "http://localhost:4000/v1",
"model_api_type": "litellm",
"llm_config_params": { "temperature": 0, "max_tokens": 4096 }
},
"helper_agent": {
"model_name": "<proxy-model-name>",
"model_api_key": "<proxy-api-key>",
"model_base_url": "http://localhost:4000/v1",
"model_api_type": "litellm",
"llm_config_params": { "temperature": 0, "max_tokens": 4096 }
}
}
}Activate the profile and run Hercules:
export AGENTS_LLM_CONFIG_FILE=./agents_llm_config.json
export AGENTS_LLM_CONFIG_FILE_REF_KEY=litellm
testzeus-hercules --project-base=optThe model names may be LiteLLM model aliases, so each agent role can be routed
independently by changing its model_name. Navigation models must support
native tool calling, and planner models must reliably return strict JSON.
Guided test creation (--guided or --test) uses the LiteLLM-backed Gherkin
generator and currently requires the active profile to be named litellm.
Keep API keys in environment-managed or private configuration and do not commit
them to the repository.
Hercules is production ready, and packs a punch with features:
Hercules makes testing as simple as Gherkin in, results out. Just feed your end-to-end tests in Gherkin format, and watch Hercules spring into action. It takes care of the heavy lifting by running your tests automatically and presenting results in a neat JUnit format. No manual steps, no fuss—just efficient, seamless testing.
With Hercules, you're harnessing the power of open source with zero licensing fees. Feel free to dive into the code, contribute, or customize it to your heart's content. Hercules is as free as it is mighty, giving you the flexibility and control you need.
Built to handle intricate enterprise UIs and other complex platforms with ease. Whether it's complicated DOM or multi-step business workflows, Hercules is ready and configurable.
Say goodbye to complex scripts and elusive locators. Hercules is here to make your life easier with its no-code approach, taking care of the automation of Gherkin features so you can focus on what matters most—building quality software.
With multilingual support right out of the box, Hercules is ready to work with teams across the globe. Built to bridge language gaps, it empowers diverse teams to collaborate effortlessly on a unified testing platform.
Hercules records video of the execution, and captures network logs as well, so that you dont have to deal with "It works on my computer".
Autonomous and adaptive, Hercules takes care of itself with auto-healing capabilities. Forget about tedious maintenance—Hercules adjusts to changes and stays focused on achieving your testing goals.
Grounded in the powerful foundations of TestZeus, Hercules tackles UI assertions with unwavering focus, ensuring that no assertion goes unchecked and no bug goes unnoticed. It's thorough, it's sharp, and it's ready for action.
Run Hercules locally or integrate it seamlessly into your CI/CD pipeline. Docker-native and one-command ready, Hercules fits smoothly into your deployment workflows, keeping testing quick, consistent, and hassle-free.
With Hercules, testing is no longer just a step in the process—it's a powerful, streamlined experience that brings quality to the forefront.
Hercules supports running the browser in "mobile mode" for a variety of device types. Playwright provides a large list of device descriptors here: List of mobile devices supported
Set the RUN_DEVICE environment variable in your .env (or directly as an environment variable):
RUN_DEVICE="iPhone 15 Pro Max"When Hercules runs, it will now launch the browser with the corresponding viewport and user-agent for the chosen device, simulating a real mobile environment.
Here's a quick demo:

Hercules can be extended with more powerful tools for advanced scenarios. Enable it by setting:
LOAD_EXTRA_TOOLS=trueWith LOAD_EXTRA_TOOLS enabled, Hercules looks for additional tool modules that can expand capabilities (e.g., geolocation handling).
For location-based tests, configure: supported geo providers are maps.co and google
GEO_API_KEY=somekey
GEO_PROVIDER=maps_coThis allows Hercules to alter or simulate user location during test execution, broadening your test coverage for scenarios that rely on user geography.
Note: If you are looking for native app test automation, we've got you covered, as we've built out early support for Appium powered native app automation here
Hercules runs on a LangGraph state-machine architecture. The public interface is still Gherkin in, reports out, but the runtime is structured as planner, executor, and assertion graph nodes.
For the detailed architecture and current tool formats, see docs/Migration/ARCHITECTURE.md. For upgrade notes from the AG2 implementation, see docs/Migration/MIGRATION.md.
runner.pysends a Gherkin scenario or command toSimpleHercules.SimpleHerculesruns a LangGraphStateGraphwithplanner,executor, andassertionnodes.PlannerAgentreturns strict JSON containingplan,next_step,target_helper,terminate, and assertion fields.- The executor routes
target_helperto the appropriate navigation agent: browser, API, security, SQL, time keeper, MCP, executor, or visual helper. - Navigation agents bind LangChain
StructuredToolobjects to their LLM and run a bounded tool-call loop. - Tool results are returned to the helper agent, then summarized back to the planner until the planner terminates or enters assertion handling.
Hercules tools are regular Python functions registered with @tool(...).
At runtime, testzeus_hercules/utils/langchain_tools.py converts them into
LangChain StructuredTool objects with Pydantic argument schemas.
Tool inputs are intentionally simple for provider compatibility:
- Use scalar values such as
str,float,bool. - Use
List[Dict[str, str]]for bulk browser actions. - Avoid public tuple inputs because some providers reject the generated
prefixItemsJSON Schema. - No-argument tools use explicit empty schemas so LangChain does not infer a
fake
kwargsargument from wrappers.
Hercules injects an md attribute into DOM elements and uses that value as the
primary browser selector. Browser sensing tools return compact JSON or cleaned
text instead of raw page HTML.
Current browser sensing tools include:
get_interactive_elements: compact clickable/focusable/input-like nodesget_input_fields: compact form and input nodesget_page_text: cleaned visible page textgeturl: active page URL
Current browser action tools include:
open_urlclickhoverpress_key_combinationbulk_enter_textbulk_select_optionbulk_set_sliderbulk_set_date_time_valueclick_and_upload_filetest_page_accessibilitycaptcha_solver
DOM output is deliberately compacted because very large or deeply nested DOM
payloads can cause provider-side INVALID_ARGUMENT or token-limit errors,
especially on complex enterprise applications.
Hercules integrates with Nuclei to automate vulnerability scanning directly from Gherkin test cases, identifying issues like misconfigurations, OWASP Top 10 vulnerabilities, and API flaws. Security reports are generated alongside testing outputs for seamless CI/CD integration.
Hercules supports WCAG 2.0, 2.1, and 2.2 at A, AA, and AAA levels, enabling accessibility testing to ensure compliance with global standards. It identifies accessibility issues early, helping build inclusive and user-friendly applications.
We wanted to ensure that Hercules stands up to the task of end-to-end testing with immense precision. So, we have run Hercules through a wide range of tests such as running APIs, interacting with complex UI scenarios, clicking through calendars, or iframes. A full list of evaluations can be found in the tests folder.
To run the full test suite, use the following command:
make testTo run a specific test:
make test-caseHercules builds on the work done by WebArena and Agent-E, and beyond that, to iron out the issues in the previous, we have written our own test cases catering to complex QA scenarios and have created tests in the ./tests folder.
We believe that great quality comes from opinions about a product. So we have incorporated a few of our opinions into the product design. We welcome the community to question them, use them, or build on top of them. Here are some examples:
-
Gherkin is a Good Enough Format for Agents: Gherkin provides a semi-structured format for the LLMs/AI Agents to follow test intent and user instructions. It provides the right amount of grammar (verbs like Given, When, Then) for humans to frame a scenario and agents to follow the instructions.
-
Tests Should Be Atomic in Nature: Software tests should be atomic because it ensures that each test is focused, independent, and reliable. Atomic tests target one specific behavior or functionality, making it easier to pinpoint the root cause of failures without ambiguity.
Here's a good example (Atomic Test):
Feature: User Login Scenario: Successful login with valid credentials Given the user is on the login page When the user enters valid credentials And the user clicks the login button Then the user should see the dashboard
A non-atomic test confuses both the tester and the AI agent.
-
Open Core and Open Source: Hercules is built on an open-core model, combining the spirit of open source with the support and expertise of a commercial company, TestZeus. By providing Hercules as open source (licensed under AGPL v3), TestZeus is committed to empowering the testing community with a robust, adaptable tool that's freely accessible and modifiable. Open source offers transparency, trust, and collaborative potential, allowing anyone to dive into the code, contribute, and shape the project's direction.
-
Telemetry : All great products are built on good feedback. We have setup telemetry so that we can take feedback, without disturbing the user. Telemetry is enabled by default, but we also believe strongly in the values of "Trust" and "Transparency" so it can be turned off by the users.
-
Prompting Hercules : A detailed guide to write tests for Hercules can be found on our blog here .
Hercules now gains the power of the Hypermind — a secure, multi-tenant Python sandbox that lets testers inject custom logic, AI-powered heuristics, and human-crafted intelligence directly into test scenarios. When automation hits a wall, the Hypermind takes over — executing scripts with full Playwright access and controlled permissions.
| Capability | Description |
|---|---|
| Run custom scripts from Gherkin | Invoke Python functions as test steps. |
| Full Playwright access | Direct control over browser, page, and context. |
| Auto-injected utilities | Common tools such as logger, asyncio, and json are preloaded. |
| Multi-tenant isolation | Executor, data, API, and restricted levels for safety. |
| Dynamic permissions | Control module access via CLI or environment. |
| Execution proofs | Pre/post screenshots and JSON execution reports. |
| Reusable logic | Use scripts across features or teams. |
Gherkin:
Feature: Product Filtering
Scenario: Apply filter using Hypermind Script
Given a user is on the URL as https://example.com
When execute the apply_filter function from script at "scripts/apply_filter.py" with filter_type as "Turtle Neck"
Then the script should report successful filter applicationPython: opt/scripts/apply_filter.py
async def apply_filter(filter_type: str) -> dict:
"""Apply filter with fallback strategies."""
await page.wait_for_selector('[data-filter-section]')
for selector in [f'input[value="{filter_type}"]', f'label:has-text("{filter_type}") input']:
if await page.locator(selector).count() > 0:
await page.locator(selector).click()
break
count = await page.locator('.product-item').count()
return {"status": "success", "filter": filter_type, "products": count}“When automation falters, Hypermind awakens.” Hypermind Scripts represent the next phase of AI-assisted testing — uniting autonomous precision with human adaptability. It’s not just fallback logic; it’s human creativity made executable.
Hercules is an AI-native solution and relies on LLMs to perform reasoning and actions. Based on our experiments, we have found that a complex use case as below could cost up to $0.20 using OpenAI's APIs gpt-4o, check the properties printed in testcase output to calculate for your testcase:
Feature: Product Checkout on Demo Store
Scenario: Add a product to cart and verify checkout summary
Given I am on the demo store home page
When I search for "wireless headphones"
And I open the first matching product result
And I add the product to the cart
And I open the cart
Then I should see the selected product in the cart
And the cart total should be displayedHercules isn't just another testing tool—it's an agent. Powered by synthetic intelligence that can think, reason, and react based on requirements, Hercules goes beyond simple automation scripts. We bring an industry-first approach to open-source agents for software testing. This means faster, smarter, and more resilient testing cycles, especially for complex platforms.
With industry-leading performance and a fully open-source foundation, Hercules combines powerful capabilities with community-driven flexibility, making top-tier testing accessible and transformative for everyone.
- Enhanced LLM Support: Integration with more LLMs and support for local LLM deployments.
- Advanced Tooling: Addition of more tools to handle complex testing scenarios and environments.
- Improved DOM Distillation: Refinements to the DOM distillation process for better efficiency and accuracy.
- Community Contributions: Encourage and integrate community-driven features and tools.
- Extensive Documentation: Expand documentation for better onboarding and usage.
- Bounty Program: Launch a bounty program to incentivize contributions.
We welcome contributions from the community!
- Read the CONTRIBUTING.md file to get started.
- Bounty Program: Stay tuned for upcoming opportunities! 😀
-
Developing Tools
- If you are developing tools for Hercules and want to contribute to the community, make sure you place the new tools in the
additional_toolsfolder in your Pull Request.
- If you are developing tools for Hercules and want to contribute to the community, make sure you place the new tools in the
-
Fixes and Enhancements
- If you have a fix on sensing tools that are fundamental to the system or something in prompts or something in the DOM distillation code, then put the changes in the relevant file and share the Pull Request.
-
Creating a New Tool
- You can start extending by adding tools to Hercules.
- Refer to
testzeus_hercules/core/tools/sql_calls.pyas an example of how to create a new tool. - The key is the decorator
@toolover the method that you want Hercules to execute. - The tool decorator should have a very clear description and name so that Hercules knows how to use the tool.
- Also, in the method, you should be clear with annotations on what parameter is used for what purpose so that function calling in the LLM works best.
-
Adding the Tool
- Once you have created the new tools files in some folder path, you can pass the folder path to Hercules in the environment variable so that Hercules can read the new tools during the boot time and make sure that they are available during the execution.
- Use
ADDITIONAL_TOOL_DIRSto pass the path of the new tools folder where you have kept the new files.
-
Direct Addition (Not Recommended)
-
In case you opt for adding the tools directly, then just put your new tools in the
testzeus_hercules/core/toolspath of the cloned repository. -
Note: This way is not recommended. We prefer you try to use the
ADDITIONAL_TOOL_DIRSapproach.
-
Join us at our Slack to connect with the community, ask questions, and contribute.
Hercules would not have been possible without the great work from the following sources:
The Hercules project is inferred and enhanced over the existing project of Agent-E. We have improved lots of cases to make it capable of doing testing, especially in the area of complex DOM navigation and iframes. We have also added new tools and abilities for complex enterprise navigation so that Hercules can perform better work over the base framework we had picked.
The current migration branch runs on LangGraph, LangChain tool binding, and MCP-compatible integrations.
Hercules also picks some inspiration from the legacy TestZeus repo here.
With Hercules, testing is no longer just a step in the process—it's a powerful, streamlined experience that brings quality to the forefront.
If you're coming from a Java or JavaScript background, working with Python might feel a bit different at first—but don't worry! Python's simplicity, combined with powerful tools like virtual environments, makes managing dependencies easy and efficient.
In Java, you might use tools like Maven or Gradle to manage project dependencies, or in JavaScript, you'd use npm or yarn. In Python, virtual environments serve a similar purpose. They allow you to create isolated spaces for your project's dependencies, avoiding conflicts with other Python projects on your system.
Think of it like a sandboxed environment where TestZeus Hercules and its dependencies live independently from other Python packages.
First, ensure a supported Python version is installed. The package supports
Python >=3.11,<3.14, and this branch targets Python 3.13 in CI. You can
verify your version by running:
python --version
# or
python3 --versionIf Python isn't installed, download it here or if you are on Windows, just follow the instructions here.
To set up a clean Python environment for your project:
# Create a virtual environment named 'venv'
python -m venv venv
# Activate the virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activateYou'll notice your terminal prompt changes—this indicates the virtual environment is active.
To deactivate the virtual environment later, simply run:
deactivateOnce your virtual environment is activated, install the latest version of TestZeus Hercules directly from PyPI:
pip install testzeus-herculesTo update to the latest version, use:
pip install --upgrade testzeus-herculesIf you need to remove the package:
pip uninstall testzeus-herculesTo verify that TestZeus Hercules is installed and check its version:
pip listpipis likenpmormvn—it's used for installing and managing Python packages.- Python's simplicity means fewer configuration files—most things can be done directly from the command line.
Now that TestZeus Hercules is installed and ready to go, dive into our documentation to learn how to create and run your first test cases with ease!
If you use Hercules in your research or project, please cite:
@software{testzeus_hercules2024,
author = {Agnihotri, Shriyansh and Gupta, Robin},
title = {Hercules: World's first open source testing agent},
year = {2024},
publisher = {GitHub},
url = {https://github.com/test-zeus-ai/testzeus-hercules/}
}


