Version: 2.5.0 Core Principle: Platform MUST support SKILL and MCP extensions
FastReAct Nano is an Agent Platform, not just a chatbot
- ✅ All features MUST work with SKILL system
- ✅ All features MUST work with MCP tools
- ✅ Gateway: Single-tenant mode (
workspaces/default/) - ✅ Feishu: Multi-tenant mode (
/var/fastreact/tenants/feishu/{user_key}/) - ❌ NEVER bypass SKILL system
- ❌ NEVER hardcode tools (use MCP instead)
Documentation:
- Skills:
docs/SKILLS_AND_MCP.md - MCP:
docs/MCP_CALLING_MECHANISM.md - Multi-tenant:
docs/MULTITENANT_GUIDE.md
Core (The Brain): Pure intent generator, stateless reasoning
- Location:
src/fastreact/core/react.py - FORBIDDEN: Executing tools, checking safety, managing state
Agent (The Body): Loop control, tool execution, safety, context
- Location:
src/fastreact/agent.py - FORBIDDEN: Generating reasoning (that's Core's job)
ALL communication via AgentEvent stream:
- NO callbacks
- NO StreamChunk
- NO direct event emission
Event Types: SESSION_START, THINK, TOOL_CALL, TOOL_RESULT, STEP_END, SESSION_END
Upper layers use public APIs only:
- FORBIDDEN: Importing
internal.py - FORBIDDEN: Accessing
_privateattributes cross-module - FORBIDDEN: CLI accessing
Core._private, Agent accessingLLM._http_pool
Session state persisted to memory.json after each tool execution
- Failure recovery via SESSION_RESUME mechanism
- No state held only in memory during long-running tasks
Location: src/fastreact/agent.py:677-693
Hard limit: 25 iterations
iteration_count = 0
max_iterations = 25
while True:
iteration_count += 1
if iteration_count > max_iterations:
yield AgentEvent.session_end(session_id, "[STOPPED] Max iterations reached")
returnTests: 3/3 passing
Location: src/fastreact/providers/litellm.py:319-383
5-level cascading repair strategy
Tests: 11/11 passing
Location: src/fastreact/adapters/gateway.py
History tracking with automatic pruning (max 50 turns)
Tests: 3/3 passing
Location: src/fastreact/mcp/manager.py
Automatic reconnection with retry logic (max 3 attempts)
Tests: 3/3 passing
Location: src/fastreact/mcp/manager.py
Automatic detection and resurrection of crashed MCP servers
Tests: 6/6 passing
Location: src/fastreact/agent.py:330-460
API-level caching optimization:
# Before: System prompt changes with each skill combination (cache miss)
system_prompt = base_prompt + tools_section + skills_section # Variable
# After: Base prompt is constant (cache hit), skills injected as message
base_prompt, skills_content = self._build_system_prompt_with_skills(skills)
messages.insert(0, {"role": "system", "content": skills_content})
core.run_step_stream(messages, system_prompt=base_prompt) # ConstantBenefits:
- Base prompt constant (1,162 chars) regardless of skill selection
- Expected 20-50% cost reduction from API cache hits
- Skills content injected as separate system message
- No functional changes to LLM behavior
Tests: 353/353 passing (100%)
Test Coverage Summary: 353/353 passing (100%)
ALWAYS: pathlib.Path, Path.cwd(), Path / "subdir"
FORBIDDEN: Hardcoded "C:\", "/Users/", "./" relative paths
ALWAYS: encoding='utf-8' for file I/O
Use text markers: [OK], [ERROR], [WARNING], [INFO], [DONE]
FORBIDDEN: Unicode emojis (cause Windows encoding, httpx UTF-8 errors)
Examples:
# CORRECT
config_path = Path.cwd() / "config.json"
with open(path, 'r', encoding='utf-8') as f:
print("[OK] Config loaded")
# AVOID
config_path = "./config.json"
print("Config loaded") # No status indicator4 core tools + infinite Skills + exec universal tool
Core Tools (never increasing):
- exec_tool - Universal shell command execution
- read_file - Read file contents
- write_file - Write/create files
- edit_file - Edit files (string replacement)
Use exec tool when:
- Functionality available as bash command
- Quick prototyping
- Simple data processing
Use MCP servers when:
- Need state management (databases)
- Complex protocols (SSH, browsers)
- Cross-language integration
Documentation: docs/PLATFORM/TOOLS_AND_EXTENSIONS.md
# All tests
python3 run_tests.py all
# Unit only
python3 run_tests.py unit
# Integration tests
python3 run_tests.py integration
# Specific test
pytest tests/unit/test_config.py -v
# With coverage
pytest tests/ --cov=src/fastreact --cov-report=htmlcd fastreact-nano-web
npm install
npm run dev # localhost:3000
npm run build
npm startblack src/ tests/
ruff check src/ tests/ --fix
mypy src/
# All quality checks (run before commit)
black src/ tests/ && ruff check src/ tests/ --fix && mypy src/Standard @dataclass with from_env() support:
from dataclasses import dataclass
import os
@dataclass
class LLMConfig:
model: str = "gpt-4o-mini"
api_base: str = "https://api.openai.com/v1"
api_key: str = ""
temperature: float = 0.7
max_tokens: int = 4096
@classmethod
def from_env(cls) -> "LLMConfig":
return cls(
model=os.getenv("FASTRACT_MODEL", cls.model),
api_base=os.getenv("FASTRACT_API_BASE", cls.api_base),
api_key=os.getenv("FASTRACT_API_KEY", cls.api_key),
temperature=float(os.getenv("FASTRACT_TEMPERATURE", cls.temperature)),
max_tokens=int(os.getenv("FASTRACT_MAX_TOKENS", cls.max_tokens)),
)Priority Order (high to low):
- Constructor parameters
- Config file (
~/.fastreact/config.json) - Environment variables (
FASTRACT_*) - Defaults (in
@dataclass)
- ❌ Implementing features that cannot be extended via SKILL
- ❌ Hardcoding external integrations (use MCP instead)
- ❌ Breaking SKILL auto-selection
- ❌ Breaking MCP tool discovery
- ❌ Mixing user data in multi-tenant mode
- ❌ Adding more core tools (stay at 4)
- ❌ Using emojis in code/output
- ✅ Keep 4 core tools minimal
- ✅ Use exec tool for simple operations
- ✅ Use MCP for complex integrations
- ✅ Follow Brain-Body separation
- ✅ Use AgentEvent protocol
- ✅ Maintain multi-tenant isolation
- ✅ Use pathlib for paths
- ✅ Use UTF-8 encoding
- ✅ Use text markers ([OK], [ERROR])
Where to put documentation:
| Location | For What |
|---|---|
Root (*.md) |
Essential user-facing docs only (max 10 files) |
docs/ |
Feature docs, guides, reference material |
docs_archive/ |
Historical, sprint reports, temporary notes |
Before creating new documentation:
- Check
docs/DOCS_INDEX.mdfor similar topics - UPDATE existing doc instead of creating new one
- For temporary/process docs → use
docs_archive/sprints/
- ✅ Infinite loop protection (25 iterations)
- ✅ JSON parsing robustness (5-level repair)
- ✅ Multi-turn dialog memory (50 turns)
- ✅ MCP auto-reconnect (3 retries)
- ✅ MCP zombie resurrection (automatic)
- ✅ 26/26 tests passing (100%)
- ✅ Unified theme (6 themes)
- ✅ Background mesh effect
- ✅ Navigation bar integrated
- ✅ Ctrl+Enter to send
- ✅ Build passing
- Status: Phase 1.5 Complete
- Quality: Ironclad + Professional
- Ready for: Production deployment
Maintainer: FastReAct Team Last Updated: 2025-02-27 Version: 2.4.2 Phase: 1.5 Complete + Frontend Polish