Hands-on Agentic AI App: LangGraph 1.0
What is Agentic AI App?
With LangGraph 1.0 now stable, building them is straightforward.
Let's build a 'Weather Poet' agent app that:
- Runs as a web service, accessible via UI and API..
- Uses a web search tool to find a forecast.
- Write a poem about it.
1. Create the Project
First, install the LangGraph CLI from the official documentation: https://docs.langchain.com/langsmith/cli#installation
Then, generate a new project from the default template.
$ langgraph new weather-poet-app
๐ Please select a template:
1. New LangGraph Project - A simple, minimal chatbot with memory.
...
Enter the number of your template choice (default is 1): 1
You selected: New LangGraph Project - A simple, minimal chatbot with memory.
Choose language (1 for Python ๐, 2 for JS/TS ๐): 1
๐ New project created at ...
2. Update Dependencies
Navigate to the project directory and edit pyproject.toml to include the necessary libraries.
Set the dependencies as follows:
dependencies = [
"langgraph>=1.0.0",
"python-dotenv>=1.0.1",
"langchain>=1.0.0",
"langchain-google-genai>=3.0.0",
"langchain-tavily>=0.2.12",
"tavily-python>=0.7.12"
]
[project.optional-dependencies]
dev = [
"mypy>=1.13.0",
"ruff>=0.8.2",
"anyio>=4.7.0",
"langgraph-cli[inmem]>=0.2.8",
"pytest>=8.3.5",
]
3. Define the Agent
Modify src/agent/graph.py to define the agent.
The best part? It's literally the same code from the previous LangChain 1.0 post.
LangGraph is designed to productionize your existing LangChain agents seamlessly.
$ nano src/agent/graph.pyfrom langchain.agents import create_agent
from langchain_tavily import TavilySearch
graph = create_agent(
model="google_genai:gemini-2.5-flash",
tools=[TavilySearch(max_results=5)]
)
4. Configure Environment
Create a .env file in the root directory for your API keys.
Similarly to previous section, just copy the values from the previous LangChain 1.0 post.
$ nano .env
LANGSMITH_PROJECT=new-agent
GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"
TAVILY_API_KEY="YOUR_TAVILY_API_KEY"
5. Run the Development Server
Set up a virtual environment, install the packages, and start the app.
$ python3 -m venv venv
$ source ./venv/bin/activate
$ pip install -e '.[dev]'
$ langgraph dev --allow-blocking
6. Test with the LangSmith UI
Automatically it will open the local URL provided by the langgraph dev command.
You'll be prompted to log in and then you can interact with the agent.
The process is quite visual, so here is a short screen recording of the login and first interaction:
After logging in, test the agent with an example prompt:
Example prompt:
Search for tomorrow's weather in Tel-Aviv and write a short poem about it.
7. Test with the API
You can also interact with the agent programmatically. First, get the assistant_id.
$ curl http://127.0.0.1:2024/assistants/search \
--request POST \
--header 'Content-Type: application/json' \
--data '{"select": ["assistant_id"]}'
Example output:
[{"assistant_id":"fe096781-5601-53d2-b2f6-0d4503f7e9ca"}]Use assistant_id to send a request and parse the response.
$ curl http://127.0.0.1:2024/runs/wait \
--request POST \
--header 'Content-Type: application/json' \
--data '{
"assistant_id": "fe096781-5601-53d2-b2f6-0d4503f7e9ca",
"input": {
"messages": [
{
"content": "Search for tomorrow'\''s weather in Tel-Aviv and write a short poem about it.",
"type": "human"
}
]
}
}' | grep '"type":"text","text":' | sed 's/^data: //' | jq -r '.messages[-1].content[0].text' Example output:
Dload Upload Total Spent Left Speed
100 4878 0 4639 100 239 782 40 0:00:05 0:00:05 --:--:-- 942
No rain in sight, just clear blue sky.
Warm breezes blow, a gentle sway,
As temperatures in comfort lie.
Conclusion
The ability to take existing agent code and seamlessly wrap it in a web service, complete with a UI and an API, makes it a powerful framework for building practical AI applications.
