Skip to content

EaCognitive/ai-coder-production-lab

Repository files navigation

AI Coder Production Lab

Production-minded reference workflow for AI coding and support-ticket automation. It is intentionally small, but it demonstrates the engineering surface employers usually look for after the first headline: typed contracts, local RAG, safety gates, confidence scoring, structured output, evaluation, traceability, CI, and documentation.

This is not a chatbot demo. The workflow is deterministic so it can be tested without live model access, then swapped behind explicit agent/model interfaces in a production deployment.

What It Shows

  • src/ Python package layout with Pydantic contracts
  • local Markdown knowledge base as the only authoritative source
  • retrieval with exact error-code boosting
  • classification, clarification, refusal, and resolution states
  • prompt-injection and unsafe-request detection
  • structured TicketResolution output
  • confidence calculation based on evidence, metadata, validation, and safety
  • JSONL OpenTelemetry-style trace events
  • regression eval cases and CI quality gates

Architecture

SupportTicket
  -> intake and safety screen
  -> local KB retrieval
  -> deterministic classifier
  -> confidence and policy gate
  -> schema-validated TicketResolution
  -> JSONL trace events

The same seams map cleanly to LLM-backed agents later: prompts live in prompts/, workflow state is explicit, and final outputs are validated before any downstream system consumes them.

Demo

uv sync --locked --extra dev
uv run python scripts/run_demo.py
uv run python scripts/run_evals.py

Example output is a structured ticket resolution with category, priority, status, proposed solution or follow-up questions, retrieved sources, safety flags, and reasoning trace.

Quality Gates

uv run ruff check .
uv run ruff format --check .
uv run mypy src
uv run pytest
uv run coverage run -m pytest
uv run coverage report
uv run python scripts/run_evals.py

The GitHub Actions workflow runs the same gates on push and pull request.

Case Study

This repository is a compact example of the same production AI patterns used in larger systems:

Repository Map

  • src/ai_coder_production_lab/: workflow, contracts, retrieval, safety, tracing, evals
  • knowledge_base/: local authoritative support knowledge
  • prompts/: versioned prompt assets and lifecycle notes
  • tests/: unit, workflow, tracing, and regression-eval tests
  • docs/: architecture, RAG, observability, threat model, and trade-offs
  • schemas/v1/: versioned response contract for downstream clients
  • .github/workflows/ci.yml: lint, format, type, test, coverage, and eval gates

Why This Matters

Production AI coding systems fail less because of model choice than because of weak boundaries: untyped outputs, hidden state, ad hoc prompts, no evals, no policy gate, and no traceability. This lab keeps those concerns visible in a runnable codebase.

About

Production-minded AI coder workflow lab with local RAG, safety gates, structured outputs, tracing, evals, and CI.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages