S
STONI
AI
Strands
Observability
Retry
Timeout
Series

Strands SDK 시리즈 4: 운영 기능 — 상태, 재시도, 타임아웃, 관측성

상태/메모리

const s = strand({
  name: pipeline,
  steps: [
    async (ctx) => {
      ctx.state.inputs = ctx.input;
      return next;
    },
    async (ctx) => {
      // 이전 단계의 상태 접근
      const text = ctx.state.inputs.text;
      ctx.state.summary = await ctx.llm.summarize(text);
      return done;
    },
  ],
});

재시도/타임아웃

const fetchWithGuard = tool({
  name: fetchWithGuard,
  timeoutMs: 5000,
  retry: { maxAttempts: 3, backoffMs: 300 },
  run: async (url: string) => (await fetch(url)).json(),
});

관측성(Tracing)

  • 각 step/툴 호출에 trace id가 부여되고, 실행 로그/지연/오류가 기록됩니다.
  • 로컬에서는 콘솔/파일, 클라우드에서는 APM에 연동하는 패턴이 일반적입니다.

Observability

마지막 편에서는 작은 실전 예제를 end-to-end로 완성합니다.

Clickable cat