Skip to main content

⏰ LangGraph Lite Cron

  • A free, self-hosted alternative to LangGraph Platform's Cron Jobs with the same API interface (compatible with langgraph-sdk).
  • Designed for use with 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

pip install langgraph-lite-cron

Or, if you are using uv (including pre-release versions):

uv add --prerelease allow langgraph-lite-cron

2. Add Custom Routes

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

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:

{
    "dependencies": [
        "."
    ],
    "graphs": {
        "agent": "./src/react_agent/graph.py:graph"
    },
    "env": ".env",
    "image_distro": "wolfi",
    "http": {
        "app": "./src/agent/webapp.py:app"
    },
    "dockerfile_lines": [
        "ENV UV_PRERELEASE=allow"
    ]
}

4. Deploy

Option 1: In-memory mode (development)

langgraph dev

Option 2: Postgres + Redis mode (development)

langgraph up

Option 3: Self-hosted Standalone Server

5. Use Cron API

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 – An AI agent acting as an Executive Assistant
  • social-media-agent – Generates Twitter and LinkedIn posts from a given URL with human-in-the-loop approval
  • agents-from-scratch – Step-by-step tutorial for building an email agent with Gmail API, HITL, and memory
  • ff-take-bot – A “Take Bot” agent that runs in the background to keep a fantasy football league active
  • ambient-agent-101 – Learn LangGraph basics by building an ambient agent that manages Gmail
  • reddit-radar – AI agent for detecting or analyzing Reddit posts
  • daily-brew – Automates publishing daily reflection content to a Slack channel

Metadata

Release files for langgraph-lite-cron 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langgraph-lite-cron 0.0.3
File Size Uploaded
langgraph_lite_cron-0.0.3.tar.gz 66.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langgraph-lite-cron 0.0.3
File Interpreter ABI Platform
langgraph_lite_cron-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 78.7 kB

Release files / langgraph_lite_cron-0.0.3.tar.gz

Download URL langgraph_lite_cron-0.0.3.tar.gz
Size 66.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9ef277edc1980e336e60b4ca411053019986a77445cc18783442245350d95d66
BLAKE2b-256 checksum
How to use checksums
288ef51f1983a1569859db335148797c74a5c9577bb2844adbd69bd4eea38626
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / langgraph_lite_cron-0.0.3-py3-none-any.whl

Download URL langgraph_lite_cron-0.0.3-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
13717023f292293a7fccf0e8ad8bd962bccc503521068761e94e690d67ffd878
BLAKE2b-256 checksum
How to use checksums
3ba60d2433ef7d8bcc1abedabd591b3aaf89cb19b12f4c4b7b06346a45efbbe8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page