Commit 70b7bdb
.Net: KernelProcessEventData deserialized in LocalAgentStep (#13203)
### Motivation and Context
1. **Why is this change required?**
Because `LocalAgentStep` was passing `KernelProcessEventData` wrappers
directly into `KernelArguments`, unlike `LocalStep` which unwraps them.
This inconsistency caused agents to receive JSON-like data instead of
the actual payload.
2. **What problem does it solve?**
It ensures that agents receive the real value (e.g. the user’s message
text) instead of the wrapper object, preventing confusing model
responses like *“you seem to be passing a json”*.
3. **What scenario does it contribute to?**
Agent-based process pipelines (for example a simple chat process where
user input is sent to an agent). The agent now correctly sees the user
input as plain text or object, improving reliability and user
experience.
### Description
This PR updates `LocalAgentStep` so that it unwraps
`KernelProcessEventData` before passing it into
`KernelArguments["message"]`.
* If `TargetEventData` is a `KernelProcessEventData`, we now call
`.ToObject()` to get the real value.
* If it is not, we keep the value as it is.
* This makes `LocalAgentStep` consistent with
`LocalStep.AssignStepFunctionParameterValues`.
With this change, agents no longer receive the wrapper object but the
actual payload (for example the plain user input), which avoids the
model interpreting it as JSON.
### Contribution Checklist
- [X] The code builds clean without any errors or warnings
- [X] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [X] All unit tests pass
- [X] I didn't break anyone 😄
Co-authored-by: Dmytro Struk <[email protected]>1 parent 3eb869e commit 70b7bdb
File tree
1 file changed
+10
-1
lines changed- dotnet/src/Experimental/Process.LocalRuntime
1 file changed
+10
-1
lines changedLines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
49 | 58 | | |
50 | 59 | | |
51 | 60 | | |
| |||
0 commit comments