langchain - ✅(Solved) Fix Add beginner-friendly agent example using tools [2 pull requests, 1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langchain-ai/langchain#36652Fetched 2026-04-11 06:12:22
View on GitHub
Comments
1
Participants
1
Timeline
7
Reactions
0
Participants
Timeline (top)
labeled ×3cross-referenced ×2commented ×1issue_type_added ×1

Fix Action

Fixed

PR fix notes

PR #36651: Added beginner-friendly tool-based agent example

Description (problem / solution / changelog)

Added a simple and beginner-friendly example demonstrating how to use tools with agents.

This helps new users understand how to integrate custom tools with LangChain agents.

Changed files

  • examples/simple_tool_agent.py (added, +28/-0)

PR #36654: Added beginner-friendly tool-based agent example

Description (problem / solution / changelog)

Added a simple and beginner-friendly example demonstrating how to use tools with agents. Closes #36652

Changed files

  • examples/simple_tool_agent.py (added, +28/-0)
RAW_BUFFERClick to expand / collapse

Checked other resources

  • This is a feature request, not a bug report or usage question.
  • I added a clear and descriptive title that summarizes the feature request.
  • I used the GitHub search to find a similar feature request and didn't find it.
  • I checked the LangChain documentation and API reference to see if this feature already exists.
  • This is not related to the langchain-community package.

Package (Required)

  • langchain
  • langchain-openai
  • langchain-anthropic
  • langchain-classic
  • langchain-core
  • langchain-model-profiles
  • langchain-tests
  • langchain-text-splitters
  • langchain-chroma
  • langchain-deepseek
  • langchain-exa
  • langchain-fireworks
  • langchain-groq
  • langchain-huggingface
  • langchain-mistralai
  • langchain-nomic
  • langchain-ollama
  • langchain-openrouter
  • langchain-perplexity
  • langchain-qdrant
  • langchain-xai
  • Other / not sure / general

Feature Description

I would like to add a simple and beginner-friendly example demonstrating how to use tools with LangChain agents. The goal is to provide a minimal working example that is easy to understand and run for new users.

Use Case

Beginners often struggle to understand how to use tools with agents in LangChain. A simple working example will help them quickly get started.

Proposed Solution

Add a Python example demonstrating a simple agent using a custom tool (calculator).

The example will:

  • Show how to define a tool
  • Initialize an agent
  • Execute a query using the tool

The code will be beginner-friendly with clear comments and easy-to-run structure.

Alternatives Considered

Users can refer to existing documentation, but it may be complex for beginners. A simplified example would make learning easier.

Additional Context

I have already implemented a working example and would like to contribute it to the repository.

extent analysis

TL;DR

Contribute a Python example demonstrating a simple LangChain agent using a custom tool to the repository.

Guidance

  • Review the LangChain documentation and API reference to ensure the example aligns with existing guidelines and best practices.
  • Verify that the example is beginner-friendly, with clear comments and an easy-to-run structure, by testing it with new users or seeking feedback from the community.
  • Consider adding the example to the LangChain repository under a relevant section, such as "Getting Started" or "Tutorials", to make it easily accessible to new users.
  • Ensure the example includes steps to define a tool, initialize an agent, and execute a query using the tool, as proposed in the feature description.

Example

# Define a custom tool (calculator)
class CalculatorTool:
    def calculate(self, query):
        # Simple calculation example
        if "+" in query:
            num1, num2 = query.split("+")
            return int(num1) + int(num2)
        # Add more calculation logic as needed

# Initialize an agent
agent = Agent()

# Execute a query using the tool
query = "2+2"
result = agent.execute(query, tool=CalculatorTool())
print(result)  # Output: 4

Notes

The example code provided is a simplified illustration and may need to be adapted to fit the specific requirements of the LangChain repository and the proposed feature.

Recommendation

Apply workaround by contributing the proposed Python example to the repository, as it provides a clear and beginner-friendly demonstration of using tools with LangChain agents.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING