Linglong Agent Service: A Runtime for Centralized Agent Reasoning and Distributed Execution
Organizations: Independent Researcher · Jiangnan University
Abstract
LLM agents can use remote tools and cloud sandboxes, but integrating reasoning, session state, and heterogeneous execution sites remains a runtime design problem. We present Linglong Agent Service (agentsvc), a self-hosted HTTP service and embeddable Python runtime that treats execution site as a configurable dimension alongside model, tools, and context. A parent service retains inference orchestration, tool descriptions, and conversation history; each inference request selects one child environment for file, shell, terminal, and MCP operations. Direct HTTP and child-initiated WebSocket tunnels carry the same application interfaces, including portable request context and centrally managed updates. The normal core path requires no third-party Python packages, with an optional Windows pseudo-terminal dependency. We further present online_debugger as the process-scale special case of execution-site separation: an instrumented program submits exception evidence, executes session-scoped inspection tools inside the incident process, and resumes the same diagnostic session. Its default prompt requires failing-then-passing reproduction evidence for source changes, while runtime patch activation and failed-call recovery remain unimplemented. We explain the design through constrained expected-utility reasoning, compare concrete mechanisms with Hermes Agent, Pi, Codex, and Claude Code, and report implementation and regression-test evidence. The current evidence establishes executable contracts, not performance advantages, repair accuracy, or production recovery. The source code is open source under the MIT license at https://github.com/mz24cn/agents.
Figures & tables
| Constraint and assumption | Choice and expected benefit | Cost and reconsideration condition |
|---|---|---|
| Package installation can be restricted; model SDKs change. | Standard-library core and separate protocol adapters reduce mandatory installation and provider coupling. | Custom HTTP, WebSocket, MCP, and certificate code increases maintenance and audit work. Reconsider when mature libraries offer greater net lifecycle value. |
| Session knowledge persists while execution sites vary. | Parent owns inference and history; each request identifies one execution environment. | Parent availability and network access become dependencies. Federation or local autonomy may be preferable when those dominate. |
| Model, tool, and prompt lifecycles differ from releases. | Registries and runtime CRUD postpone binding and enable reconfiguration through the service API. | Validation and consistency must handle invalid or changing definitions. Static configurations remain useful for reproducibility. |
| Some capabilities exist only at the caller. | Client-side descriptors return tool calls to the session driver, avoiding an additional inbound inspector. | Drivers must execute and return results correctly; continuation, identity, and budgets become explicit obligations. |
| Context and inference have finite budgets. | Progressive skill disclosure, independent subagent contexts, and a pre-send context guard defer or compress information. | Selection and summarization can lose information; token estimates are approximate. Larger windows do not remove the need to measure these costs. |
| Networks permit different directions of reachability. | Direct HTTP and child-initiated tunnels reuse application handlers; updates are pushed over the available path. | Protocol, reconnect, proxy, and local replay behavior require testing. Health of one path does not establish health of another. |
| Tool | Evidence or operation | Temporal and authority boundary |
|---|---|---|
| debugger_status | Process identity, uptime, event and dispatch statistics | Current accessory state |
| debugger_events | Retained events, counts, fingerprints, diagnostic session IDs | Bounded event history |
| debugger_event | One exception chain and captured frame summaries | Capture-time evidence |
| debugger_frame | Frame locals and source information by frame ID | Captured evidence; retained objects are not frozen |
| debugger_threads | Current stacks of process threads | Query-time state |
| debugger_eval | Evaluate an expression in a retained frame or accessory scope | Live process execution; enabled by default; not a sandbox |
| Stage | Mechanism in this implementation | Supported claim |
|---|---|---|
| L0 Record | Exception capture, event and frame retention | Bounded incident evidence is available. |
| L1 Diagnose | Agent session with inspection tools | The agent can form evidence-informed hypotheses. Accuracy is unmeasured. |
| L2 Recommend | Disposition instructions and report | The agent can propose action or abstention. Compliance is unmeasured. |
| L3 Modify | Code tools with access to the intended source | Source files can be patched; loaded code may remain unchanged. |
| L4 Reproduce | Default failing-then-passing evidence requirement | Verification is requested using existing tools; completion and adequacy are not enforced. |
| L5 Activate and recover | No general mechanism | Runtime patch activation and failed-call recovery remain gaps. |
| Dimension | agentsvc | Hermes Agent | Pi | Codex | Claude Code |
|---|---|---|---|---|---|
| Delivery and composition | HTTP service, SDK, browser and TUI; runtime registries | Personal/server agent with messaging gateway and configuration | Extensible coding harness, RPC and SDK | CLI, IDE and hosted task forms | CLI/IDE and SDK; historical tool snapshot |
| Execution-site mechanism | One child per request; file, terminal, MCP and journal integration | Documented local, container, SSH and sandbox terminal backends | Extensible execution through harness integrations | Local and hosted execution forms | Local tools and remote integration forms |
| Managed private fleet and reverse transport | Roster, status snapshots, push updates; direct and reverse paths | Full counterpart unverified | Full counterpart unverified | Full counterpart unverified | Full counterpart unverified |
| Caller-owned tool continuation | Session-scoped descriptors, caller execution, same-session results | Equivalent integrated contract unverified | RPC/extensions documented; equivalent contract unverified | Equivalent integrated contract unverified | Interactive tools observed; general contract unverified |
| Exception-triggered in-process inspection | Included accessory with six process-side tools | Integrated counterpart unverified | Integrated counterpart unverified | Integrated counterpart unverified | Integrated counterpart unverified |
| Features not claimed as unique | Skills, subagents, models, persistence, shell tools | Skills, learning, subagents and scheduling documented | Skills and extensions; deliberately minimal built-in policy | Coding tools, skills and sandbox/approval documentation | Agent, skill, planning and permission mechanisms |
| Recorded run | Result | What it checks |
|---|---|---|
| Tunnel suite | 56 passed | Tunnel mechanisms, including replay target, TLS and error responses |
| Debugger and client-tool suites | 40 passed | Handoff completeness, budgets, identity, workspace and prompt contract |
| Remote execution and remote orchestration suites | 61 passed | Wrapping, context and parent-side orchestration behavior |
| Dependency and HTTPS suites | 70 passed | Optional-import constraint, certificate and authentication paths |
| Full Python regression | 1,969 passed | Repository regression checks; targeted runs above are subsets |
| Offline JavaScript self-check | 31 passed | Scripted transport and debugger contract behavior |
LLM Agent Serving
Large language model agent serving runs tool-using, multi-step agents efficiently by coordinating inference, memory, and workflow execution.
See all 42 papers