loong-agent
Agent framework for all — a fully open-source, model-agnostic, pure-code autonomous AI Agent SDK.
Built on the ReAct (Reasoning + Acting) framework and inspired by the design of the Claude Agent SDK, it provides a thought-action-observation loop, a tool system, plugins, MCP, Skills, subagents, hooks, permissions, and tracing.
Features
- Model-agnostic: works with any OpenAI-compatible API (OpenAI, local LLaMA.cpp / Ollama / vLLM, etc.).
- Pure code implementation: all logic is written in Python source, with no dependency on commercial closed-source binaries.
- ReAct loop: an autonomous execution engine of Think → Act → Observe.
- Rich components: built-in tools, hook system, permission policies, MCP gateway, Skills, subagents, plugins, and OpenTelemetry tracing.
Installation
pip install -e .
Quick Start
import asyncio
from loong_agent import LoongAgentOptions, query
from loong_agent.llm import OpenAICompatibleProvider
async def main():
options = LoongAgentOptions(
llm=OpenAICompatibleProvider(
base_url="https://api.openai.com/v1",
api_key="sk-...",
model="gpt-4o-mini",
),
allowed_tools=["Read", "Write", "Bash", "Grep", "Glob"],
)
async for message in query("Review the code in src/", options=options):
if message.type == "assistant":
print(f"Agent: {message.text}")
elif message.type == "result":
print(f"Done! Usage: {message.usage}")
asyncio.run(main())
See examples/ for more examples.
Project Structure
src/loong_agent/
├── client.py # LoongAgentClient / query entry point
├── loop/ # Agent Loop engine (ReAct loop)
├── llm/ # LLM adapter layer (OpenAI-compatible)
├── tools/ # Tool system + built-in tools (Read/Write/Edit/Bash/Grep/Glob)
├── hooks/ # Hook system
├── permissions/ # Permission system
├── mcp/ # MCP gateway (stdio / http / in-process)
├── skills/ # Skills system (SKILL.md)
├── subagents/ # Subagent system
├── plugins/ # Plugin system
├── tracing/ # OpenTelemetry tracing
└── types/ # Core types (Message / Options)
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file loong_agent-0.0.2.tar.gz.
File metadata
- Download URL: loong_agent-0.0.2.tar.gz
- Upload date:
- Size: 28.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7e92d6fd77f8b619575a1ea494d5055b582fda56f96f196f71591e99c655d44
|
|
| MD5 |
3f4aadd41e88708a4ce27ed4d5f8a687
|
|
| BLAKE2b-256 |
095b386e77a13c1d567f0c2b5e925e17c589ecd345e11335133f53bed177c673
|
File details
Details for the file loong_agent-0.0.2-py3-none-any.whl.
File metadata
- Download URL: loong_agent-0.0.2-py3-none-any.whl
- Upload date:
- Size: 48.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2254428ed1cf56f834aea30a68dcf9969fcbee7578bb1b777b19723edd19eaa1
|
|
| MD5 |
b4c227d3791691d5841dfcf47a5109bc
|
|
| BLAKE2b-256 |
a545d039b3d8c7411a2cc3fe8dbbccc66714b3c0f7c257fbdc351837c61de96b
|