strands.experimental.steering.context_providers.ledger_provider
Ledger context provider for comprehensive agent activity tracking.
Tracks complete agent activity ledger including tool calls, conversation history, and timing information. This comprehensive audit trail enables steering handlers to make informed guidance decisions based on agent behavior patterns and history.
Data captured:
- Tool call history with inputs, outputs, timing, success/failure
- Conversation messages and agent responses
- Session metadata and timing information
- Error patterns and recovery attempts
Usage: Use as context provider functions or mix into steering handlers.
LedgerBeforeToolCall
Section titled “LedgerBeforeToolCall”class LedgerBeforeToolCall(SteeringContextCallback[BeforeToolCallEvent])Defined in: src/strands/experimental/steering/context_providers/ledger_provider.py:28
Context provider for ledger tracking before tool calls.
__init__
Section titled “__init__”def __init__() -> NoneDefined in: src/strands/experimental/steering/context_providers/ledger_provider.py:31
Initialize the ledger provider.
__call__
Section titled “__call__”def __call__(event: BeforeToolCallEvent, steering_context: SteeringContext, **kwargs: Any) -> NoneDefined in: src/strands/experimental/steering/context_providers/ledger_provider.py:35
Update ledger before tool call.
LedgerAfterToolCall
Section titled “LedgerAfterToolCall”class LedgerAfterToolCall(SteeringContextCallback[AfterToolCallEvent])Defined in: src/strands/experimental/steering/context_providers/ledger_provider.py:58
Context provider for ledger tracking after tool calls.
__call__
Section titled “__call__”def __call__(event: AfterToolCallEvent, steering_context: SteeringContext, **kwargs: Any) -> NoneDefined in: src/strands/experimental/steering/context_providers/ledger_provider.py:61
Update ledger after tool call.
LedgerProvider
Section titled “LedgerProvider”class LedgerProvider(SteeringContextProvider)Defined in: src/strands/experimental/steering/context_providers/ledger_provider.py:83
Combined ledger context provider for both before and after tool calls.
context_providers
Section titled “context_providers”def context_providers(**kwargs: Any) -> list[SteeringContextCallback]Defined in: src/strands/experimental/steering/context_providers/ledger_provider.py:86
Return ledger context providers with shared state.