<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: eugen hoble</title>
    <description>The latest articles on DEV Community by eugen hoble (@eugen_hoble_868a7a61ca45c).</description>
    <link>https://dev.to/eugen_hoble_868a7a61ca45c</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3643895%2Fc4c767b8-613d-4008-b56b-b555a5da8e71.png</url>
      <title>DEV Community: eugen hoble</title>
      <link>https://dev.to/eugen_hoble_868a7a61ca45c</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/eugen_hoble_868a7a61ca45c"/>
    <language>en</language>
    <item>
      <title>Building a Simple AI Agent with Python, LangChain, OpenAI, VS Code, and WSL</title>
      <dc:creator>eugen hoble</dc:creator>
      <pubDate>Sat, 25 Apr 2026 17:25:38 +0000</pubDate>
      <link>https://dev.to/eugen_hoble_868a7a61ca45c/building-a-simple-ai-agent-with-python-langchain-openai-vs-code-and-wsl-2cmg</link>
      <guid>https://dev.to/eugen_hoble_868a7a61ca45c/building-a-simple-ai-agent-with-python-langchain-openai-vs-code-and-wsl-2cmg</guid>
      <description>&lt;p&gt;AI agents can sound complicated.&lt;/p&gt;

&lt;p&gt;But at the basic level, an agent is just a software system that can:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Receive a user request&lt;/li&gt;
&lt;li&gt;Decide whether it needs a tool&lt;/li&gt;
&lt;li&gt;Call that tool&lt;/li&gt;
&lt;li&gt;Use the result to produce a better answer&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That is the core idea behind this project.&lt;/p&gt;

&lt;p&gt;I built a simple local AI agent using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;LangChain&lt;/li&gt;
&lt;li&gt;OpenAI&lt;/li&gt;
&lt;li&gt;VS Code&lt;/li&gt;
&lt;li&gt;WSL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal was not to build a production-grade agent immediately.&lt;/p&gt;

&lt;p&gt;The goal was to understand the foundation: how an LLM can use tools inside a real Python application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What this project does&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This project is a command-line AI agent.&lt;/p&gt;

&lt;p&gt;You run it locally, ask a question, and the agent decides whether it should call one of the available tools.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You: If my server costs 0.42 dollars per hour and runs all month, what is the monthly cost?&lt;/p&gt;

&lt;p&gt;Agent: Monthly cost = $0.42/hr × 24 hrs/day × 30 days = $302.40.&lt;/p&gt;

&lt;p&gt;The agent can also answer questions like:&lt;/p&gt;

&lt;p&gt;What is the risk of deploying a database schema change on Friday afternoon?&lt;/p&gt;

&lt;p&gt;For that, it can call a custom deployment-risk tool.&lt;/p&gt;

&lt;p&gt;The point is simple:&lt;/p&gt;

&lt;p&gt;A chatbot only responds.&lt;/p&gt;

&lt;p&gt;An agent can use tools.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project structure&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The project uses a standard Python src layout:&lt;/p&gt;

&lt;p&gt;simple-ai-agent/&lt;br&gt;
├── .vscode/&lt;br&gt;
│   ├── extensions.json&lt;br&gt;
│   ├── launch.json&lt;br&gt;
│   └── settings.json&lt;br&gt;
├── docs/&lt;br&gt;
│   ├── ARCHITECTURE.md&lt;br&gt;
│   └── ai_agent_system_architecture_overview.png&lt;br&gt;
├── scripts/&lt;br&gt;
│   ├── run.sh&lt;br&gt;
│   └── setup_wsl.sh&lt;br&gt;
├── src/&lt;br&gt;
│   └── agent_app/&lt;br&gt;
│       ├── &lt;strong&gt;init&lt;/strong&gt;.py&lt;br&gt;
│       ├── agent.py&lt;br&gt;
│       ├── config.py&lt;br&gt;
│       ├── main.py&lt;br&gt;
│       └── tools.py&lt;br&gt;
├── tests/&lt;br&gt;
│   └── test_tools.py&lt;br&gt;
├── .env.example&lt;br&gt;
├── .gitignore&lt;br&gt;
├── pyproject.toml&lt;br&gt;
├── requirements.txt&lt;br&gt;
└── README.md&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why I used WSL and VS Code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I work on Windows, but I prefer using WSL for Python projects.&lt;/p&gt;

&lt;p&gt;That gives me a Linux-like development environment while still using VS Code as the editor.&lt;/p&gt;

&lt;p&gt;The project files are stored inside WSL:&lt;br&gt;
~/workspace/langchain-vscode-agent-wsl&lt;/p&gt;

&lt;p&gt;Then I open the project with:&lt;br&gt;
.code&lt;/p&gt;

&lt;p&gt;This makes VS Code connect to the WSL environment directly.&lt;/p&gt;

&lt;p&gt;That is important because Python, the virtual environment, and the dependencies all live inside WSL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting up the project&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&amp;lt;/&amp;gt; Bash
python3 &lt;span class="nt"&gt;-m&lt;/span&gt; venv .venv
&lt;span class="nb"&gt;source&lt;/span&gt; .venv/bin/activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then install the dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&amp;lt;/&amp;gt; Bash
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--upgrade&lt;/span&gt; pip
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because the project uses the src layout, install it in editable mode:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&amp;lt;/&amp;gt; Bash
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells Python where the package lives.&lt;/p&gt;

&lt;p&gt;Without this step, running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&amp;lt;/&amp;gt; Bash
python &lt;span class="nt"&gt;-m&lt;/span&gt; agent_app.main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;may fail with:  ModuleNotFoundError: No module named 'agent_app'&lt;/p&gt;

&lt;p&gt;Editable install fixes that while still letting me edit the source files normally.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Environment variables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The project uses a local .env file.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight properties"&gt;&lt;code&gt;&lt;span class="py"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;your_api_key_here&lt;/span&gt;
&lt;span class="py"&gt;OPENAI_MODEL&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;gpt-5.4-nano&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The agent tools&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The project includes simple tools in tools.py.&lt;/p&gt;

&lt;p&gt;One tool calculates monthly cloud cost:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.tools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;


&lt;span class="nd"&gt;@tool&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;calculate_monthly_cloud_cost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;hourly_cost&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;hours_per_day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    Calculate estimated monthly cloud cost.

    Args:
        hourly_cost: Cost per hour in dollars.
        hours_per_day: Number of hours used per day.
        days: Number of days in the month.

    Returns:
        Estimated monthly cost.
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;hourly_cost&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;hours_per_day&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;days&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another tool gives a simple deployment-risk assessment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.tools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;


&lt;span class="nd"&gt;@tool&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;check_deployment_risk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;change_type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    Give a simple deployment risk assessment based on the type of change.
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;change_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;change_type&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;database&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;change_type&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;schema&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;change_type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;High risk. Use migration scripts, backups, rollback plan, &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;and test in staging first.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ui&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;change_type&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;frontend&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;change_type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Medium risk. Use feature flags, browser testing, &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;and monitor user errors.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;config&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;change_type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Medium to high risk. Validate config, use version control, &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;and prepare rollback.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Low to medium risk. Use automated tests, peer review, &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;and deployment monitoring.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are intentionally simple.&lt;/p&gt;

&lt;p&gt;The purpose is to show the agent pattern, not to build a full cloud-cost platform or deployment-governance system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating the agent&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The agent is created with LangChain and an OpenAI chat model.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.agents&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;create_agent&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain_openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ChatOpenAI&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agent_app.config&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;get_settings&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agent_app.tools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;calculate_monthly_cloud_cost&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;check_deployment_risk&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;build_agent&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;settings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_settings&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ChatOpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;openai_model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;create_agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="n"&gt;calculate_monthly_cloud_cost&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;check_deployment_risk&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="n"&gt;system_prompt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
        You are a practical software engineering assistant.
        Use tools only when they are useful.
        Explain answers clearly and concisely.
        Do not invent tool results.
        &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important part is this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="n"&gt;calculate_monthly_cloud_cost&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;check_deployment_risk&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is what gives the model controlled access to actions.&lt;/p&gt;

