Israeli Government Form Automator
Instructions
Step 1: Identify the Form and Portal
Ask the user which government form or process they need to automate:
Clarify:
- Which form? (form number or name, e.g., Tofes 101, Tofes 106)
- Online or PDF? (browser-based portal or downloadable PDF)
- User data available? (Teudat Zehut, address, employer details)
Step 2: Validate Israeli-Specific Fields
Before filling any form, validate all Israeli-format data:
Teudat Zehut (ID Number) Validation:
The Israeli ID is 9 digits with a check digit (Luhn variant):
def validate_tz(id_number: str) -> bool:
"""Validate Israeli Teudat Zehut number."""
id_str = id_number.zfill(9)
if len(id_str) != 9 or not id_str.isdigit():
return False
total = 0
for i, digit in enumerate(id_str):
val = int(digit) * (1 + (i % 2))
if val > 9:
val -= 9
total += val
return total % 10 == 0
Israeli Phone Number Formats:
| Format |
Example |
Notes |
| Mobile |
05X-XXXXXXX |
Prefixes: 050, 051, 052, 053, 054, 055, 058 |
| Landline |
0X-XXXXXXX |
Area codes: 02 (Jerusalem), 03 (Tel Aviv), 04 (Haifa), 08 (South), 09 (Sharon) |
| International |
+972-5X-XXXXXXX |
Drop leading 0, add +972 |
Israeli Address Format:
{street_name} {house_number}, {apartment} (optional)
{city_name}, {mikud (postal code - 7 digits)}
Step 3: Set Up Browser Automation (Online Forms)
Install and configure Playwright for Hebrew RTL government portals:
pip install playwright
playwright install chromium
Key patterns for gov.il portals:
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(headless=False)
context = browser.new_context(locale="he-IL")
page = context.new_page()
# Note: Replace with specific service URL as needed
page.goto("https://www.gov.il/he/")
# Gov.il uses React-based forms; wait for dynamic load
page.wait_for_selector('[data-testid="form-container"]', timeout=15000)
# Fill RTL text fields
page.fill('input[name="firstName"]', "ישראל")
page.fill('input[name="lastName"]', "ישראלי")
page.fill('input[name="idNumber"]', "123456782")
# Handle date pickers (DD/MM/YYYY format in Israel)
page.fill('input[name="birthDate"]', "15/03/1990")
# Handle dropdowns with Hebrew options
page.select_option('select[name="city"]', label="תל אביב-יפו")
Step 4: Fill PDF Forms (Offline Forms)
For downloadable government PDFs with fillable fields:
# Option 1: pikepdf (recommended)
import pikepdf
pdf = pikepdf.open("tofes_101.pdf")
pdf.pages[0]["/Annots"] # Inspect form field names
# Option 2: PyPDF2
from PyPDF2 import PdfReader, PdfWriter
reader = PdfReader("tofes_101.pdf")
fields = reader.get_fields()
writer = PdfWriter()
writer.append(reader)
writer.update_page_form_field_values(
writer.pages[0],
{"shem_prati": "ישראל", "shem_mishpacha": "ישראלי"}
)
Common PDF field naming conventions in government forms:
| Field Purpose |
Common Hebrew Names |
English Equivalent |
| First name |
shem_prati, shem_praty |
first_name |
| Last name |
shem_mishpacha, shem_mishpaha |
last_name |
| ID number |
mispar_zehut, tz |
id_number |
| Date of birth |
taarich_leida |
birth_date |
| Address |
ktovet, rechov |
address, street |
| City |
yishuv, ir |
city |
| Phone |
telefon, nayad |
phone, mobile |
| Employer |
maasik |
employer |
Step 5: Handle Common Government Form Patterns
Doch Shnati (Annual Tax Report):
- Navigate to Rashut HaMisim personal area
- Required fields: income sources (mekorot hachnasa), deductions (nikuyim), credits (zikuyim)
- Attach digital slips (tofes 106, tofes 857)
- Date format: always DD/MM/YYYY
Bituach Leumi Claims:
- Navigate to btl.gov.il personal area
- Identify claim type (maternity/dme'i leida, disability/nechut, unemployment/avtala)
- Upload supporting documents (medical certificates, employment letters)
- Track claim status via personal dashboard
Companies Registrar Filings:
- Navigate to ica.justice.gov.il
- Required: company number (mispar chevra), authorized signatory details
- Annual report (doch shnati la-rasham) filing
- Director/shareholder change notifications
Step 6: Submit and Verify
After filling the form:
- Screenshot before submit -- capture the filled form for user review
- Validate all required fields -- government forms reject partial submissions
- Save confirmation number (mispar ishur) -- always displayed after successful submission
- Download receipt PDF when available
- Note processing timeline -- most government services specify expected response time
Step 7: Error Recovery
Common issues with government portals:
- Session timeout: Gov.il sessions expire after ~20 minutes of inactivity
- CAPTCHA: Some forms require manual CAPTCHA solving; pause and ask user
- Certificate errors: Government portals may use Israeli CA certificates
- Peak hours: Tax Authority portal is slow during filing season (March-May)
Examples
Example 1: Fill Tax Form 101
User says: "I need to fill Tofes 101 for my new employee"
Actions:
- Download Tofes 101 PDF from Rashut HaMisim
- Validate employee Teudat Zehut
- Fill personal details, tax bracket, credits (nekudot zikui)
- Generate filled PDF for employer signature
Result: Completed Tofes 101 ready for submission
Example 2: Submit Bituach Leumi Maternity Claim
User says: "Help me file a maternity benefit claim with Bituach Leumi"
Actions:
- Navigate to btl.gov.il maternity (dme'i leida) section
- Validate eligibility: employment period, salary data
- Fill claim form with personal and employer details
- Upload required documents (employment confirmation, hospital discharge)
Result: Submitted claim with tracking number for follow-up
Example 3: Register New Company
User says: "I want to register a new Chevra Ba'am (Ltd company)"
Actions:
- Navigate to Companies Registrar portal
- Fill company name proposals (3 options required)
- Enter founder details, share capital, articles of association
- Calculate and note registration fees
Result: Submission confirmation with expected registration timeline
Example 4: Update Personal Details at Misrad HaPnim
User says: "I moved apartments and need to update my address"
Actions:
- Navigate to gov.il address change service
- Validate new address format (street, city, mikud)
- Fill change-of-address form with old and new addresses
- Submit with required identification
Result: Address change request submitted with confirmation number
Bundled Resources
Scripts
scripts/fill_form.py -- Helper to validate Israeli form fields (Teudat Zehut, phone, address) and populate common government form data structures. Run: python scripts/fill_form.py --help
References
references/gov-portals.md -- Comprehensive list of Israeli government portal URLs, form types, and field naming conventions. Consult when identifying the correct portal or form for a given task.
Gotchas
- Israeli government forms require Hebrew text input in specific fields. Agents may generate English-only form data, which will be rejected by government systems.
- Teudat Zehut (Israeli ID) numbers have 9 digits with a Luhn-variant check digit. Agents may generate random 9-digit numbers that fail the check-digit validation.
- Many government forms require a date of birth in both Hebrew calendar (luach ivri) and Gregorian formats. Agents typically only provide the Gregorian date.
- Digital signatures on Israeli government forms use the gov.il identity verification system. Agents cannot programmatically sign forms without going through the user's gov.il authentication.
Reference Links
Troubleshooting
Error: "Session expired" on gov.il
Cause: Government portal sessions time out after prolonged inactivity
Solution: Re-authenticate and resume from the last saved step. Save partial progress frequently.
Error: "Invalid Teudat Zehut"
Cause: ID number fails check digit validation
Solution: Run validate_tz() before submission. Ensure 9 digits with leading zeros if needed.
Error: "Hebrew text displays incorrectly in PDF"
Cause: PDF library does not support RTL text or Hebrew fonts
Solution: Use pikepdf with embedded Hebrew fonts. Ensure the PDF template already has Hebrew font resources.
Error: "Form field not found"
Cause: Government PDFs change field names between versions
Solution: List all fields with reader.get_fields() first, then match by inspecting field labels.
1---2name: israeli-gov-form-automator3description: Automate Israeli government form filling via Playwright browser automation and PDF population. Prevents hours of manual form filling and data entry errors on government portals. Use when user asks about filling government forms, "tofes" (form), "milui tfasim" (form filling), "gov.il" portal submissions, online form submission, Rashut HaMisim (Tax Authority) filings, Bituach Leumi (National Insurance) claims, or Rasham HaChevarot (Companies Registrar) documents. Validates Teudat Zehut (ID numbers) with check digit, Israeli phone numbers (+972), and Hebrew address fields. Supports Doch Shnati (annual tax report), maternity grant claims, and company registration forms. Do NOT use for classified or security-clearance government systems.4license: MIT5allowed-tools: Bash(python:*) Bash(pip:*) WebFetch6compatibility: "Requires Python 3.9+, Playwright for browser automation, and network access to gov.il portals. Optional: pikepdf or PyPDF2 for PDF form filling."7---89# Israeli Government Form Automator1011## Instructions1213### Step 1: Identify the Form and Portal1415Ask the user which government form or process they need to automate:1617| Portal | URL | Common Forms | Hebrew |18|--------|-----|-------------|--------|19| gov.il Services | www.gov.il | General government forms | שירותי ממשלה |20| Rashut HaMisim (Tax Authority) | www.misim.gov.il | Doch Shnati, Mas Hachnasa, Nikui Mas | רשות המסים |21| Bituach Leumi (National Insurance) | www.btl.gov.il | Maternity, disability, unemployment claims | ביטוח לאומי |22| Rasham HaChevarot (Companies Registrar) | www.ica.justice.gov.il | Company registration, annual reports | רשם החברות |23| Misrad HaPnim (Interior Ministry) | www.gov.il/he/departments/ministry_of_interior | Teudat Zehut updates, address changes | משרד הפנים |2425Clarify:26- **Which form?** (form number or name, e.g., Tofes 101, Tofes 106)27- **Online or PDF?** (browser-based portal or downloadable PDF)28- **User data available?** (Teudat Zehut, address, employer details)2930### Step 2: Validate Israeli-Specific Fields3132Before filling any form, validate all Israeli-format data:3334**Teudat Zehut (ID Number) Validation:**35The Israeli ID is 9 digits with a check digit (Luhn variant):36```python37def validate_tz(id_number: str) -> bool:38 """Validate Israeli Teudat Zehut number."""39 id_str = id_number.zfill(9)40 if len(id_str) != 9 or not id_str.isdigit():41 return False42 total = 043 for i, digit in enumerate(id_str):44 val = int(digit) * (1 + (i % 2))45 if val > 9:46 val -= 947 total += val48 return total % 10 == 049```5051**Israeli Phone Number Formats:**52| Format | Example | Notes |53|--------|---------|-------|54| Mobile | 05X-XXXXXXX | Prefixes: 050, 051, 052, 053, 054, 055, 058 |55| Landline | 0X-XXXXXXX | Area codes: 02 (Jerusalem), 03 (Tel Aviv), 04 (Haifa), 08 (South), 09 (Sharon) |56| International | +972-5X-XXXXXXX | Drop leading 0, add +972 |5758**Israeli Address Format:**59```60{street_name} {house_number}, {apartment} (optional)61{city_name}, {mikud (postal code - 7 digits)}62```6364### Step 3: Set Up Browser Automation (Online Forms)6566Install and configure Playwright for Hebrew RTL government portals:6768```bash69pip install playwright70playwright install chromium71```7273**Key patterns for gov.il portals:**74```python75from playwright.sync_api import sync_playwright7677with sync_playwright() as p:78 browser = p.chromium.launch(headless=False)79 context = browser.new_context(locale="he-IL")80 page = context.new_page()81 # Note: Replace with specific service URL as needed82 page.goto("https://www.gov.il/he/")8384 # Gov.il uses React-based forms; wait for dynamic load85 page.wait_for_selector('[data-testid="form-container"]', timeout=15000)8687 # Fill RTL text fields88 page.fill('input[name="firstName"]', "ישראל")89 page.fill('input[name="lastName"]', "ישראלי")90 page.fill('input[name="idNumber"]', "123456782")9192 # Handle date pickers (DD/MM/YYYY format in Israel)93 page.fill('input[name="birthDate"]', "15/03/1990")9495 # Handle dropdowns with Hebrew options96 page.select_option('select[name="city"]', label="תל אביב-יפו")97```9899### Step 4: Fill PDF Forms (Offline Forms)100101For downloadable government PDFs with fillable fields:102103```python104# Option 1: pikepdf (recommended)105import pikepdf106107pdf = pikepdf.open("tofes_101.pdf")108pdf.pages[0]["/Annots"] # Inspect form field names109110# Option 2: PyPDF2111from PyPDF2 import PdfReader, PdfWriter112113reader = PdfReader("tofes_101.pdf")114fields = reader.get_fields()115writer = PdfWriter()116writer.append(reader)117writer.update_page_form_field_values(118 writer.pages[0],119 {"shem_prati": "ישראל", "shem_mishpacha": "ישראלי"}120)121```122123**Common PDF field naming conventions in government forms:**124| Field Purpose | Common Hebrew Names | English Equivalent |125|--------------|--------------------|--------------------|126| First name | shem_prati, shem_praty | first_name |127| Last name | shem_mishpacha, shem_mishpaha | last_name |128| ID number | mispar_zehut, tz | id_number |129| Date of birth | taarich_leida | birth_date |130| Address | ktovet, rechov | address, street |131| City | yishuv, ir | city |132| Phone | telefon, nayad | phone, mobile |133| Employer | maasik | employer |134135### Step 5: Handle Common Government Form Patterns136137**Doch Shnati (Annual Tax Report):**1381. Navigate to Rashut HaMisim personal area1392. Required fields: income sources (mekorot hachnasa), deductions (nikuyim), credits (zikuyim)1403. Attach digital slips (tofes 106, tofes 857)1414. Date format: always DD/MM/YYYY142143**Bituach Leumi Claims:**1441. Navigate to btl.gov.il personal area1452. Identify claim type (maternity/dme'i leida, disability/nechut, unemployment/avtala)1463. Upload supporting documents (medical certificates, employment letters)1474. Track claim status via personal dashboard148149**Companies Registrar Filings:**1501. Navigate to ica.justice.gov.il1512. Required: company number (mispar chevra), authorized signatory details1523. Annual report (doch shnati la-rasham) filing1534. Director/shareholder change notifications154155### Step 6: Submit and Verify156157After filling the form:1581. **Screenshot before submit** -- capture the filled form for user review1592. **Validate all required fields** -- government forms reject partial submissions1603. **Save confirmation number** (mispar ishur) -- always displayed after successful submission1614. **Download receipt PDF** when available1625. **Note processing timeline** -- most government services specify expected response time163164### Step 7: Error Recovery165166Common issues with government portals:167- **Session timeout**: Gov.il sessions expire after ~20 minutes of inactivity168- **CAPTCHA**: Some forms require manual CAPTCHA solving; pause and ask user169- **Certificate errors**: Government portals may use Israeli CA certificates170- **Peak hours**: Tax Authority portal is slow during filing season (March-May)171172## Examples173174### Example 1: Fill Tax Form 101175User says: "I need to fill Tofes 101 for my new employee"176Actions:1771. Download Tofes 101 PDF from Rashut HaMisim1782. Validate employee Teudat Zehut1793. Fill personal details, tax bracket, credits (nekudot zikui)1804. Generate filled PDF for employer signature181Result: Completed Tofes 101 ready for submission182183### Example 2: Submit Bituach Leumi Maternity Claim184User says: "Help me file a maternity benefit claim with Bituach Leumi"185Actions:1861. Navigate to btl.gov.il maternity (dme'i leida) section1872. Validate eligibility: employment period, salary data1883. Fill claim form with personal and employer details1894. Upload required documents (employment confirmation, hospital discharge)190Result: Submitted claim with tracking number for follow-up191192### Example 3: Register New Company193User says: "I want to register a new Chevra Ba'am (Ltd company)"194Actions:1951. Navigate to Companies Registrar portal1962. Fill company name proposals (3 options required)1973. Enter founder details, share capital, articles of association1984. Calculate and note registration fees199Result: Submission confirmation with expected registration timeline200201### Example 4: Update Personal Details at Misrad HaPnim202User says: "I moved apartments and need to update my address"203Actions:2041. Navigate to gov.il address change service2052. Validate new address format (street, city, mikud)2063. Fill change-of-address form with old and new addresses2074. Submit with required identification208Result: Address change request submitted with confirmation number209210## Bundled Resources211212### Scripts213- `scripts/fill_form.py` -- Helper to validate Israeli form fields (Teudat Zehut, phone, address) and populate common government form data structures. Run: `python scripts/fill_form.py --help`214215### References216- `references/gov-portals.md` -- Comprehensive list of Israeli government portal URLs, form types, and field naming conventions. Consult when identifying the correct portal or form for a given task.217218## Gotchas219- Israeli government forms require Hebrew text input in specific fields. Agents may generate English-only form data, which will be rejected by government systems.220- Teudat Zehut (Israeli ID) numbers have 9 digits with a Luhn-variant check digit. Agents may generate random 9-digit numbers that fail the check-digit validation.221- Many government forms require a date of birth in both Hebrew calendar (luach ivri) and Gregorian formats. Agents typically only provide the Gregorian date.222- Digital signatures on Israeli government forms use the gov.il identity verification system. Agents cannot programmatically sign forms without going through the user's gov.il authentication.223224## Reference Links225226| Source | URL | What to Check |227|--------|-----|---------------|228| Gov.il main portal | https://www.gov.il | Form listings, service index, authentication entry |229| Israel Tax Authority services | https://www.gov.il/he/departments/israel_tax_authority | Tax forms, online submission portals |230| Bituach Leumi (NII) | https://www.btl.gov.il | NII forms, claim submission, personal account |231| Companies Registrar (ICA) | https://ica.justice.gov.il | Company filings and updates |232| Playwright docs | https://playwright.dev | RTL context, form automation, waits |233234## Troubleshooting235236### Error: "Session expired" on gov.il237Cause: Government portal sessions time out after prolonged inactivity238Solution: Re-authenticate and resume from the last saved step. Save partial progress frequently.239240### Error: "Invalid Teudat Zehut"241Cause: ID number fails check digit validation242Solution: Run `validate_tz()` before submission. Ensure 9 digits with leading zeros if needed.243244### Error: "Hebrew text displays incorrectly in PDF"245Cause: PDF library does not support RTL text or Hebrew fonts246Solution: Use pikepdf with embedded Hebrew fonts. Ensure the PDF template already has Hebrew font resources.247248### Error: "Form field not found"249Cause: Government PDFs change field names between versions250Solution: List all fields with `reader.get_fields()` first, then match by inspecting field labels.