While reviewing deepcopy usage in Pipeline, I've also seen several deepcopies in Agent.
Worth investigating if they can be safely removed/handled differently for performance reasons.
-
agent_inputs span tags
|
with self._create_agent_span() as span: |
|
span.set_content_tag("haystack.agent.input", _deepcopy_with_exceptions(agent_inputs)) |
Apparently agent_inputs is created here and used for the span tag only. If that's the case, no need to deepcopy it.
-
state_schema
|
resolved_state_schema = _deepcopy_with_exceptions(self._state_schema) |
The goal seems to keep self._state_schema and self.state_schema separate. Would a shallow dict() copy be sufficient?
While reviewing deepcopy usage in Pipeline, I've also seen several deepcopies in Agent.
Worth investigating if they can be safely removed/handled differently for performance reasons.
agent_inputsspan tagshaystack/haystack/components/agents/agent.py
Lines 755 to 756 in d12124a
Apparently
agent_inputsis created here and used for the span tag only. If that's the case, no need to deepcopy it.state_schemahaystack/haystack/components/agents/agent.py
Line 292 in d12124a
The goal seems to keep
self._state_schemaandself.state_schemaseparate. Would a shallowdict()copy be sufficient?