&lt;p&gt;The LLM does not directly execute arbitrary code.&lt;/p&gt;

&lt;p&gt;It can only use the tools we expose.&lt;/p&gt;

&lt;p&gt;That boundary matters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Running the app&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The app can be run with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-m&lt;/span&gt; agent_app.main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example session:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Simple LangChain Agent
Type 'exit' or 'quit' to stop.

You: If my server costs 0.42 dollars per hour and runs all month, what is the monthly cost?

Agent: Monthly cost = $0.42/hr × 24 hrs/day × 30 days = $302.40.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why this is an agent, not just a chatbot?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A normal chatbot receives text and returns text.&lt;/p&gt;

&lt;p&gt;This project adds another layer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User request
    ↓
Agent reasoning
    ↓
Tool selection
    ↓
Tool execution
    ↓
Final answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That tool-use step is what makes the pattern interesting.&lt;/p&gt;

&lt;p&gt;The model is not only generating language.&lt;/p&gt;

&lt;p&gt;It is deciding whether to call a function.&lt;/p&gt;

&lt;p&gt;In a real system, those tools could be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;database queries&lt;/li&gt;
&lt;li&gt;internal APIs&lt;/li&gt;
&lt;li&gt;document search&lt;/li&gt;
&lt;li&gt;ticket creation&lt;/li&gt;
&lt;li&gt;email drafts&lt;/li&gt;
&lt;li&gt;deployment checks&lt;/li&gt;
&lt;li&gt;monitoring lookups&lt;/li&gt;
&lt;li&gt;report generation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The system architecture&lt;/strong&gt;&lt;br&gt;
A production-ready agent would need more than this demo.&lt;/p&gt;

&lt;p&gt;A more complete architecture would usually include these layers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. User &amp;amp; Channel Layer
   Web app, Slack, Teams, CLI, REST API

2. API / Application Layer
   FastAPI, authentication, rate limits, session management

3. Agent Orchestration Layer
   LangChain, LangGraph, planner, tool router, state machine

4. LLM Layer
   OpenAI, Anthropic, Azure OpenAI, local models

5. Tool &amp;amp; Action Layer
   Python functions, external APIs, SQL databases, email, web search

6. Retrieval &amp;amp; Knowledge Layer
   Embeddings, vector database, document store, knowledge base

7. Memory &amp;amp; State Layer
   Short-term memory, long-term memory, Redis, Postgres, checkpointing

8. Infrastructure &amp;amp; Operations Layer
   Containers, queues, secrets, CI/CD, cloud hosting, monitoring
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two concerns apply across all layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Security &amp;amp; Guardrails&lt;/li&gt;
&lt;li&gt;Observability &amp;amp; Evaluation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What I learned&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The biggest lesson from this project is that a simple agent is not hard to build.&lt;/p&gt;

&lt;p&gt;The harder part is designing the system around it.&lt;/p&gt;

&lt;p&gt;The agent itself may be only a few files.&lt;/p&gt;

&lt;p&gt;But once you think about production, you need to care about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;tool boundaries&lt;/li&gt;
&lt;li&gt;authentication&lt;/li&gt;
&lt;li&gt;cost control&lt;/li&gt;
&lt;li&gt;logging&lt;/li&gt;
&lt;li&gt;error handling&lt;/li&gt;
&lt;li&gt;state&lt;/li&gt;
&lt;li&gt;testing&lt;/li&gt;
&lt;li&gt;security&lt;/li&gt;
&lt;li&gt;observability&lt;/li&gt;
&lt;li&gt;deployment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GitHub repository&lt;/p&gt;

&lt;p&gt;You can find the project &lt;a href="https://github.com/eumaho/simple-ai-agent" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>ai</category>
      <category>langchain</category>
      <category>vscode</category>
    </item>
  </channel>
</rss>
