Skip to content

Conversation

@Acture
Copy link

@Acture Acture commented Dec 2, 2025

🚀 Summary

This PR modernizes the project's dependency graph to enable full integration with the LangChain 1.x ecosystem. It addresses critical "dependency hell" issues caused by upstream transitive dependencies (specifically verl and TransferQueue) incompatible with NumPy 2.0+.

Additionally, this PR refactors the internal agent architecture to align with updated LangChain APIs, replacing deprecated usage with modern patterns (LangSmith, LangGraph).


🛠️ Dependency Resolution Strategy

The Problem: Conflicting Requirements

The environment upgrade was blocked by strict version pinning in upstream dependencies:

Component Requirement Status
LangChain 1.x numpy >= 2.0.0 Target
TransferQueue (via verl) numpy < 2.0.0 Conflict

The Solution: Source Overrides & Modernization

Since we cannot wait for upstream releases, I have applied a temporary Source Override strategy to unblock the build.

  1. Upstream Modernization: Forked TransferQueue and verl, migrating their build systems to pyproject.toml (PEP 621).
  2. NumPy 2.0 Compatibility: Relaxed numpy constraints in the TransferQueue fork after verifying API usage.
  3. Conflict Elimination: Removed the problematic sglang optional dependency group from the verl fork.

Implementation Details

The pyproject.toml has been updated to use [tool.uv.sources] pointing to the patched forks:

# Changes in agent-lightning/pyproject.toml
[tool.uv.sources]
transferqueue = { git = "[https://github.com/Acture/TransferQueue.git](https://github.com/Acture/TransferQueue.git)"}
verl = { git = "[https://github.com/Acture/verl.git](https://github.com/Acture/verl.git)"}

Safety Check: analysis confirms TransferQueue uses standard NumPy APIs. It does not rely on C-API structures changed in NumPy 2.0, ensuring ABI compatibility.

⚡ Codebase Modernization (LangChain 1.x)

Apart from dependency fixes, the following architectural changes were made to support LangChain 1.x:

LangSmith Integration: Replaced deprecated langchain hub usage with langsmith.Client.

Agent Construction: Switched from the legacy create_react_agent to the more flexible create_agent pattern; updated prompt handling accordingly, alsoupdated calculator tool usage.

⚠️ Known CI/CD Limitations

Expect the regression test suite to fail.

Since this PR updates core LangChain prompt templates (e.g., switching to langsmith hub patterns), the request signatures have changed. The existing mock server cache is now invalidated, resulting in the following error during integration tests:

ValueError: No suitable cached response found. Please ensure the prompt caches are populated.

Root Cause:
The Mock/Caching layer cannot find a matching response key for the modernized prompt structure.
Resolution:
This is not a code error. To resolve this, the test suite must be run in record mode against a live LLM endpoint to regenerate the cache. (Blocked by missing credentials in the local/current CI environment).

@Acture
Copy link
Author

Acture commented Dec 2, 2025

@Acture please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

@Acture
Copy link
Author

Acture commented Dec 2, 2025

@ultmaster

@ultmaster
Copy link
Contributor

please revert unrelated changes and summarize the core changes needed.

@Acture Acture force-pushed the main branch 2 times, most recently from dedeacf to 0fcb784 Compare December 2, 2025 09:18
@Acture Acture changed the title fix: refactor test_integration.py for compatibility with updated La… build(deps): upgrade to LangChain 1.x and resolve transitive NumPy 2.0+ conflicts Dec 2, 2025
@Acture
Copy link
Author

Acture commented Dec 2, 2025

please revert unrelated changes and summarize the core changes needed.

I have reverted unrelated changes like .gitignore. I've also reverted uv.lock as you requested. Please take a look at the PR description. The summary of core changes are included.

@ultmaster
Copy link
Contributor

/ci

@github-actions
Copy link

github-actions bot commented Dec 3, 2025

🚀 CI Watcher for correlation id-3605122076-mipjz6ty triggered by comment 3605122076
🏃‍♀️ Tracking 1 workflow run(s):

✅ All runs completed.

@ultmaster
Copy link
Contributor

Would you fix the failed tests?

@Acture
Copy link
Author

Acture commented Dec 3, 2025

Would you fix the failed tests?

This was caused by the outdated uv.lock file, , which was reverted previously as you requested. The current lockfile does not incorporate the necessary dependency resolutions (NumPy 2.0 compatibility).
If you wish so, I can update the uv.lock file again (which will result in over 2,000 lines of change in uv.lock that you saw earlier)

- Updated `test_integration.py` to utilize improved LangChain agent capabilities.
- Refactored agent setup to align with LangChain's updated API and prompt handling.

- Upgraded `langchain` and related packages to latest versions with revised constraints.
- Added `langsmith` and new external dependencies such as `verl`.

- Enhanced query prompts to ensure proper syntax and schema validation.
- Adjusted data pipeline to handle NumPy arrays by converting them into lists before processing.
…te` version

- Refactored `uv.lock` resolution markers by reducing redundancy and simplifying platform-based conditions.
- Upgraded `accelerate` package to version 1.12.0.
- Adjusted package groups to enhance compatibility and reduce unnecessary duplication.
{ index = "pytorch-cpu", group = "torch-cpu" },
]
tinker_cookbook = { git = "https://github.com/thinking-machines-lab/tinker-cookbook" }
verl = {git = "https://github.com/Acture/verl.git"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is ireelevant

# run_with_agentops_tracer()
run_with_http_tracer()
# _debug_with_agentops()
# _debug_with_agentops()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is irrelevant

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is altered by pre-commit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it seems that your pre-commit is not properly configured.

Image

"""
You are an agent designed to interact with a SQL database.
Given an input question, create a syntactically correct {dialect} query to run to help find the answer.
Given an input question, create a syntactically correct {dialect} query to run to help find the answer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is altered by pre-commit.

"langchain-openai",
"langchain-community",
"langchain-text-splitters<1.0",
"langchain-text-splitters",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please commit the new uv.lock

@ultmaster
Copy link
Contributor

/ci

@github-actions
Copy link

github-actions bot commented Dec 3, 2025

🚀 CI Watcher for correlation id-3606124420-mipv1cwn triggered by comment 3606124420
🏃‍♀️ Tracking 1 workflow run(s):

✅ All runs completed.

@Acture
Copy link
Author

Acture commented Dec 3, 2025

ValueError: No suitable cached response found. Please ensure the prompt caches are populated.
ERROR: Exception in ASGI application

Failure was caused by the lack of corresponding cache, which really can't be fixed by myself.

@ultmaster
Copy link
Contributor

ultmaster commented Dec 3, 2025

ValueError: No suitable cached response found. Please ensure the prompt caches are populated.
ERROR: Exception in ASGI application

Failure was caused by the lack of corresponding cache, which really can't be fixed by myself.

I think you can fix it. You just need to set the global variable (OPENAI_BASE_URL) in different modes.

But let's pause here. I'll take over the PR and fix the rest of the issues.

@ultmaster ultmaster mentioned this pull request Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants