03 / PROJECTENGINEERING CASE · 2026

Local AI Agent
for Verified
Code Changes

AI Integration · Agent Tooling · Local LLM Systems

I designed a local environment where an AI agent works with PHP and Python projects: it locates relevant code, runs commands in an isolated environment, makes bounded edits and verifies the result before completing a task.

My ownership covered architecture, tool integration, editing policy, verification, model tuning and local model routing.

2PHP AND PYTHON EDIT WORKFLOWS
7DOCUMENTED INTERNAL PASS SCENARIOS
4.91×INCREASE IN TESTED CONTEXT

Results from internal tests on 13–14 September 2026.

01 / CHALLENGE AND RESULT

From a task to a verified edit

I needed a local environment in which a model could work with a real repository while its actions remained bounded by a project workspace and verification tools. I connected local inference, code access, Docker sandbox execution and result verification into one PHP/Python workflow. This is an internal engineering project.

02 / MY CONTRIBUTION

What I designed and integrated

Architecture and access

Connected Proxmox VE, LXC, Docker and a persistent workspace. The agent executes commands inside the sandbox without direct shell access to the host.

Code editing policy

Set up targeted reads and edits against the current file state; disallowed whole-file rewrites of existing files and unbounded retries.

Result verification

Added PHP/Python lint, static checks and tests to the task completion flow. A second rejected edit stops further mutations.

Tuning and routing

Profiled Qwen3.6-35B-A3B across CPU/GPU and integrated llama-router: the requested model loads on GPU while a separate CPU model handles background tasks.

03 / WORKFLOW

How the agent completes a task

The documented PHP scenario covers relevant repository reads, an edit, verification and finalization. A separate Python scenario tests recovery from a broken file.

  1. 1

    Finds the relevant code and reads the current file state.

  2. 2

    Edits a coherent range without rewriting the whole existing file.

  3. 3

    Runs project checks: lint, static analysis and tests for PHP; compile/Ruff for Python.

  4. 4

    Finalizes after PASS. A second rejected edit stops further changes.

Documented internal PASS scenarios

  • Native tool calls and JSON arguments
  • DFlash and tool-call serialization
  • Read-only repository analysis
  • PHP edit → lint/static/tests → finalize
  • Python recovery → compile/Ruff → finalize
  • Hard stop after exhausted edit budget
  • Workspace Tool 1.4.16 regression suite

04 / MEASUREMENTS

What the tests showed

Two internal configurations tested on 13–14 September 2026. Benchmark figures and observations in coding requests are labeled separately.

Measure Before Result Test conditions
Context28,672 tokens140,800 tokens (4.91×)Tested request; 143,872 tokens caused CUDA OOM.
Cold prefill111.05 tok/s · uBatch 128~274.6–276.2 tok/s · uBatch 512~275.6 tok/s on an 8,117-token cold request; 2.48× in this sweep.
Decode26.11 tok/s · no DFlash32.20 tok/s · DFlash n=2~23% gain in a benchmark, not a per-request guarantee.
Coding turns—~30–33 tok/sObserved after tuning in representative coding requests.
Prefix cache—~97–98% reuseRepresentative final passes only; depends on session and model switching.

05 / ARCHITECTURE

How the components fit together

Architecture: Open WebUI, llama-router, GPU model, Workspace Tool, Docker sandbox, persistent workspace and separate CPU model
  1. Open WebUI
  2. llama-router
  3. Qwen / Impish
  4. Workspace Tool
  5. Docker sandbox · PHP / Python
  6. Persistent workspace
Open WebUI routes a request through llama-router to the requested GPU model. Workspace Tool bounds repository operations; commands run in a Docker sandbox. One model occupies the GPU at a time, and a separate CPU model handles background tasks.

06 / ENGINEERING DECISIONS

How I selected the configuration

Context and memory

Kept q8_0 K/V and a tested 140,800-token ceiling. A 143,872-token request exposed the memory boundary.

Batch and MoE placement

uBatch 512 improved prefill; 544/576 produced no meaningful gain. n-cpu-moe=36 uses less VRAM without a speed loss against 34.

Speculative decoding

DFlash n=2 improved decode in the recorded sweep; n=4 and n=8 performed worse.

07 / EVIDENCE

How to review this work

The Russian-language PDF records the architecture, configuration, measurements and internal test results from 13–14 September 2026. I can walk through sanitized task traces and verifier output in an interview.

Technical case study (PDF, RU · 220 KB) ↗

For an AI feature in a commercial product, see the X-BOT support RAG FAQ. Explore X-BOT →

08 / ROLE RELEVANCE

Where this experience applies

AI/LLM integration · Agent tooling · Workflow automation · PHP/Python verification · Local inference · Model routing

Discuss a role →