-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Labels
Description
Context
Dapr agents currently lack a built-in mechanism to intercept, observe, or modify execution flow at critical points, such as before/after LLM or tool calls. Introducing a standardized callback interface enhances extensibility, debugging, and control, enabling advanced use cases like auditing, response caching, guardrails, and dynamic modification of inputs/outputs.
Acceptance Criteria
- Support four callback types:
- before_llm_call(context): invoked before calling the LLM.
- after_llm_call(context, response): invoked after receiving LLM response.
- before_tool_call(context): invoked before invoking a tool.
- after_tool_call(context, result): invoked after tool execution.
- Each callback receives a context object with execution metadata (e.g., agent name, session ID, invocation details).
Callbacks can:
- Log, inspect, or modify request data.
- Return None to proceed or return a specific value to override execution.
Callback return behavior:
- Returning a result from a before_* callback skips execution and uses that value.
- Returning a result from an after_* callback replaces the original output.
cecilphillipcecilphillip