Chicory Agent Creation
Overview
This section covers creating and configuring Chicory AI agents for automated schema mapping and dbt model generation. We'll create two specialized agents:
Schema Mapping Agent: Maps source CSV schemas to target data models
dbt Generation Agent: Creates dbt models and YAML documentation
Schema Mapping Agent
1. Agent Configuration
Create the schema mapping agent with the following configuration:
{
"agent_name": "schema_mapper_agent",
"description": "Maps source CSV schemas to target data warehouse schemas",
"model": "gpt-4",
"temperature": 0.1,
"max_tokens": 2000,
"instructions": "You are a data engineering expert specializing in schema mapping and data modeling. Your task is to analyze source CSV schemas and map them to standardized target schemas following dimensional modeling best practices.",
"tools": [
{
"type": "function",
"function": {
"name": "generate_schema_mapping",
"description": "Generate schema mapping between source CSV and target model",
"parameters": {
"type": "object",
"properties": {
"source_schema": {
"type": "object",
"description": "Source CSV schema information"
},
"target_standards": {
"type": "object",
"description": "Target schema standards and naming conventions"
}
},
"required": ["source_schema", "target_standards"]
}
}
}
],
"system_prompt": "You are an expert data engineer with deep knowledge of:\n- Dimensional modeling (Kimball methodology)\n- Data warehouse design patterns\n- Schema normalization and denormalization\n- Data quality and governance\n- Industry-standard naming conventions\n\nWhen mapping schemas:\n1. Follow consistent naming conventions (snake_case)\n2. Identify primary keys and foreign key relationships\n3. Suggest appropriate data types for the target warehouse\n4. Flag potential data quality issues\n5. Recommend business keys and surrogate keys where appropriate\n6. Consider slowly changing dimensions (SCD) patterns\n7. Output structured mapping in JSON format"
}2. Agent Deployment
Use the Chicory API to create the schema mapping agent:
3. Schema Mapping Function
dbt Generation Agent
1. Agent Configuration
Create the dbt generation agent:
2. dbt Generation Function
Target Standards Configuration
Define your organization's target schema standards:
Testing Agents
1. Unit Testing
2. Integration Testing
Agent Monitoring
1. Performance Metrics
2. Quality Validation
Next: GitHub Actions Workflow
Last updated