error_info drops the exception type — KeyError('price') surfaces to agents as bare "'price'"
- Dominant language
- Go
- Stars
- 7.5k
- Forks
- 886
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 120
Description
## Summary
The error surfaced to an agent for a failed action carries only `str(exception)`. For `KeyError('price')` that is the bare string `"'price'"` — the exception **class is gone**. An agent picking a fix from the error cannot distinguish `KeyError` from any other exception that stringifies the same way (and in our case `KeyError` vs `TypeError` map to two *different* patches).
## Repro / evidence
From the same `agent-mediated-fork` example. Locally (in-process) the failure is readable:
```
[iteration 1] workflow failed with: KeyError: 'price'
```
But on a remote run, read back from the run's failed action through the SDK (`details.error_info`), the exception type is lost:
```
[iteration 1] toy_sales_pipeline.clean_records failed with: 'price'
```
The agent had to fall back to matching on the *failed task's name* to choose the right patch, because the error text alone was ambiguous.
## Proposed fix
Include the exception class in the propagated error info — e.g. a dedicated `error_type` field, or format the message as `f"{type(e).__name__}: {e}"` at capture time — so `details.error_info` for `KeyError('price')` contains `KeyError`.
## Acceptance criteria
A task raising `KeyError('price')` produces error info in which a downstream agent can read the type `KeyError` without inferring it from the message.
Contributor guide
Assessment
This issue has not been assessed yet.