Overview
Thelocation context is available on every AgentExecutionContext and provides:
- Geographic data: Country, city, region, coordinates, timezone
- Jurisdiction detection: GDPR, CCPA, LGPD, and other privacy laws
- Consent helpers: Check if consent is required for specific purposes
- Language inference: Detect preferred language from headers or country
- Timezone utilities: Format times, check business hours
Geographic Data
Access location information extracted from Cloudflare’s edge:Region Checking
UseisIn() to check if the user is in specific regions or groups:
Available Region Groups
Jurisdiction Detection
Automatically detect which privacy laws apply to the user:Supported Jurisdictions
Consent Helpers
Check if consent is required before processing user data:Consent Purposes
Consent Model
Get the consent model to use:Consent-Aware Cookies
The cookies operation integrates directly with location context to automatically enforce consent rules. When you specify apurpose for a cookie, the operation checks if consent is required and granted before setting the cookie.
Language Inference
Detect the user’s preferred language:Language Matching Priority
- Accept-Language header - User’s browser preference
- Country’s primary language - Fallback based on location
- First supported language - Ultimate fallback
Timezone Utilities
Work with the user’s local time:Smart Scheduling
Real-World Example
A complete example showing consent gating and localization:TypeScript Types
Import types directly from the package:Next Steps
Edge Context
Network and infrastructure info
Security
Authentication and authorization
Operations
Available operation types
Creating Agents
Build custom agents

