CAR BLOG AGENTAutomated script for an AI agent that enforces a strict narrative and produces ongoing writing content |
Language | Python | |
|---|---|---|---|
| Portfolio | Code | ||
|
The agent code lives in this repository at How to run
|
code/car-blog-agent/ |
Car Blog Agent is an automated Python script that drives an AI agent to stick to a strict narrative and produce ongoing writing content. The narrative, audience targets, and market framing are hardcoded in the script: categories (Electric Vehicles, Used Cars, New Cars, SUVs & Trucks), audience config (technician, consumer, industry, general) with fixed prompt keys and keywords, and article templates. The script feeds this structure to an AI (Ollama or OpenAI) so generated articles stay on-message and match the intended format.
|
Data flow Hardcoded trends and audience config → AI agent (strict narrative) → Article generation → Publishing |
| Category | Trends Analyzed |
|---|---|
| Electric Vehicles | EV adoption rates, battery technology, charging infrastructure |
| Used Cars | Pricing trends, market availability, value retention |
| New Cars | Supply chain recovery, inventory levels, transaction prices |
| SUVs & Trucks | Market share, sales growth, consumer preferences |
| Audience | Focus Areas | Keywords |
|---|---|---|
| Automotive Technicians | Diagnostic tools, repair procedures, service manuals, ASE certification | Technical |
| Car Buyers & Owners | Buying guides, vehicle reviews, ownership tips, maintenance | Consumer |
| Industry Professionals | Market trends, sales data, supply chain, OEM, regulations | Business |
| General Automotive | Automotive news, car technology, EV adoption, autonomous vehicles | General |
Single script containing the hardcoded narrative and all logic:
The script feeds hardcoded narrative, templates, and audience config to an AI so it produces articles that stay on-message. The AI does not choose the narrative; the script does.
Optional. Configure with API key; the script still enforces the same strict narrative and structure.
Local model (e.g. deepseek-r1:1.5b) for content generation. Narrative and format are still defined in the script. Configure model name, temperature, and max_tokens in the script or via your environment.
requests - HTTP requests for API integrationopenai - OpenAI API client (optional)csv - CSV data processingdatetime - Date and time handlingrandom - Random selection for trend samplingtyping - Type hints for code claritydataclasses - Data structure definitionsFrom the project directory, run the script (e.g. python car_blog_agent.py). You can configure an optional OpenAI API key, use_ollama, and ollama_config (model name, temperature, max_tokens) in the script. Specify number of articles and audience mix as needed; generated articles are saved to blog_articles/.
Articles are saved as Markdown files with the following structure:
car-blog-agent/
├── car_blog_agent.py # Main application
└── blog_articles/ # Generated articles (created at runtime)
├── index.md # Blog index
└── *.md # Individual articles