Skip to main content

A LangChain-compatible weather tool and agent for CometChat integrations.

Project description

CometChat LangGraph Agent

A LangChain-compatible agent and weather tool designed for seamless integration with CometChat and other chat platforms. This package demonstrates how to build and expose agentic workflows using LangGraph, with real-time streaming and tool execution.

Features

  • Weather tool using OpenWeatherMap
  • LangGraph agent workflow
  • FastAPI server example for NDJSON streaming
  • Designed for easy integration with CometChat’s Agentic Platform

Installation

git clone <this-repo>
cd <this-repo>
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
pip install -r requirements.txt

Environment Variables

Copy .env.example to .env and fill in your API keys:

cp .env.example .env

Edit .env and set:

  • OPENAI_API_KEY
  • OPENWEATHER_API_KEY
  • (Optional) MODEL, PORT, HOST

Usage Example

from cometchat_langgraph_agent.agent import graph
from langchain_core.messages import HumanMessage

result = graph.invoke({
    "messages": [HumanMessage(content="What's the weather in London?")]
})
print(result["messages"][-1].content)

Or run the FastAPI server for CometChat integration:

python examples/server.py

Project Structure

cometchat_langgraph_agent/
    __init__.py
    agent.py
    weather_tool.py
examples/
    server.py
tests/
    unit_tests/
    integration_tests/
.env.example
pyproject.toml
README.md
requirements.txt

Running Tests

pytest

CometChat Integration

This agent is designed to work out-of-the-box with CometChat’s Agentic Platform. The included FastAPI server streams NDJSON responses compatible with CometChat’s real-time chat interface. See examples/server.py for integration details.

Getting Started with CometChat

  1. Create a CometChat account: https://app.cometchat.com/signup
  2. Create a new app in the CometChat dashboard.
  3. Navigate to the Agents section and create a new agent (choose "Custom Agent").
  4. Set the deployment URL to your running FastAPI server endpoint (e.g., https://your-server.com/kickoff).
  5. Test the integration using CometChat’s dashboard or client SDKs.

More Information

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cometchat_langgraph_agent-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cometchat_langgraph_agent-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file cometchat_langgraph_agent-0.1.0.tar.gz.

File metadata

File hashes

Hashes for cometchat_langgraph_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6190391494332ad726c723589c18b9b901a3a76af6b58de40edc2dbdc93c0d2e
MD5 1712ef113f87d42759a329a45b3557f5
BLAKE2b-256 af272f8f279383fe9ccf2fa5a83794e27dc9c8c906e30c557f44a03d7fc1c305

See more details on using hashes here.

File details

Details for the file cometchat_langgraph_agent-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cometchat_langgraph_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 609ebc948ea734e5bafe0cc5bbb96fbcd05f4d523be13e23dcd9ea65f4aac006
MD5 0812bfd5b942bbea3587a12eef5e8070
BLAKE2b-256 16cbdc16124255c8e181af3670213b521decfa697b36958e3a585908296dbb6d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page