𝗬𝗼𝘂𝗿 𝗔𝗴𝗲𝗻𝘁 𝗗𝗲𝗺𝗼 𝗪𝗼𝗿𝗸𝘀. 𝗬𝗼𝘂𝗿 𝗔𝗴𝗲𝗻𝘁 𝗗𝗼𝗲𝘀𝗻'𝘁.

Most agent architectures fail in real work.

A demo looks good with a single task and a fast response. Real work involves insurance claims, sales sequences, or data reconciliation. These tasks take time and many steps.

The problem is statelessness. Most agents rebuild context from zero every time they interact. They lose the reasoning chain and the progress made. You end up with a polite AI that pretends to know the situation.

Google Cloud experts Addy Osmani and Shubham Saboo shared five patterns to fix this. Here is the breakdown:

  • Checkpoint-and-Resume Treat your agent like a server. Save progress every few units of work. If an agent fails on task 201 of 1,000, it resumes at 201. Do not start from zero.

  • Delegated Approval Stop using Slack or email for human approval. These tools break context. Pause the agent in place. Keep the full state intact so it resumes instantly when a human responds. Use a structured inbox for requests and errors.

  • Memory-Layered Context Separate long-term memory from working memory. Long-term memory stores knowledge across sessions. Working memory handles the current task. You must prevent memory drift where agents learn bad habits from edge cases. Use identity management and a governance layer to block bad data.

  • Ambient Processing Build agents that watch data streams like support tickets or database changes. Do not hardcode rules into the agent. Put rules in an external governance layer. This way, you update rules in one place and the whole fleet follows them.

  • Fleet Orchestration Use a coordinator agent to manage specialist agents. Each specialist has its own tools and identity. This follows the worker pattern used in distributed systems. You can update one specialist without breaking the whole system.

The biggest risk is memory drift.

People focus on prompts but ignore how an agent's behavior changes over time. If an agent learns from bad or strange interactions, it stops acting like the code you wrote.

You must treat agents like microservices. They need identity, a registry, and strict policy enforcement.

Ask yourself: What is the longest task my agent must perform without stopping? If the answer is hours or days, you need these patterns.

에이전트 데모는 잘 작동하지만, 실제 에이전트는 작동하지 않습니다

당신은 몇 주 동안 AI 에이전트를 구축하는 데 시간을 보냈습니다. 프롬프트를 미세 조정하고, 완벽한 도구를 선택했으며, 몇 가지 시나리오에 대해 테스트를 마쳤습니다. 아주 잘 작동합니다. 데모 영상을 찍어 LinkedIn에 올리면 모두가 놀라워합니다.

그런 다음, 이를 배포합니다. 그리고 몇 시간 지나지 않아 에이전트는 실패하기 시작합니다.

왜 그럴까요? '데모'와 '제품' 사이에는 거대한 간극이 있기 때문입니다.

데모에서는 환경을 제어할 수 있습니다. 사용자가 무엇을 물어볼지 정확히 알고 있습니다. 도구가 예상된 데이터를 반환할 것을 알고 있습니다. 즉, '해피 패스(happy path)'에서 작동하고 있는 것입니다.

하지만 프로덕션 환경에서 세상은 무질서합니다.

사용자는 예상치 못한 질문을 던집니다. 도구는 실패하거나 지연이 발생합니다. LLM은 존재하지 않는 파라미터를 환각(hallucinate)해냅니다. 컨텍스트 창은 관련 없는 이력으로 가득 차 혼란스러워집니다.

데모를 넘어 신뢰할 수 있는 에이전트를 만들고 싶다면, 해피 패스를 위한 구축을 멈추고 엣지 케이스(edge cases)를 위한 구축을 시작해야 합니다.

데모의 함정 (The Demo Trap)

데모는 성공적인 시나리오의 집합입니다. 하지만 실제 사용자는 당신의 시나리오를 따르지 않습니다. 데모가 성공하는 이유는 당신이 통제된 환경에서, 통제된 입력값으로 테스트했기 때문입니다.

프로덕션에서 에이전트가 실패하는 이유

1. 해피 패스의 오류 (The Happy Path Fallacy)

개발자는 보통 "사용자가 이렇게 물어보면, 에이전트가 이렇게 답하겠지"라고 가정합니다. 하지만 실제 사용자는 오타를 내기도 하고, 모호하게 말하기도 하며, 전혀 상관없는 주제로 대화를 전환하기도 합니다.

2. 도구 호출의 혼란 (Tool Calling Chaos)

에이전트의 핵심은 도구 사용 능력입니다. 하지만 LLM은 종종 잘못된 인수를 전달하거나, 도구가 반환한 에러 메시지를 이해하지 못하고 엉뚱한 답변을 내놓습니다. 도구가 네트워크 문제로 응답하지 않을 때 에이전트가 어떻게 행동해야 할까요? 대부분의 데모 에이전트는 여기서 멈춰버립니다.

3. 컨텍스트 창의 혼란 (The Context Window Mess)

대화가 길어질수록 컨텍스트 창은 점점 더 복잡해집니다. 이전 대화 내용, 도구 호출 결과, 시스템 프롬프트가 뒤섞이면서 LLM은 핵심을 놓치기 시작합니다. 이는 에이전트가 자신의 목표를 잊어버리거나, 이전 단계의 오류를 반복하는 결과로 이어집니다.

진짜 에이전트를 구축하는 방법

데모를 넘어 실제 제품으로 가기 위해서는 다음 세 가지가 필요합니다.

1. 평가 프레임워크 (Evaluation Frameworks)

"잘 작동하는 것 같다"는 느낌만으로는 부족합니다. 에이전트의 성능을 정량적으로 측정할 수 있는 테스트 세트가 필요합니다. 다양한 시나리오, 특히 실패할 가능성이 높은 시나리오를 포함한 '에발(Evals)'을 구축하세요.

2. 관측 가능성 (Observability)

에이전트가 왜 그런 결정을 내렸는지, 어느 단계에서 실패했는지 알아야 합니다. 추적(tracing) 도구를 사용하여 각 단계의 프롬프트, 도구 호출, LLM의 응답을 모니터링하세요.

3. 가드레일 (Guardrails)

에이전트가 경로를 벗어나지 않도록 제어 장치를 마련해야 합니다. 입력값에 대한 검증, 출력값에 대한 검증, 그리고 에이전트가 무한 루프에 빠지지 않도록 하는 제한 사항을 설정하세요.

결론

훌륭한 에이전트는 단순히 똑똑한 모델을 사용하는 것이 아니라, 실패를 어떻게 관리하느냐에 달려 있습니다. 데모를 만드는 것에 만족하지 마세요. 실제 세상의 무질서함에 대비한 에이전트를 만드세요.


선택적 학습 커뮤니티: https://t.me/GyaanSetuAi