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
Filter Generation
Generate event filters from natural language:Input Schema Generation
AI analyzes your Hog code and generates input schemas: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
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