Every agent run produces a structured log directory and persists task data to a SQLite database for Web UI consumption.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/SanMuzZzZz/LuaN1aoAgent/llms.txt
Use this file to discover all available pages before exploring further.
Log directory structure
logs/{task-name}/{timestamp}/ where timestamp is formatted YYYYMMDD_HHMMSS. Override with --log-dir.
All files are written via atomic rename (
tempfile + os.replace) to prevent corruption if the process is interrupted mid-write.metrics.json
A JSON object updated after each P-E-R cycle and finalized on task completion. Intermediate snapshots are written throughout the run so in-progress metrics are always readable.
Monotonic key protection
Before each write, the file is read and compared against the in-memory values. For the keyscost_cny, total_tokens, prompt_tokens, and completion_tokens, the higher of the two values is always kept. This prevents a stale in-memory snapshot from overwriting fresher data written by a parallel executor subtask.
Fields
The value passed to
--task-name.Unique operation ID in the format
task_{timestamp}_{uuid_prefix}, or the value passed to --op-id.Unix timestamp (float) at which the agent started.
Unix timestamp (float) at task completion or termination.
null while the task is running.Elapsed time in seconds. Updated on every metrics write.
Cumulative token count across all LLM calls.
Tokens consumed by all input prompts.
Tokens generated by all completions.
Total LLM cost in CNY (Chinese Yuan). Calculated per-call by the LLM client based on model pricing.
Dictionary mapping tool name to total invocation count across the entire run.
Total number of executor steps taken across all subtasks.
Number of Planner invocations (initial plan + dynamic re-plans).
Number of Reflector invocations (one per completed subtask, plus the final global reflection).
true if the agent determined the top-level goal was achieved.Count of nodes in the causal graph at task end. Reflects the number of evidence, hypothesis, vulnerability, and exploit nodes accumulated.
Full list of causal graph node tuples
[node_id, node_data] at task end. Each node_data object contains node_type, description, confidence (for hypotheses), and other type-specific fields.Seconds elapsed between process start and
GraphManager initialization. Measures agent bootstrap overhead.Present only if the task was terminated by a resource circuit breaker.
| Value | Meaning |
|---|---|
global_max_cycles_exceeded | Reached the GLOBAL_MAX_CYCLES limit (default: 50) |
global_token_limit_exceeded | Exceeded GLOBAL_MAX_TOKEN_USAGE (default: 5,000,000) |
Error message if the task terminated with an unhandled exception. Absent on successful runs.
Present only in ReAct mode runs. Value:
"react".Example
run_log.json
An append-only JSON array. Each element is a log entry appended by the main P-E-R loop. The array is rewritten atomically on each save.
Entry types
task_initialized
task_initialized
Written once at startup.
initial_plan
initial_plan
Written after the first Planner call.
data contains the raw list of graph operations returned by the Planner.dynamic_plan
dynamic_plan
Written after each subsequent Planner call.
data contains the full plan response including graph_operations, global_mission_accomplished, and global_mission_briefing.executor_cycle_completed
executor_cycle_completed
Written after each subtask finishes execution.
reflection_completed
reflection_completed
Written after the Reflector finishes auditing a subtask. Contains the full reflection output including
audit_result, key_findings, causal_graph_updates, and key_facts.global_reflection_completed
global_reflection_completed
Written once after the main loop exits. Contains the Reflector’s final global audit of the entire run.
SQLite database (luan1ao.db)
All task data is persisted concurrently to a SQLite database for Web UI consumption. The database survives process restarts — session history is preserved across runs.
What is stored
- Sessions / tasks — one row per
op_id, with name, goal, status, and timestamps. - Graph nodes and edges — both task DAG nodes and causal graph nodes, upserted after every modification.
- Log events —
llm.*,execution.*, andgraph.changedevents are persisted for real-time streaming.
Node sync behavior
Nodes are synced to the database asynchronously viaschedule_coroutine. Writes use atomic upsert (atomic_upsert_graph_data) to batch multiple nodes and edges in a single transaction, reducing SQLite contention under parallel subtask execution.
Real-time monitoring
Web UI
When the Web service (python web/server.py) is running, the frontend polls the database via Server-Sent Events (SSE) for live updates. Start the Web service before starting the agent, then launch the agent with --web to print the session URL.
Console output modes
| Mode | What is printed |
|---|---|
simple | Task graph structure and key facts only |
default | Plan summaries, reflection results, causal graph changes |
debug | Full LLM prompt and response text, all graph operations |
console_output.log in the log directory.
Graceful shutdown and log safety
The agent registersSIGINT and SIGTERM handlers that trigger a clean shutdown via Python’s sys.exit(0). The finally block in main() guarantees a final log save regardless of how the process exits — including keyboard interrupt, signal, or unhandled exception.
Halt signal files (/tmp/{task_id}.halt) written by complete_mission are cleaned up in the same finally block.