Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,26 @@ In Summary:
- `DurableAgent` (Workflow-backed): Interaction is asynchronous—you trigger the agent once, and it runs autonomously in the background until completion. The conversation state and the execution are persisted and can resume across failures or restarts.


#### Replay-Aware Logging

Because `DurableAgent` relies on Dapr Workflows, the underlying execution model uses event sourcing. This means the workflow code is re-executed (replayed) from the beginning to rebuild local state after awaiting external activities or tool calls.

To prevent duplicate logs from polluting your output during these rehydration cycles, Dapr Agents provides a `ContextAwareLogger`. This logger automatically hooks into the `DaprWorkflowContext` and silently suppresses log records when the workflow is actively replaying.

```python
from dapr_agents.utils import get_context_aware_logger
from dapr_agents.workflow.decorators import workflow_entry

# Initialize the logger at the module level
logger = get_context_aware_logger(__name__)

@workflow_entry
def my_workflow(self, ctx: DaprWorkflowContext, wf_input: dict) -> str:
# This will only print once, even if the workflow suspends and replays 5 times
logger.info("Starting workflow execution...")
# ...
```

## Core Agent Features
An agentic system is a distributed system that requires a variety of behaviors and supporting infrastructure.

Expand Down