langgraph-lite-cron


Namelanggraph-lite-cron JSON
Version 0.0.1 PyPI version JSON
download
home_pageNone
Summarylanggraph lite cron
upload_time2025-08-10 08:44:42
maintainerNone
docs_urlNone
authorykoh42
requires_python>=3.9
licenseMIT
keywords agent ambient cron langgraph scheduler
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ⏰ LangGraph Lite Cron

- A free, self-hosted alternative to LangGraph Platform's Cron Jobs with the same API interface (compatible with [
  `langgraph-sdk`](https://pypi.org/project/langgraph-sdk/)).
- Designed for use with [ambient agents](https://blog.langchain.com/introducing-ambient-agents/) to enable scheduled and
  recurring tasks.

**Requirements:** Python 3.9+, PostgreSQL, Redis

> ⚠️ **Warning: Early development. Not for production use.**

## ⚡ Quick Start

### 1. Install

```sh
pip install langgraph-lite-cron
```

### 2. Add Custom Routes

Add cron routes to your FastAPI app (e.g., `./src/agent/webapp.py`):

```python
from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager

from fastapi import FastAPI

from langgraph_lite_cron import crons
from langgraph_lite_cron.scheduler import create_scheduler


@asynccontextmanager
async def lifespan(app: FastAPI) -> AsyncGenerator[None]:
    async with create_scheduler() as scheduler:
        await scheduler.start_in_background()
        app.state.scheduler = scheduler

        yield

        await scheduler.stop()
        await scheduler.wait_until_stopped()


app = FastAPI(lifespan=lifespan)
app.include_router(crons.router)
```

### 3. Configure langgraph.json

Update your `langgraph.json` to include the custom app:

```json
{
    "dependencies": [
        "."
    ],
    "graphs": {
        "agent": "./src/react_agent/graph.py:graph"
    },
    "env": ".env",
    "image_distro": "wolfi",
    "http": {
        "app": "./src/agent/webapp.py:app"
    }
}
```

### 4. Deploy

Deploy using [Self-hosted Standalone Server](https://docs.langchain.com/langgraph-platform/deploy-standalone-server) with
Kubernetes, Docker and Docker Compose.

### 5. Use Cron API

```python
from langgraph_sdk import get_client

client = get_client(url="http://localhost:8123")

# Create thread
thread = await client.threads.create()

# Schedule job for thread (stateful)
cron_job = await client.crons.create_for_thread(
    thread["thread_id"],
    "agent",
    schedule="27 15 * * *",
    input={"messages": [{"role": "user", "content": "What time is it?"}]},
)

# Schedule job without thread (stateless)
cron_job_stateless = await client.crons.create(
    "agent",
    schedule="0 9 * * *",
    input={"messages": [{"role": "user", "content": "Good morning!"}]},
)

# List all cron jobs
crons = await client.crons.search(assistant_id="agent")

# Delete a specific job
await client.crons.delete(cron_job["cron_id"])

# Delete all jobs
for cron in crons:
    await client.crons.delete(cron["cron_id"])
```

## ⏱️ Cron Format

Standard cron format: `minute hour day month weekday`

- `0 9 * * *` - 9:00 AM daily
- `30 14 * * 1` - 2:30 PM every Monday
- `0 */4 * * *` - Every 4 hours

## 💡 Example Use Cases

- [executive-ai-assistant](https://github.com/langchain-ai/executive-ai-assistant) – An AI agent acting as an Executive
  Assistant
- [social-media-agent](https://github.com/langchain-ai/social-media-agent) – Generates Twitter and LinkedIn posts from a
  given URL with human-in-the-loop approval
- [agents-from-scratch](https://github.com/langchain-ai/agents-from-scratch) – Step-by-step tutorial for building an
  email agent with Gmail API, HITL, and memory
- [ff-take-bot](https://github.com/langchain-ai/ff-take-bot) – A “Take Bot” agent that runs in the background to keep a
  fantasy football league active
- [ambient-agent-101](https://github.com/langchain-ai/ambient-agent-101) – Learn LangGraph basics by building an ambient
  agent that manages Gmail
- [reddit-radar](https://github.com/langchain-ai/reddit-radar) – AI agent for detecting or analyzing Reddit posts
- [daily-brew](https://github.com/langchain-ai/daily-brew) – Automates publishing daily reflection content to a Slack
  channel

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "langgraph-lite-cron",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "agent, ambient, cron, langgraph, scheduler",
    "author": "ykoh42",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/94/ca/58abd11795f882ade64de1ffd447c9683e59d852d9f7b7d7bd5f93ab4ea5/langgraph_lite_cron-0.0.1.tar.gz",
    "platform": null,
    "description": "# \u23f0 LangGraph Lite Cron\n\n- A free, self-hosted alternative to LangGraph Platform's Cron Jobs with the same API interface (compatible with [\n  `langgraph-sdk`](https://pypi.org/project/langgraph-sdk/)).\n- Designed for use with [ambient agents](https://blog.langchain.com/introducing-ambient-agents/) to enable scheduled and\n  recurring tasks.\n\n**Requirements:** Python 3.9+, PostgreSQL, Redis\n\n> \u26a0\ufe0f **Warning: Early development. Not for production use.**\n\n## \u26a1 Quick Start\n\n### 1. Install\n\n```sh\npip install langgraph-lite-cron\n```\n\n### 2. Add Custom Routes\n\nAdd cron routes to your FastAPI app (e.g., `./src/agent/webapp.py`):\n\n```python\nfrom collections.abc import AsyncGenerator\nfrom contextlib import asynccontextmanager\n\nfrom fastapi import FastAPI\n\nfrom langgraph_lite_cron import crons\nfrom langgraph_lite_cron.scheduler import create_scheduler\n\n\n@asynccontextmanager\nasync def lifespan(app: FastAPI) -> AsyncGenerator[None]:\n    async with create_scheduler() as scheduler:\n        await scheduler.start_in_background()\n        app.state.scheduler = scheduler\n\n        yield\n\n        await scheduler.stop()\n        await scheduler.wait_until_stopped()\n\n\napp = FastAPI(lifespan=lifespan)\napp.include_router(crons.router)\n```\n\n### 3. Configure langgraph.json\n\nUpdate your `langgraph.json` to include the custom app:\n\n```json\n{\n    \"dependencies\": [\n        \".\"\n    ],\n    \"graphs\": {\n        \"agent\": \"./src/react_agent/graph.py:graph\"\n    },\n    \"env\": \".env\",\n    \"image_distro\": \"wolfi\",\n    \"http\": {\n        \"app\": \"./src/agent/webapp.py:app\"\n    }\n}\n```\n\n### 4. Deploy\n\nDeploy using [Self-hosted Standalone Server](https://docs.langchain.com/langgraph-platform/deploy-standalone-server) with\nKubernetes, Docker and Docker Compose.\n\n### 5. Use Cron API\n\n```python\nfrom langgraph_sdk import get_client\n\nclient = get_client(url=\"http://localhost:8123\")\n\n# Create thread\nthread = await client.threads.create()\n\n# Schedule job for thread (stateful)\ncron_job = await client.crons.create_for_thread(\n    thread[\"thread_id\"],\n    \"agent\",\n    schedule=\"27 15 * * *\",\n    input={\"messages\": [{\"role\": \"user\", \"content\": \"What time is it?\"}]},\n)\n\n# Schedule job without thread (stateless)\ncron_job_stateless = await client.crons.create(\n    \"agent\",\n    schedule=\"0 9 * * *\",\n    input={\"messages\": [{\"role\": \"user\", \"content\": \"Good morning!\"}]},\n)\n\n# List all cron jobs\ncrons = await client.crons.search(assistant_id=\"agent\")\n\n# Delete a specific job\nawait client.crons.delete(cron_job[\"cron_id\"])\n\n# Delete all jobs\nfor cron in crons:\n    await client.crons.delete(cron[\"cron_id\"])\n```\n\n## \u23f1\ufe0f Cron Format\n\nStandard cron format: `minute hour day month weekday`\n\n- `0 9 * * *` - 9:00 AM daily\n- `30 14 * * 1` - 2:30 PM every Monday\n- `0 */4 * * *` - Every 4 hours\n\n## \ud83d\udca1 Example Use Cases\n\n- [executive-ai-assistant](https://github.com/langchain-ai/executive-ai-assistant) \u2013 An AI agent acting as an Executive\n  Assistant\n- [social-media-agent](https://github.com/langchain-ai/social-media-agent) \u2013 Generates Twitter and LinkedIn posts from a\n  given URL with human-in-the-loop approval\n- [agents-from-scratch](https://github.com/langchain-ai/agents-from-scratch) \u2013 Step-by-step tutorial for building an\n  email agent with Gmail API, HITL, and memory\n- [ff-take-bot](https://github.com/langchain-ai/ff-take-bot) \u2013 A \u201cTake Bot\u201d agent that runs in the background to keep a\n  fantasy football league active\n- [ambient-agent-101](https://github.com/langchain-ai/ambient-agent-101) \u2013 Learn LangGraph basics by building an ambient\n  agent that manages Gmail\n- [reddit-radar](https://github.com/langchain-ai/reddit-radar) \u2013 AI agent for detecting or analyzing Reddit posts\n- [daily-brew](https://github.com/langchain-ai/daily-brew) \u2013 Automates publishing daily reflection content to a Slack\n  channel\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "langgraph lite cron",
    "version": "0.0.1",
    "project_urls": {
        "Issues": "https://github.com/ykoh42/langgraph-lite-cron/issues",
        "Repository": "https://github.com/ykoh42/langgraph-lite-cron"
    },
    "split_keywords": [
        "agent",
        " ambient",
        " cron",
        " langgraph",
        " scheduler"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c9acf8456c025c7f9fb599514c2831543a1605d6821405883084e721729f1416",
                "md5": "8aa9f1691d486f4e4f3b154d1494727a",
                "sha256": "17bd26b66e25c8263ce2c25ecdb018d82ce6867518b9e53fa6f8f078f2f14072"
            },
            "downloads": -1,
            "filename": "langgraph_lite_cron-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8aa9f1691d486f4e4f3b154d1494727a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 10398,
            "upload_time": "2025-08-10T08:44:40",
            "upload_time_iso_8601": "2025-08-10T08:44:40.950742Z",
            "url": "https://files.pythonhosted.org/packages/c9/ac/f8456c025c7f9fb599514c2831543a1605d6821405883084e721729f1416/langgraph_lite_cron-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "94ca58abd11795f882ade64de1ffd447c9683e59d852d9f7b7d7bd5f93ab4ea5",
                "md5": "045d43fc103f8948cc7a29a634841caa",
                "sha256": "1dbfa5580d7c844fd19149d57d359ed7ac44ed0aa0cbb0203ae9de188bafbba1"
            },
            "downloads": -1,
            "filename": "langgraph_lite_cron-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "045d43fc103f8948cc7a29a634841caa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 64728,
            "upload_time": "2025-08-10T08:44:42",
            "upload_time_iso_8601": "2025-08-10T08:44:42.200700Z",
            "url": "https://files.pythonhosted.org/packages/94/ca/58abd11795f882ade64de1ffd447c9683e59d852d9f7b7d7bd5f93ab4ea5/langgraph_lite_cron-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-10 08:44:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ykoh42",
    "github_project": "langgraph-lite-cron",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "langgraph-lite-cron"
}
        
Elapsed time: 2.90506s