Skip to content

wip: existing create_react_agent with only v1 support #32464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

sydney-runkle
Copy link
Collaborator

@sydney-runkle sydney-runkle commented Aug 8, 2025

Using langchain-openai==0.4.0.dev0 langchain-core==0.4.0.dev0

from libs.langchain_v1.langchain.agents.base_v1 import create_react_agent
from langchain_openai.v1 import ChatOpenAI

def get_weather(city: str) -> str:
    """Get weather for a given city."""
    return f"It's always sunny in {city}!"

agent = create_react_agent(
    model=ChatOpenAI(model="gpt-4o-mini"),
    tools=[get_weather],
    prompt="You are a helpful assistant",
)

# Run the agent
result = agent.invoke(
    {"messages": [{'role': 'user', 'content': 'what is the weather in sf?'}]}
)
print(result)

Noticeable change:

  • v1 doesn't have support for RemoveMessage so I've removed that logic from the reducer. We should figure out the right pattern here.

This is working ok in studio.

Screenshot 2025-08-08 at 9 16 06 AM

Copy link

vercel bot commented Aug 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Aug 8, 2025 1:07pm

Copy link

codspeed-hq bot commented Aug 8, 2025

CodSpeed WallTime Performance Report

Merging #32464 will not alter performance

Comparing sr/v1-mvp (b98158f) with master (0200121)

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

Summary

✅ 13 untouched benchmarks

Copy link

codspeed-hq bot commented Aug 8, 2025

CodSpeed Instrumentation Performance Report

Merging #32464 will not alter performance

Comparing sr/v1-mvp (b98158f) with master (0200121)

Summary

✅ 14 untouched benchmarks

@mdrxy mdrxy added the langchain Related to the package `langchain` label Aug 8, 2025
@mdrxy mdrxy added this to the v1 milestone Aug 8, 2025
@sydney-runkle
Copy link
Collaborator Author

We are no longer using these messages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
langchain Related to the package `langchain`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants