CAR BLOG AGENT

Automated script for an AI agent that enforces a strict narrative and produces ongoing writing content
Language Python
Portfolio Code

Source in this repository

The agent code lives in this repository at code/car-blog-agent/. Clone this project and use the folder below.

How to run

  • Clone this repository, then open a terminal in the-monospace-web/code/car-blog-agent.
  • Install Python and dependencies. Optionally set an OpenAI API key or use Ollama (e.g. model deepseek-r1:1.5b); model name, temperature, and max_tokens can be set in the script.
  • Run the script (e.g. python car_blog_agent.py). Generated articles are saved to blog_articles/.
code/car-blog-agent/

Overview

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.

Architecture

Data flow

Hardcoded trends and audience config → AI agent (strict narrative) → Article generation → Publishing

Key components

Features

Market Categories

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 Targeting

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

Key source file

car_blog_agent.py

Single script containing the hardcoded narrative and all logic:

AI integration

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.

OpenAI API

Optional. Configure with API key; the script still enforces the same strict narrative and structure.

Ollama

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.

Dependencies

Usage

From 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/.

Output Format

Articles are saved as Markdown files with the following structure:

Project Structure

car-blog-agent/
├── car_blog_agent.py    # Main application
└── blog_articles/       # Generated articles (created at runtime)
    ├── index.md         # Blog index
    └── *.md             # Individual articles