Skip to content

Conversation

@igorvolk1961
Copy link

@igorvolk1961 igorvolk1961 commented Nov 25, 2025

Summary

Adds an optional custom_context field to the ResearchContext class to enable projects extending sgr_deep_research to store project-specific data without modifying the core codebase.

Changes

  • Added custom_context: dict | BaseModel | None field to ResearchContext class in core/models.py
  • Field is optional with default=None for full backward compatibility
  • Field description: "Custom context for project-specific data"

Motivation

This change allows downstream projects to extend ResearchContext with custom data structures (e.g., Pydantic models) stored in custom_context, enabling project-specific functionality while keeping the core codebase clean and minimal.

Backward Compatibility

Fully backward compatible - the field is optional with default=None, so existing code will continue to work without any changes. No breaking changes.

Use Case Example

from pydantic import BaseModel

class MyProjectContext(BaseModel):
custom_field: str

context = ResearchContext()
context.custom_context = MyProjectContext(custom_field="value")

Testing

  • ✅ No linter errors
  • ✅ Existing functionality remains unchanged
  • ✅ Field can be set to None, dict, or any BaseModel instance

@igorvolk1961 igorvolk1961 changed the title feat: add custom_context field to esearchontext feat: add custom_context field to researchontext Nov 25, 2025
@igorvolk1961 igorvolk1961 changed the title feat: add custom_context field to researchontext feat: add custom_context field to research context Nov 25, 2025
@virrius
Copy link
Member

virrius commented Dec 1, 2025

Thanks!

Im uncertain whether the Context should be initialized inside the agent or passed in during initialization like DI style.

@EvilFreelancer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants