728x90
반응형

Your AI agent approved a refund outside the standard time frame. Now a compliance officer wants to know why, and whether the support agent granted a refund like this before. The chat log shows the conversation between the customer and the agent. The log doesn’t show what the agent checked before granting the refund or how it handled similar situations previously.

Without a decision trace, you can try to piece together why an agent made a decision, but its reasoning is really a black box. With a decision trace, you get a structured record of how an AI agent reached a decision. It captures not only the outcome but also the reasons and tools the agent used. This is stored in a context graph, where those steps stay connected to the conversations, facts, and other information the agent relied on, so you can follow them to the outcome.

Here’s why that matters, and what it takes to give your agents that kind of persistent, queryable memory.

More in this guide:

  • Why AI agents need a record of their reasoning
  • 의사결정 추적은 무엇을 기록하나요?
  • 결정 추적 vs. LLM 추적 vs. 로그
  • 컨텍스트 그래프의 결정 추적
  • Neo4j로 결정 추적을 기록하는 방법
  • Give your agents reasoning memory
  • 결정 추적: FAQ

AI 에이전트에 추론 기록이 필요한 이유

AI 에이전트는 작업을 수행하면서 많은 결정을 내립니다. 그들은 이용 가능한 정보를 사용하고, 도구를 선택하고, 정책을 적용하고, 다음에 수행할 작업을 결정합니다. 비결정적 LLM이 이 프로세스의 중심에 있기 때문에 동일한 입력이 항상 동일한 경로나 결과를 생성하는 것은 아니며 실행이 끝나면 해당 선택의 배경이 사라질 수 있습니다. 워크플로가 길어지면 상담원이 이전 결정을 추적하지 못하거나 원래 목표에서 벗어날 수도 있습니다.

결정 추적은 이러한 결정에 지속적인 기록을 제공합니다. 상담원이 예기치 않게 행동하거나 다른 팀이 상담원이 케이스를 처리한 방식을 검토해야 하는 경우 해당 기록을 검사할 수 있습니다. 해당 기록은 프로덕션 시스템에 대한 거버넌스 및 감사 요구 사항을 지원합니다.

Past traces can become part of the context for future tasks, too. Alongside enterprise knowledge and conversations, an agent can retrieve relevant past decisions as precedents, and humans can weigh in so that precedents reflect business needs and mistakes don’t get repeated.

Recording decision traces pays off every time a past decision gets looked at again:

  • Explainability: Every decision stays connected to the information and previous decisions that shaped it, so you can trace the rationale behind it directly. For example, when that refund gets questioned later, the trace shows the policy the agent applied and the order details it checked.
  • 디버깅:다단계 에이전트 워크플로는 여러 가지 이유로 실패할 수 있습니다. 결정 추적에는 기록된 각 단계, 도구 호출 및 결과가 표시되므로 워크플로가 궤도에서 벗어난 위치를 더 쉽게 식별할 수 있습니다. 추적은 도구 호출이 비어 있고 에이전트가 즉석에서 수행한 정확한 단계를 보여줍니다.
  • 규정 준수 및 감사: Decision traces capture not just what the agent decided but how it got there, creating an audit trail of every step, tool call, and policy the agent consulted. That record meets the transparency demands that regulators and stakeholders increasingly place on automated decisions.
  • Consistency: By retrieving relevant decision traces, an agent applies the same approach to similar cases and produces more consistent outcomes. The next refund request with the same parameters retrieves the earlier trace as precedent, so the agent provides the same answer.
  • Learning over time: Every completed trace adds another example to the graph. As the collection grows, agents can search previous decisions, find similar situations, and reuse approaches that worked well before. Reasoning memory records how decisions get made and why — a compounding loop of institutional intelligence.
  • Shared reasoning across agents: When multiple agents use the same context graph, they can retrieve relevant decision traces from one another and build on prior work. A triage agent can read the resolution agent’s past traces before escalating a case, and each sees the decisions it took no part in making.

What does a decision trace record?

Each decision trace provides the breadcrumbs you need to better understand what happened as an agent works through a decision. These include the following core elements:

  • Decision:에이전트가 결정한 것.
  • Outcome: The result of that decision.
  • Reasoning steps: The rationale behind decisions.
  • Tool calls: The tools the agent called, the actions it took, and the results it received.
  • Context: The entities, conversations, and other information used at each step are linked back to the trace.

Take the support agent example. Before approving the refund, it checks the order and applies the relevant refund policy. The decision trace connects those steps and the policy lookup result to the final approval, so someone reviewing the case later can see what information the agent used and what it did before making the decision.

Decision traces vs. LLM traces vs. logs

