跳转至

Nanobot TOML Configuration Support - February 7, 2026

1 Summary

Implemented comprehensive TOML configuration support for the nanobot AI assistant, enabling users to use .toml files instead of JSON with full comment support and better readability.

2 Key Achievements

2.1 ✅ TOML Configuration Loader

  • Added support for ~/.nanobot/config.toml file
  • Automatic detection: prioritizes TOML over JSON
  • Maintains backward compatibility with existing JSON configs
  • Proper error handling for malformed TOML files

2.2 ✅ Documentation Updates

  • Updated README.md with comprehensive TOML examples
  • Added comparison table: TOML vs JSON benefits
  • Included full configuration examples for both formats

2.3 ✅ Example Configuration

  • Created config.toml.example with complete setup guide
  • Demonstrated custom OpenAI-compatible provider configuration
  • Showed multi-provider setup with Moonshot/Kimi support

2.4 ✅ Repository Integration

  • Successfully rebased on latest upstream (HKUDS/nanobot)
  • Resolved merge conflicts with security hardening updates
  • Pushed changes to toml-support-merged branch

3 Technical Details

3.1 File Changes

  • Modified: nanobot/config/loader.py - Added TOML loading logic
  • Modified: README.md - Comprehensive documentation updates
  • Added: config.toml.example - Complete example configuration

3.2 Dependencies

  • Uses built-in tomllib (Python 3.11+) or tomli for older versions
  • No breaking changes to existing functionality

4 Usage Examples

4.1 Basic TOML Configuration

# LLM Providers
[providers.openrouter]
apiKey = "sk-or-v1-xxx"

# Agent Defaults  
[agents.defaults]
model = "anthropic/claude-opus-4-5"

4.2 Custom Provider Setup

# Custom OpenAI-compatible providers
[llm_providers.moonshot]
type = "openai-compatible"
apiKey = "your-moonshot-key"
apiBase = "https://api.moonshot.cn/v1"

5 Next Steps

  • Add unit tests for TOML loading functionality
  • Implement automatic JSON-to-TOML migration tool
  • Submit PR to upstream HKUDS/nanobot repository

This implementation complements the existing multi-modal support, A2A protocol, and enhanced reasoning features being developed in the nanobot ecosystem.


Report generated by: AI Assistant
Repository: zhangfuwen/nanobot
Branch: toml-support-merged