Commit Graph

42 Commits

Author SHA1 Message Date
DanielWalnut
7978e05dc1 feat: add nginx reversed proxy (#15)
* docs: add nginx reverse proxy documentation

Add comprehensive nginx configuration documentation to README including:
- Production deployment instructions with step-by-step setup
- Architecture diagram showing traffic routing between services
- Nginx features: unified entry point, CORS handling, SSE support
- Updated project structure with nginx.conf and service ports

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat: implement nginx

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-19 23:23:38 +08:00
hetaoBackend
a6fcdbf50a fix: fix proxy 2026-01-19 21:36:35 +08:00
hetaoBackend
74d4a16492 feat: add MCP (Model Context Protocol) support
Add comprehensive MCP integration using langchain-mcp-adapters to enable
pluggable external tools from MCP servers.

Features:
- MCP server configuration via mcp_config.json
- Automatic lazy initialization for seamless use in both FastAPI and LangGraph Studio
- Support for multiple MCP servers (filesystem, postgres, github, brave-search, etc.)
- Environment variable resolution in configuration
- Tool caching mechanism for optimal performance
- Complete documentation and setup guide

Implementation:
- Add src/mcp module with client, tools, and cache components
- Integrate MCP config loading in AppConfig
- Update tool system to include MCP tools automatically
- Add eager initialization in FastAPI lifespan handler
- Add lazy initialization fallback for LangGraph Studio

Dependencies:
- Add langchain-mcp-adapters>=0.1.0

Documentation:
- Add MCP_SETUP.md with comprehensive setup guide
- Update CLAUDE.md with MCP system architecture
- Update config.example.yaml with MCP configuration notes
- Update README.md with MCP setup instructions

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-19 18:58:13 +08:00
hetaoBackend
ffb9ed3198 fix: use shared httpx client to prevent premature closure in SSE streaming
The proxy was creating a temporary httpx.AsyncClient within an async context manager.
When returning StreamingResponse for SSE endpoints, the client was being closed before
the streaming generator could use it, causing "client has been closed" errors.

This change introduces a shared httpx.AsyncClient that persists for the application
lifecycle, properly cleaned up during shutdown. This also improves performance by
reusing TCP connections across requests.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-19 16:52:30 +08:00
hetaoBackend
3a4149c437 fix: stop tracking .claude/settings.local.json
Remove .claude/settings.local.json from git tracking and add it to .gitignore to prevent future accidental commits of local settings.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-19 16:28:03 +08:00
DanielWalnut
f0a2381bd5 feat: implement summarization (#14) 2026-01-19 16:17:31 +08:00
DanielWalnut
e1a8d544b6 feat: add clarification feature (#13) 2026-01-18 19:55:36 +08:00
DanielWalnut
6f97dde5d1 fix: Long thinking but with empty content (#12) 2026-01-18 14:21:40 +08:00
DanielWalnut
5f4c58aa82 feat: implement lazy sandbox and thread data initialization (#11)
Defer sandbox acquisition and thread directory creation until first use to improve performance and reduce resource usage.

Changes:
- Add lazy_init parameter to SandboxMiddleware (default: true)
- Add ensure_sandbox_initialized() helper for lazy sandbox acquisition
- Update all sandbox tools to use lazy initialization
- Add lazy_init parameter to ThreadDataMiddleware (default: true)
- Create thread directories on-demand in AioSandboxProvider
- LocalSandbox already creates directories on write (no changes needed)

Benefits:
- Saves 1-2s Docker container startup for conversations without tools
- Reduces unnecessary directory creation and file system operations
- Backward compatible with lazy_init=false option

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-18 13:38:34 +08:00
DanielWalnut
5a0912d0fd fix: fix backend python execution (#10) 2026-01-18 12:41:48 +08:00
DanielWalnut
3261273ee3 feat: fix todos (#9) 2026-01-17 23:23:12 +08:00
Henry Li
d603771291 chore: add TODO for checking duplicate files in state.artifacts 2026-01-17 16:25:51 +08:00
Henry Li
1d3b3e8eb8 dos: update backend TODOs 2026-01-17 16:17:59 +08:00
Henry Li
0c6f8353bf feat: support artifact preview 2026-01-17 15:09:44 +08:00
DanielWalnut
d5b3052cda feat: add artifacts logic (#8) 2026-01-16 23:04:38 +08:00
DanielWalnut
50a1e407cf feat: add thread-safety and graceful shutdown to AioSandboxProvider (#7)
Add thread-safe port allocation and proper cleanup on process exit to
prevent port conflicts in concurrent environments and ensure containers
are stopped when the application terminates.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 22:28:19 +08:00
Henry Li
d2845f658f docs: rewording 2026-01-16 22:10:08 +08:00
Henry Li
56b26c060e feat: add present_file tool 2026-01-16 21:48:00 +08:00
DanielWalnut
cfa97f7a96 feat: add skills system for specialized agent workflows (#6)
Implement a skills framework that enables specialized workflows for
specific tasks (e.g., PDF processing, web page generation). Skills are
discovered from the skills/ directory and automatically mounted in
sandboxes with path mapping support.

- Add SkillsConfig for configuring skills path and container mount point
- Implement dynamic skill loading from SKILL.md files with YAML frontmatter
- Add path mapping in LocalSandbox to translate container paths to local paths
- Mount skills directory in AIO Docker sandbox containers
- Update lead agent prompt to dynamically inject available skills
- Add setup documentation and expand config.example.yaml

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 14:44:51 +08:00
DanielWalnut
fb92a472e2 feat: add gateway module with FastAPI server (#5)
* chore: add .claude/ to .gitignore

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: add gateway module with FastAPI server

- Add new gateway module with FastAPI app for API routing
- Add gateway and serve commands to Makefile
- Add fastapi, httpx, uvicorn, sse-starlette dependencies
- Fix model config retrieval in lead_agent (support both model_name and model)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 13:22:26 +08:00
DanielWalnut
c7d68c6d3f feat: support function factory (#4) 2026-01-15 22:05:54 +08:00
DanielWalnut
3b879e277e fix: fix local path for local sandbox (#3) 2026-01-15 14:37:00 +08:00
DanielWalnut
41442ccc2f feat: add thread data middleware (#2) 2026-01-15 13:22:30 +08:00
DanielWalnut
b2abfecf67 feat: add AIO sandbox provider and auto title generation (#1)
- Add AioSandboxProvider for Docker-based sandbox execution with
  configurable container lifecycle, volume mounts, and port management
- Add TitleMiddleware to auto-generate thread titles after first
  user-assistant exchange using LLM
- Add Claude Code documentation (CLAUDE.md, AGENTS.md)
- Extend SandboxConfig with Docker-specific options (image, port, mounts)
- Fix hardcoded mount path to use expanduser
- Add agent-sandbox and dotenv dependencies

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 23:29:18 +08:00
Henry Li
de2d18561a feat: integrated with sandbox 2026-01-14 12:32:34 +08:00
Henry Li
c1e9340062 chore: use .env 2026-01-14 12:32:15 +08:00
Henry Li
ce0b6f7754 chore: specify project title 2026-01-14 09:57:52 +08:00
Henry Li
5d6a7442d6 chore: remove tests 2026-01-14 09:52:34 +08:00
Henry Li
2aeaf7c965 style: format 2026-01-14 09:21:19 +08:00
Henry Li
421488a991 chore: add lint and format 2026-01-14 09:20:05 +08:00
Henry Li
e5c69cb7ee docs: update tool docs 2026-01-14 09:12:03 +08:00
Henry Li
cb611f9270 chore: use ruff to lint and auto-format 2026-01-14 09:08:20 +08:00
Henry Li
7dc063ba25 feat: add agents 2026-01-14 07:20:00 +08:00
Henry Li
cbbbac0c2b feat: add tools 2026-01-14 07:19:43 +08:00
Henry Li
57a02acb59 feat: add sandbox and local impl 2026-01-14 07:19:34 +08:00
Henry Li
4b5f529903 feat: integrated with Tavily and Jina AI 2026-01-14 07:17:22 +08:00
Henry Li
83bd7e4309 feat: add model modules 2026-01-14 07:16:45 +08:00
Henry Li
721b26a32f chore: add an empty __init__.py 2026-01-14 07:16:27 +08:00
Henry Li
86524a65f6 feat: add reflection modules 2026-01-14 07:16:07 +08:00
Henry Li
88ed3841c7 feat: add config modules 2026-01-14 07:15:58 +08:00
Henry Li
c2a62a2266 chore: add Python and LangGraph stuff 2026-01-14 07:15:02 +08:00
Henry Li
81bd4dafa8 chore: add .gitignore for Python project 2026-01-14 07:14:00 +08:00