Decision traces, LLM traces, and application logs can all tell you something about an agent’s activity, but they answer different questions.

  Decision traces LLM traces Application logs
Primary question Why did the agent make this decision? What happened during this model run? What happened and when?
Records Decisions, outcomes, reasoning steps, tool calls, and context Model inputs, outputs, tool calls, and run details Events, timestamps, errors, and system activity
Primary use Explain, audit, and reuse past decisions Debug and inspect model runs Monitor and troubleshoot application behavior
Persistence Reasoning memory that the agent can query and reuse Scoped to a single model run and stored in an observability tool Stored as an event history

You use a log to see the basic actions, while an LLM trace like LangSmith can help you inspect the model that produced the actions, but only a decision trace connects the dots. The trace lets you walk back from the approval to the information, actions, and prior decisions that shaped it. And unlike the other two, it persists as memory that the agent itself can retrieve, inside the same graph as the knowledge and conversations the decision drew on.

Decision traces in a context graph

Decision traces are primarily stored in a context graph, a persistent memory system for AI agents, where the connections between memories stay traversable. It brings together three types of memory. Long-term memory holds enterprise knowledge, short-term memory captures conversation history, and reasoning memory records decision traces. Together, these layers give an agent access to what it knows, what happened in the current interaction, and the decisions it made along the way.

Decision traces form the reasoning memory layer and connect directly to the other two types of memory. That means an outcome can connect directly to the company facts the agent relied on and the conversation that triggered it. Going back to that support agent scenario, that refund approval can connect not only to the customer’s request but also to the relevant refund policy and the other aspects of the decision trace. Following those relationships shows the full context around the decision.

Because the three memory layers share the same connected graph, an agent can query them together to see the full context.

How to record decision traces with Neo4j

Neo4j Agent MemoryNeo4j 그래프에 단기, 장기, 추론 메모리를 함께 제공하는 단일 및 다중 에이전트 시스템용 메모리 시스템입니다.

이미 Neo4j를 실행 중인 팀을 위한 자체 호스팅 옵션과 함께 호스팅된 메모리 서비스가 지원되는 Python 및 TypeScript SDK로 제공됩니다. 다음을 포함한 에이전트 프레임워크와 통합됩니다.랭체인, Pydantic AI, LlamaIndex, CrewAI 및 OpenAI Agents SDK를 사용하여 이미 구축한 에이전트에 메모리를 추가할 수 있습니다. Neo4j도 제공합니다.모델 컨텍스트 프로토콜(MCP)에이전트 통합을 위한 도구입니다.

추적 캡처는 명시적입니다. 코드에 따라 기록되는 내용과 시기가 결정됩니다. 실제로는 해당 배선을 한 번만 작성하면 됩니다. 예를 들어 LangChain을 사용하면 콜백 핸들러는 체인이 시작될 때 추적을 열고 각 도구 호출이 발생할 때마다 기록하며 체인이 끝나면 추적을 완료합니다. 그 이후에 실행되는 모든 에이전트는 추가 작업 없이 캡처됩니다.

추적 수명주기는 다음을 사용하는 간단한 코드 블록입니다.neo4j-에이전트-메모리 SDK. Python의 경우 다음과 같이 설치하십시오.pip install neo4j-agent-memory.

import asyncio

from pydantic import SecretStr

from neo4j_agent_memory import MemoryClient, MemorySettings


async def handle_refund():
    settings = MemorySettings(
        neo4j={"uri": "bolt://localhost:7687", "password": SecretStr("password")}
    )

    async with MemoryClient(settings) as memory:
        # Open a trace when the agent starts working on a decision
        trace = await memory.reasoning.start_trace(
            "refund-4823",
            task="Handle refund request #4823",
        )

        # Record a reasoning step
        step = await memory.reasoning.add_step(
            trace_id=trace.id,
            thought="Check refund eligibility against policy",
        )

        # Record the tool call and its result
        await memory.reasoning.record_tool_call(
            step.id,
            tool_name="refund_policy_lookup",
            arguments={"order_id": "4823"},
            result={"eligible": True, "window_days": 30},
        )

        # Close the trace with the outcome
        await memory.reasoning.complete_trace(
            trace.id,
            outcome="Refund approved",
            success=True,
        )


asyncio.run(handle_refund())

Neo4j 에이전트 메모리는 에이전트가 작동하는 동안 결정 추적을 기록합니다.start_trace()추적을 열고,add_step()각각의 생각과 행동을 추가하고record_tool_call()도구 호출과 그 결과를 캡처합니다. 임무가 끝나면,complete_trace()결과로 추적을 닫습니다.

