8 views
This guide focuses on coding agent intent APIs for production systems, with practical trade-offs for reliability, security, and cost.
LLMs that emit unified diffs against moving files will corrupt JSX “successfully.” Safer coding agents emit intents (AST operations, codemod names, parameter maps). A deterministic apply layer turns intents into patches.
⚡ TL;DR: Model outputs Intent JSON; apply layer runs jscodeshift/libcst/ts-morph. Reject freeform file bytes. Validate AST after apply.
coding agent intent APIs: production guidance
python
# intents/schema.py
from pydantic import BaseModel, Field
from typing import Literal, Any
class Intent(BaseModel):
kind: Literal["rename_symbol", "add_import", "wrap_call", "codemod"]
path: str
params: dict[str, Any] = Field(default_factory=dict)
rationale: str
json
{
"kind": "rename_symbol",
"path": "src/billing/invoice.ts",
"params": {"from": "calcTotal", "to": "calculateInvoiceTotal"},
"rationale": "Match domain language in ADR-17"
}
Deterministic apply
typescript
// apply/rename.ts
import { Project } from "ts-morph";
export function applyRename(path: string, from: string, to: string) {
const project = new Project();
const sf = project.addSourceFileAtPath(path);
sf.getDescendantsOfKind(/* Identifier */).forEach((id) => {
if (id.getText() === from) id.replaceWithText(to); // ✅ AST-aware
});
sf.saveSync();
}
python
❌ # apply/dispatch.py
HANDLERS = {
"rename_symbol": apply_rename,
"add_import": apply_add_import,
"codemod": apply_named_codemod,
}
def apply_intent(intent: Intent):
fn = HANDLERS.get(intent.kind)
if not fn:
raise ValueError(f"unknown_intent:{intent.kind}")
return fn(intent.path, **intent.params)
open(path,'w').write(model_bytes) — never let the model own the file body.
Closing checklist
- [ ] Typed intents only
- [ ] AST/codemod apply layer
- [ ] Parse/typecheck after apply
- [ ] Allowlist codemod names
- [ ] Keep a rollback snapshot per intent
Series navigation
Day 56: Supervisor Patterns on Bedrock Agents · Day 58: Spec-First: OpenAPI Remains Source of Truth Last updated September 11, 2026 Related: AWS Lambda Coding Agent Sandbox: Safe Tool Isolation for LLM Agents; Day 70: Project: Secure Coding-Agent Sandbox on ECS Fargate; IAM for AI Agents: Condition Keys That Limit Blast Radius by Tag.Watch: 100 Days of AI on YouTube
Short videos from CheatCoders, one AI engineering topic per day.
Most viewed
- Python Decorators Explained: From Simple Wrappers to Production Patterns
- Claude Code vs Cursor vs GitHub Copilot: Choose by Workflow, and Set Up One Repo That Works With All Three
- AI Agent Frameworks in 2025: LangGraph vs CrewAI vs AutoGen vs Raw API
- Python String Methods: Every str Method With Real Production Examples
- Css Animation Performance: Performance-Optimized Motion for Modern UIs
Newly added
- AWS Systems Manager Parameter Store: Hierarchical Runtime Config for Coding Agents
- Amazon Cognito Identity Pools: Federate Coding-Agent Tool Callers Without Long-Lived Keys
- Amazon Athena for Coding Agents: Query Tool Audit Logs and Eval Traces on S3 Without a Warehouse
- AWS Batch for Coding Agents: Parallel Overnight PR Reviews and Long-Running Jobs Without Lambda Timeouts
- Amazon Bedrock Prompt Management: Version and A/B Test Coding-Agent System Prompts
Deep-dive PDF
Get the expanded guide for this post — extra diagrams-style checklists, failure modes, and a production walkthrough. Free when you subscribe to CheatCoders.
Already subscribed? or open the subscribe page.
Discover more from CheatCoders
Subscribe to get the latest posts sent to your email.
