Skip to main content
PostHog’s Customer Data Platform (CDP) combines AI-powered code generation with real-time data processing. Build transformations and destinations using natural language, then deploy them to process millions of events.

Overview

The CDP provides:
  • AI-powered Hog generation - Describe what you want, get working code
  • Real-time processing - Transform and route events as they arrive
  • Smart filters - AI-generated event and property filters
  • Auto-generated inputs - Input schemas created from your code
  • Integrated testing - Validate functions before deployment

AI-Powered Development

Use natural language to generate Hog functions:

Transformation Assistant

1

Describe your transformation

2

AI generates Hog code

3

Review and deploy

The generated code is production-ready. Test with sample events, then deploy.

Filter Generation

Generate event filters from natural language:

Input Schema Generation

AI analyzes your Hog code and generates input schemas:
Generated schema:

Common Use Cases

Enrichment Pipeline

Enrich events with data from external APIs:

Revenue Alerts

Send notifications for high-value events:

Data Warehouse Sync

Export events to external databases:

AI Assistant Capabilities

Code Understanding

The AI understands PostHog’s data model and APIs:
  • Event structure - Knows event properties, person properties, timestamps
  • Hog syntax - Generates valid Hog code with proper syntax
  • Best practices - Follows error handling, validation, and performance patterns
  • API integration - Understands fetch(), headers, authentication

Iterative Refinement

Modify existing functions:

Error Recovery

AI detects and fixes compilation errors:

Tool Integration

The CDP uses specialized AI tools:

CreateHogTransformationFunctionTool

Generates transformation code:

CreateHogFunctionFiltersTool

Generates event filters:

CreateHogFunctionInputsTool

Generates input schemas:

Development Workflow

1

Describe your function

Use natural language to describe what you want to build:
2

Generate code

AI creates Hog code, filters, and input schemas automatically.
3

Review and test

Test generated code with sample events:
4

Deploy

Enable the function to process live events.
5

Monitor

Track execution metrics and errors in the dashboard.

Best Practices

Be Specific in Prompts

Provide clear, detailed instructions. Include edge cases and error handling requirements in your prompt for better generated code.

Test Generated Code

Always test AI-generated functions with sample events before deploying to production. Verify edge cases and error handling.

Iterate on Results

If the first generation isn’t perfect, refine your prompt or ask for specific modifications. The AI learns from your feedback.

Review Security

Verify that generated code handles secrets properly using the inputs system. Never hardcode API keys or credentials.

Limitations

AI limitations:
  • May require iteration for complex logic
  • Can’t access your specific database schema (provide context in prompts)
  • Generated code should be reviewed for production use
  • Works best with clear, specific instructions

API Reference

Generate Transformation

Generate Filters

Generate Inputs