wanxingai/LightAgent
Python SDK for OpenAI-compatible agents with tools and recoverable workflows
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
LightAgent is an embeddable Python SDK. Its basic execution path is LightAgent.run(): call an OpenAI-compatible model, dispatch configured tools as needed, and return text, streaming chunks, or an opt-in structured result. The dependency manifest pins httpx==0.28.1 and lists openai>=1.60.0,<2.0.0, jsonschema>=4.20.0, and PyYAML>=6.0.1; the base install includes YAML-backed Skills and local tracing.
The durable runtime is optional. Session and AgentRuntime manage replayable events, checkpoints, jobs, budgets, and context recovery. ExecutionService runs tasks on host-registered backends, and ExecutionHandle provides a way to reconnect. CapabilityRegistry and PolicyEngine govern scoped providers, permission snapshots, and audit, while ToolRegistry and MCP provide tool integration points. MCP supports stdio, SSE, and Streamable HTTP.
Key Capabilities & Differentiators
The model interface targets OpenAI-compatible endpoints, with OpenAI, DeepSeek, and Qwen named as model families. LightSwarm delegates by role. LightFlow executes a predefined dependency graph with step output passing, retries, checkpoints, persisted approvals, and resume or rerun. LightDAG handles workflow structure that emerges at runtime: workers propose candidates or decompositions, but only an application-owned Verifier can approve decomposition or publish immutable artifacts.
The dynamic runtime persists graph changes, task attempts, and recovery events in SQLite, runs independent workers concurrently within configured bounds, and uses leases and fencing to reject stale attempts. At the agent layer, lifecycle hooks, input/tool/output guardrails, and operation-bound approvals provide enforcement points. Optional Mem0 and Langfuse integrations add memory and external tracing, while memory policy lets applications constrain provenance, scope, and write admission.
Trade-offs & Limitations
For simple chat or occasional tool calls, a direct OpenAI SDK integration has fewer abstractions. LightAgent earns its place when an application needs explicit workflow state, recovery, or approvals without taking on a LangChain or LlamaIndex dependency. Recovery is not exactly-once delivery: the documented LightDAG topology is single-host with SQLite and one active scheduler per run. External side effects need idempotency, and ambiguous outcomes need reconciliation before retry.
Treat the safety controls as policy enforcement points, not process isolation. Legacy arbitrary-Python tools are blocked in model and dispatcher calls; application-defined code execution needs its own isolation. SharedMemoryPool is a prototype, not evidence that a production memory backend enforces tenant boundaries. Apache-2.0 permits commercial embedding, but the SDK supplies neither distributed workers nor a production UI, and operators still own backend registration, policy, and operational controls.
Hardware & Deployment Guide
Install the SDK into an application environment with pip install lightagent, or add only the needed integrations, such as lightagent[mcp,mem0]. Extras install Python dependencies; they do not configure credentials or provision external services. For a hosted model path, configure the model, API key, and compatible endpoint. The offline LightDAG example needs no model, key, or network. For durable local operation, put the SQLite database and artifact directory on storage that survives restarts.
The release progression matters for upgrades: v0.10.2 made cancellation execution-scoped with parent-child propagation; v0.11.0 introduced the opt-in persistent dynamic graph; v1.0.0 added reconnectable execution for ordinary tasks. On restart, the application must explicitly bind restored subagents and reconcile uncertain external outcomes before retrying. Existing run() and streaming behavior remain unchanged; legacy mode="persistent" retains its research semantics and requires the separate LightResearch extension.
agent.run() returns text by default, with OpenAI-compatible streaming and an opt-in structured result.mcp extra supports stdio, SSE, and Streamable HTTP transports.ExecutionService runs tasks on host-registered backends, and ExecutionHandle reconnects after restart to inspect state, events, and receipts.SecurityContext, CapabilityGate, and operation-bound ApprovalToken separate identity, permission checks, and approval.MemoryPolicy and MemoryScope govern provenance and admission; SharedMemoryPool is an in-memory prototype.Python teams embedding OpenAI-compatible agents into an existing application and adding MCP tools, approvals, or restart recovery as needed.
You need a turnkey production console, built-in code isolation, or distributed workflow workers—or if direct model calls already cover the job.
Quick Start & Installation
pip install --upgrade "git+https://github.com/wanxingai/LightAgent.git@main"
Comparison vs. Top Agents & Frameworks Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| LightAgent ★ | 1.3k | +1 | Python | Apache-2.0 | Python SDK for OpenAI-compatible agents with tools and recoverable workflows |
| agentscope | 37.2k | +322 | Python | Apache-2.0 | Python ReAct SDK and FastAPI service for observable, interruptible agent workflo |
| rocketride-server | 19.9k | +22 | Python | MIT | C++ workflow engine for building and running extensible AI pipelines |
| browser-use | 122.7k | +477 | Python | MIT | Python REPL and CDP for adaptive browser automation |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/wanxingai/LightAgent.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about LightAgent
How do I choose between LightSwarm, LightFlow, and LightDAG?
Does LightAgent require a GPU, and what determines host resource usage?
Can we embed the SDK in a commercial product and run it on our own infrastructure?
When should we choose LightAgent over a direct OpenAI SDK integration or an existing agent stack?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy