Skip to content

Architecture

weego edited this page Jun 5, 2026 · 2 revisions

Architecture

LightAgent keeps a small core and delegates persistence, external systems, and domain behavior to composable adapters.

Runtime Components

User Query
   |
   v
LightAgent.run()
   |
   +-- History
   +-- Memory.retrieve()
   +-- Skills metadata
   +-- Tree of Thought planning
   +-- ToolRegistry schemas
   |
   v
OpenAI-compatible Chat Completion
   |
   +-- Final answer
   +-- Tool calls
          |
          v
      AsyncToolDispatcher
          |
          +-- Python tools
          +-- Built-in tools
          +-- MCP tools
          +-- Skill tools

LightFlow
   |
   +-- Step dependency validation
   +-- Per-step retries
   +-- Dependency output passing
   +-- Flow trace events
   |
   v
Named LightAgent.run() steps

Main Modules

Module Responsibility
core.py LightAgent, run loop, tool calling, memory context, swarm handoff
flow.py LightFlow, step dependency execution, flow results, flow trace events
tools.py Tool registry, dynamic loading, async dispatch
protocol.py MemoryProtocol and MemoryPolicy
result.py RunResult and StreamEvent
tracing.py Trace event recording
skills.py Skill discovery and activation
skill_tools.py Tools for listing and activating Skills
mcp_client_manager.py MCP stdio and SSE client integration
errors.py Error taxonomy and formatting

Extension Points

  • Python tools through tool_info.
  • Runtime tools through agent.run(..., tools=[...]).
  • Memory through store() and retrieve().
  • MCP tools through setup_mcp().
  • Skills through SKILL.md directories.
  • Deterministic workflow composition through LightFlow.
  • External tracing through tracetools.

Design Principle

Keep the framework small and let applications own domain policy:

  • persistence
  • user authorization
  • high-risk action approval
  • memory governance
  • deployment topology
  • business workflow orchestration above or around LightFlow

Clone this wiki locally