SDK violates project rule: direct `os.getenv` in search tools and monitor
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 72/100
Research direction
Start with CLAUDE.md and the five listed SDK files, locating each environment read and its constructor. Then trace the corresponding backend/services/.../*_service.py callers to understand how configuration reaches the SDK. Done means SDK modules no longer read these variables directly, callers pass configuration explicitly, and relevant tests cover per-instance configuration without environment mutation.
Written by the indexing model from the issue text.
Description
CLAUDE.md is explicit:
SDK modules (
sdk/) should never read environment variables directly - accept configuration via parameters
But the SDK currently has five direct env reads:
| File | Line | Variable |
|---|---|---|
sdk/nexent/core/tools/linkup_search_tool.py |
65 | DATA_PROCESS_SERVICE |
sdk/nexent/core/tools/tavily_search_tool.py |
68 | DATA_PROCESS_SERVICE |
sdk/nexent/core/tools/exa_search_tool.py |
69 | DATA_PROCESS_SERVICE |
sdk/nexent/monitor/monitoring.py |
1046 | ENABLE_MODEL_MONITORING |
sdk/nexent/monitor/monitoring.py |
1048-1051 | MODEL_MONITORING_BATCH_SIZE, MODEL_MONITORING_FLUSH_INTERVAL_SECONDS |
For example, linkup_search_tool.py:
def __init__(
self,
linkup_api_key: str = Field(description="Linkup API key"),
observer: MessageObserver = Field(...),
max_results: int = Field(..., default=3),
image_filter: bool = Field(..., default=True)
):
super().__init__()
...
self.data_process_service = os.getenv("DATA_PROCESS_SERVICE") # <-- violates SDK rule
The tavily and exa variants even carry a # TODO add data_process_service comment next to the line, which suggests the author already knew this was a stop-gap.
Why this matters
- The SDK is imported by
backend/and shipped aspip install nexent. External consumers will not haveDATA_PROCESS_SERVICEexported and will silently getNone, breaking the image-filter callback path insideforward(). - The two monitoring knobs in
MonitoringRecordBuffer.__init__mean an SDK user must set process-wide env vars to tune behaviour — there is no per-instance override. - Tests can't override these without
monkeypatch.setenv, which adds shared global state to the test suite.
Suggested fix
Promote each variable to a constructor parameter with a default of None, and have backend/services/.../*_service.py read from consts.const and pass the value through, per the documented architecture rule.
Severity: Medium (architectural debt; functionally works for the in-tree integration but blocks redistribution and clean tests).
- Dominant language
- Python
- Stars
- 5.9k
- Forks
- 731
- Avg merge
- 19h 34m
- Merged PRs (30d)
- 172
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ModelEngine-Group/nexent
-
OpenAIModel: default observer is the class, not an instance — TypeError on any call that omits it Open
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
ModelEngine-Group/nexent#3921 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ModelEngine-Group/nexent#3818 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ModelEngine-Group/nexent#3817 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
ModelEngine-Group/nexent#3813 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ModelEngine-Group/nexent#3811 ·
All issues in ModelEngine-Group/nexent
Similar issues
-
area/auth bug comp/agent P3 platform/discord type/security
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NousResearch/hermes-agent#117848 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100