Series · Folio

Python으로 만드는 Production RAG Agent

10 parts

프로젝트 구조에서 API·테스트·배포까지 이어지는 초·중급 10편

프로젝트 경계에서 LLM client, 복원력, retrieval adapter, context builder, agent runtime, session, streaming API, software test, production release로 이어지는 Python RAG Agent 로드맵
대상
RAG와 Agent 원리를 익힌 뒤 실제 Python 서비스로 조립하고 장애·상태·테스트·배포까지 책임지려는 초·중급 개발자
읽고 나면
Port·Adapter 경계, LLM·retrieval client, context builder, typed runtime, session persistence, FastAPI streaming, software test와 CI release를 하나의 Production RAG Agent로 연결할 수 있음
추천 진입

№005 production-rag-agent-python · 05

RAG Prompt·Context Builder: Evidence Budget과 Citation 검증 (5/10)

검색 Evidence를 결정적 context bundle로 조립합니다. token budget, 중복 제거, 원문 span, untrusted data 격리와 server-side citation ID 검증을 Python으로 구현합니다.

#RAGAgent #Python #PromptEngineering #ContextEngineering
검색 Evidence가 dedup과 token budget packer를 지나 S1 S2 context block으로 변환되고 structured answer의 citation ID가 server-side evidence map에서 검증되는 흐름
№007 production-rag-agent-python · 07

RAG Session 영속화: PostgreSQL·Redis·Idempotency 설계 (7/10)

Agent session을 PostgreSQL versioned event로 저장합니다. optimistic concurrency, idempotency key·request hash·lease, Redis cache와 crash window를 Python·SQL로 구현합니다.

#RAGAgent #Python #PostgreSQL #Redis
중복 Agent 요청이 tenant와 operation 범위의 idempotency row에서 합류하고 PostgreSQL session version과 event를 commit한 뒤 Redis versioned cache를 갱신하는 흐름
№009 production-rag-agent-python · 09

RAG Agent 테스트: Fake·Contract·Record/Replay 설계 (9/10)

RAG Agent를 외부 API 없이 검증합니다. deterministic fake, 공통 contract suite, HTTPX transport, 비밀정보를 제거한 record/replay와 fault injection을 설계합니다.

#RAGAgent #Python #Testing #Pytest
순수 unit test와 fake contract HTTP transport record replay live smoke offline evaluation으로 구성한 RAG Agent 테스트 피라미드