Summary
Address cross-cutting consistency gaps and DRY opportunities across the Penelope target implementations and SDK telemetry integrations, identified during the review of PR #2057.
Background / Context
PR #2057 (Pydantic AI integration) revealed several inconsistencies and duplication patterns that exist across all targets and integrations, not just Pydantic AI. These are best addressed in a separate PR to keep #2057 focused.
Deliverables
Acceptance Criteria
Additional Context
Related to PR #2057: #2057
Summary
Address cross-cutting consistency gaps and DRY opportunities across the Penelope target implementations and SDK telemetry integrations, identified during the review of PR #2057.
Background / Context
PR #2057 (Pydantic AI integration) revealed several inconsistencies and duplication patterns that exist across all targets and integrations, not just Pydantic AI. These are best addressed in a separate PR to keep #2057 focused.
Deliverables
try/except ImportErrorguards inpenelope/src/rhesis/penelope/targets/__init__.pyso that missing optional dependencies (langchain, langgraph, pydantic-ai) degrade gracefully instead of breaking the entire importa_send_message()toLangChainTargetandLangGraphTarget(usingainvoke/arun) instead of relying on the base class thread-pool fallback, matching PydanticAITarget's patternPatchStatebase class or factory from the duplicatedAgentPatchState(pydantic_ai.py) andGraphPatchState(langgraph.py) intointegrations/base.pyai.llm.invoke) inside Pydantic AI agent runs, matching the visibility LangChain/LangGraph provide for individual model calls within an agent runAcceptance Criteria
import rhesis.penelope.targetssucceeds on a minimal install without langchain, langgraph, or pydantic-aiLangChainTargetandLangGraphTargethave native async paths that do not useasyncio.to_threadGraphPatchStateandAgentPatchStateshare a common base, reducing code duplicationai.llm.invokechild spans for individual model callsAdditional Context
Related to PR #2057: #2057