기록되면 이러한 추적은 컨텍스트 그래프의 일부가 되어 추론 단계, 도구 호출 및 주변 컨텍스트와의 연결을 검사할 수 있습니다.

트레이스를 읽는 것도 마찬가지로 직접적입니다.get_trace()단계, 도구 호출, 결과 등 전체 기록을 반환합니다.get_similar_traces()현재와 ​​같은 과거 결정을 찾아주므로 에이전트나 검토자는 조치를 취하기 전에 선례를 확인할 수 있습니다.

# Why did the agent approve this refund? Retrieve the complete trace
full_trace = await memory.reasoning.get_trace(trace.id)

# Before the next similar decision, retrieve what worked before
precedents = await memory.reasoning.get_similar_traces(
    "Handle refund request", limit=3
)

첫 번째 전화는 이전 지원 시나리오의 규정 준수 담당자에게 응답합니다. 추적에서는 상담원이 주문을 확인하고, 환불 정책을 조회하고, 30일 이내에 자격을 확인하고, 환불을 승인한 것을 보여줍니다.

더 빠른 시작을 위해,컨텍스트 그래프 생성지식 그래프, 의사결정 추적, 스트리밍 채팅, 그래프 시각화 기능이 내장된 풀스택 에이전트 애플리케이션을 구축할 수 있습니다. 더 자세히 알고 싶다면Neo4j 에이전트 메모리 문서 and 그래프아카데미 과정.

실제적인 예를 보려면 다음을 참조하세요.레니의 기억컨텍스트 그래프를 사용하여 AI 에이전트에 영구 메모리를 제공합니다.

에이전트에게 추론 메모리 제공

Decision traces give agents a record of the decisions they’ve made, the context behind them, and the resulting outcomes. As part of a context graph’s reasoning memory, those traces give you and other teams a way to inspect past decisions and why agents made them.

That history becomes more useful as it grows. Agents retrieve relevant past decisions when they encounter similar situations, while teams can use the same traces to explain decisions, review agent behavior, and support governance requirements. Combined with enterprise knowledge대화 기록, 추론 메모리는 상담원이 일관되고 설명 가능한 결정을 내리는 데 필요한 전체 컨텍스트를 제공합니다.

Neo4j is the 지식층 for enterprise AI — connecting the context, memory, and reasoning that agents rely on. The next time someone asks why an agent made a particular decision, the answer can be a graph query away.

결정 추적: FAQ

결정 추적은 AI 에이전트가 결정에 도달한 방법에 대한 구조화된 기록입니다. 각각은 결정 자체, 에이전트가 도중에 기록한 이유, 결과에 도달하는 데 사용한 도구를 포착합니다.

AI 에이전트는 작업을 단계별로 추론하지만 일단 실행이 끝나면 해당 선택 뒤에 숨은 컨텍스트의 대부분이 사라질 수 있습니다. 워크플로가 길어지면 상담원이 이전 결정을 추적하지 못하거나 원래 목표에서 벗어날 수도 있습니다. 결정 추적은 상담원이 지속적으로 행동할 수 있도록 이러한 결정에 대한 지속적인 기록을 제공합니다.

의사결정 추적은 결정과 그 결과, 각 추론 단계의 근거와 조치, 모든 도구 호출과 그 결과, 결정이 도출된 엔터티 및 대화에 대한 링크를 기록합니다.

로그는 발생한 상황을 캡처하고 LLM 추적은 디버깅을 위해 실행된 모델의 세부 정보를 기록합니다. 결정 추적은 에이전트가 결정을 내린 이유를 캡처하고 에이전트가 쿼리하고 향후 작업에서 재사용할 수 있는 메모리로 유지됩니다.

AI 에이전트는 행동에 앞서 과거 의사결정 흔적에서 유사한 상황을 검색하고 관련 판례를 검색할 수 있다. 그런 다음 이전에 작동했던 접근 방식을 재사용하여 유사한 사례를 보다 일관되게 처리하고 시간이 지남에 따라 의사 결정을 개선하는 데 도움이 됩니다.

Neo4j 에이전트 메모리는 에이전트가 작동할 때 의사 결정 추적을 기록합니다.start_trace()추적을 열고,add_step() and record_tool_call()추론과 도구 사용을 포착하고complete_trace()결과로 추적을 닫습니다.


에이치시스템즈LogTree는 Neo4j 기반 GraphRAG 플랫폼으로, 데이터를 자동으로 지식그래프화하고 자연어 질의로 즉시 답을 제공합니다.

👉 에이치시스템즈 홈페이지

728x90
반응형

+ Recent posts