40 Commits

Author SHA1 Message Date
HyunjunJeon
e65593e67c 2026-01-13 Live 질문지 업데이트 2026-01-13 20:18:16 +09:00
HyunjunJeon
6a4f3dcdd9 Update docs 2026-01-13 18:57:35 +09:00
HyunjunJeon
fa67114806 Update 2026-01-13 18:42:46 +09:00
HyunjunJeon
19f867e72a 최종 작업 Commit 2026-01-12 16:06:43 +09:00
HyunjunJeon
6f01c834ba feat: Deep Research Agent 확장 - Ralph Loop, 깊이 설정, 테스트 스위트 추가
- research_agent/tools.py: 한글 Docstring 및 ASCII 흐름도 추가
- research_agent/researcher/depth.py: ResearchDepth enum 및 DepthConfig 추가
- research_agent/researcher/ralph_loop.py: Ralph Loop 반복 연구 패턴 구현
- research_agent/researcher/runner.py: 연구 실행기 (CLI 지원)
- tests/researcher/: 91개 테스트 (실제 API 호출 포함)
- scripts/run_ai_trend_research.py: AI 트렌드 연구 스크립트 + 도구 궤적 로깅
2026-01-12 15:49:43 +09:00
HyunjunJeon
9e3d37fa86 deleted old docs 2026-01-11 18:16:47 +09:00
HyunjunJeon
6f2c612770 DeepAgents with Context Engineering 2026-01-11 18:16:20 +09:00
HyunjunJeon
af5fbfabec 문서 추가: Context Engineering 문서 추가 및 deepagents_sourcecode 한국어 번역
- Context_Engineering.md: 에이전트 컨텍스트 엔지니어링 개념 정리 문서 추가
- Context_Engineering_Research.ipynb: 연구 노트북 업데이트
- deepagents_sourcecode/: docstring과 주석을 한국어로 번역
2026-01-11 17:55:52 +09:00
HyunjunJeon
9a4ae41c84 init Context Engineering of DeepAgents 2026-01-11 14:05:05 +09:00
HyunjunJeon
e686e6ad79 deepagents_sourcecode update 2026-01-11 12:05:37 +09:00
HyunjunJeon
1232d24468 feat: Initial implementation of rig-rlm for a Recursive Language Model with REPL and rig-deepagents for a middleware-based agent runtime. 2026-01-04 16:43:25 +09:00
HyunjunJeon
05b794f05f docs: Remove old diagrams and plans, add new documentation, plans, middleware, and a demo. 2026-01-03 20:58:49 +09:00
HyunjunJeon
06e9095312 refactor(llm): replace legacy providers with RigAgentAdapter
Remove OpenAIProvider and AnthropicProvider in favor of RigAgentAdapter
which properly wraps Rig's native providers. This fixes a critical bug
where the tools parameter was completely ignored in the legacy providers.

Changes:
- Add src/compat/ module with RigToolAdapter and RigAgentAdapter
- Delete src/llm/openai.rs and src/llm/anthropic.rs
- Update ProductionConfig to use RigAgentAdapter
- Update all doc comments and examples to use new API
- Update e2e tests to use RigAgentAdapter

The new adapters provide:
- Proper integration with Rig's 20+ LLM providers
- LLMProvider trait compatibility for existing code
- RigToolAdapter for using Rig tools in rig-deepagents

Test: 401 library tests pass, clippy clean
2026-01-03 17:03:01 +09:00
HyunjunJeon
a6039efd5a feat(middleware): add model hooks and HumanInTheLoop/PatchToolCalls middlewares
Python DeepAgents와 완전한 기능 동등성 달성을 위한 미들웨어 시스템 확장:

## AgentMiddleware 트레이트 확장
- before_model/after_model hooks 추가 (LLM 호출 전후 개입)
- ModelRequest/ModelResponse/ModelControl 타입 추가
- InterruptRequest/ActionRequest/ReviewConfig/Decision 타입 추가

## 새 미들웨어 구현
- PatchToolCallsMiddleware: 댕글링 tool call 자동 패치
  - AIMessage의 tool_calls에 대응 ToolMessage 없을 때 합성 응답 삽입
  - before_agent hook 사용

- HumanInTheLoopMiddleware: 인간 승인 인터럽트
  - 특정 도구 호출 전 실행 중단 및 승인 요청
  - after_model hook 사용
  - InterruptOnConfig로 도구별 설정

## 기타 변경
- DeepAgentError::Interrupt variant 추가
- AgentExecutor에 model hooks 통합
- MiddlewareStack에 before_model/after_model orchestration 추가

+1,182줄, 415개 테스트 통과
2026-01-03 11:38:28 +09:00
HyunjunJeon
554bd509ba feat(middleware): add SummarizationMiddleware for token budget management
Implements automatic context summarization for long-running agent conversations:

- token_counter.rs: Approximate token counting with model-specific ratios
  (Claude: 3.3 chars/token, OpenAI: 4.0 chars/token)
- trigger.rs: TriggerCondition (Tokens/Messages/Fraction) and KeepSize enums
- config.rs: SummarizationConfig with builder pattern and model presets
- mod.rs: Core middleware implementing after_agent hook

Key features:
- Configurable triggers (token count, message count, or fraction of max)
- Safe message partitioning that respects AI/Tool message pairs
- LLM-based summary generation for older messages
- StateUpdate::SetMessages for replacing message history

This closes the last critical gap between Rust and Python DeepAgents.
2026-01-03 11:10:41 +09:00
HyunjunJeon
7dab2b5b1c feat(rig-deepagents): complete remaining implementation tasks
- ToolVertex compilation: instantiate real ToolVertex from registry
  instead of PassthroughVertex placeholder when tool and backend available

- SubAgent timeout: wrap executor.run() with configurable timeout
  (default 5 minutes), add MiddlewareError::SubAgentTimeout variant

- Edge labels: add EdgeMetadata struct, update edge storage to
  Vec<(VertexId, Option<EdgeMetadata>)>, add add_edge_with_label()
  method for Mermaid diagram visualization

- RedisCheckpointer: full implementation with TTL support, compression,
  and workflow isolation via key prefix pattern

- PostgresCheckpointer: full implementation with connection pooling,
  compression, and ACID-compliant storage using SQLx

All 356 unit tests passing. Feature-gated dependencies:
  checkpointer-redis, checkpointer-postgres
2026-01-03 10:36:55 +09:00
HyunjunJeon
b64f31380f feat(p1): implement core production functionality for workflow system
Implements all P1 critical features required for production-ready workflow execution:

## AgentVertex Real Tool Execution
- Added ToolRegistry for mapping tool names to implementations
- Created new_with_registry() constructor for full tool execution support
- Tools are executed via execute_tool() with proper error handling
- Graceful fallback when tool not in registry (returns error message)

## StateMatch Stop Condition
- Implemented state field matching using JSON serialization
- Supports dot notation for nested paths (e.g., "research.status")
- Added get_state_field() helper for field extraction
- Added Serialize bound to Vertex impl for state access

## ToolVertex State Argument Resolution
- Implemented build_arguments() to merge static and state-resolved args
- State args override static args with same key
- Supports nested state paths (e.g., "settings.max_results")
- Added comprehensive tests for resolution, override, and missing paths

## SubAgent Registry Integration
- Added compile_with_all() for full resource compilation
- SubAgentVertex created when registry, executor, and backend available
- Falls back to PassthroughVertex with warning when resources missing

## New APIs
- ToolRegistry: new(), register(), get(), definitions(), names()
- CompiledWorkflow::compile_with_all(): full resource compilation
- CompiledWorkflow::compile_with_registry(): tool registry compilation

## Test Coverage
- 13 new unit tests for tool execution and state matching
- All 384 tests passing (356 lib + 10 skill-validator + 15 integration + 3 doc)
2026-01-03 01:50:44 +09:00
HyunjunJeon
dae351dcdb feat(e2e): add SQLite checkpointer and real LLM integration tests
Implements comprehensive end-to-end testing infrastructure with actual
LLM and API integrations:

SQLite Checkpointer:
- Full async SQLite persistence with tokio-rusqlite
- Optional zstd compression support for reduced storage
- Workflow isolation by ID
- History cleanup with retention policies
- 10 dedicated unit tests

Production Configuration:
- Environment-based config (OPENAI_API_KEY, TAVILY_API_KEY)
- Support for OpenAI and Anthropic providers
- ProductionConfig with builder pattern for customization
- ProductionSetup for complete workflow initialization

CompiledWorkflow Enhancements:
- compile_with_tools() method for full LLM + tools support
- Real AgentVertex integration when LLM provider available
- Fallback to PassthroughVertex for no-LLM scenarios

E2E Test Suite (9 tests, 8 require API keys):
- Basic OpenAI completion
- LLM with tool definitions
- Tavily search execution
- Production config validation
- Simple agent workflow execution
- Research state management
- Full production setup
- Token usage tracking
- Invalid API key error handling

Integration Tests (15 tests):
- SQLite checkpointer with ResearchState
- Research state workflow transitions
- Budget enforcement
- Source/direction deduplication
- Full state checkpoint with messages

Total test count: 378 tests passing
2026-01-03 01:30:46 +09:00
HyunjunJeon
326db2e78a fix(research): address code review findings for Phase 9-10 implementation
- Add can_continue computed field to ResearchState for router compatibility
- Add refresh_can_continue() method for manual state mutation scenarios
- Fix memory leak in skills middleware test helper (TempDir tuple pattern)
- Add convenience re-exports for domain tools and research module in lib.rs
2026-01-03 00:43:39 +09:00
HyunjunJeon
1a0d629090 feat(research): add Phase 10 Research Workflow and Task 9a.4 Skill Validator
Implements the remaining tasks from the rig-deepagents implementation plan:

Phase 9a.4 - Skill Validator CLI:
- CLI tool for validating SKILL.md files with YAML frontmatter
- Checks required fields, kebab-case naming, format compliance
- JSON output mode and CI-friendly exit codes

Phase 10 - Research Workflow:
- ResearchState implementing WorkflowState trait with phases
  (Exploratory → Directed → Synthesis → Complete)
- ResearchDirection, Finding, Source, SourceAgreement types
- Research prompts (planner, explorer, researcher, synthesizer)
- ResearchWorkflowBuilder for configurable workflow construction
- Phase routing and budget management helpers

Total: 47 new tests added (all passing)
2026-01-03 00:23:45 +09:00
HyunjunJeon
6a083f8fda feat(tools): add Phase 9a Skills Middleware and Phase 9b Domain Tools
Phase 9a - Skills Middleware:
- SkillLoader with YAML frontmatter parsing and lazy loading
- SkillsMiddleware with progressive disclosure pattern
- Two-tier caching (metadata eager, content lazy)

Phase 9b - Domain Tools:
- TavilySearchTool with production-ready features:
  - Type-safe enums for search_depth and topic
  - HTTP timeout (30s) and retry with exponential backoff
  - Typed error handling (TavilyError enum)
  - Complete JSON schema with additionalProperties: false
- ThinkTool with minimal output for reduced prompt pollution

Includes 18 new tests:
- HTTP behavior tests with wiremock mocking
- Enum serialization tests
- Error handling and retry logic tests

Breaking changes: None
2026-01-02 23:58:37 +09:00
HyunjunJeon
d880b60dd7 feat(workflow): complete Phase 8.4 with CompiledWorkflow and vertex exports
Phase 8.4 Workflow Builder DSL completion:

- Add CompiledWorkflow struct that bridges BuiltWorkflowGraph to PregelRuntime
  - compile() and compile_with_providers() methods for workflow compilation
  - PassthroughVertex as placeholder for Agent/Tool/SubAgent nodes
  - Full support for RouterVertex, FanOutVertex, FanInVertex
  - Mermaid diagram generation via to_mermaid() methods

- Enable ToolVertex and RouterVertex module exports
  - Fix DynTool type definition (was Arc<Arc<dyn Tool>>, now Arc<dyn Tool>)
  - Add missing test imports (UnitUpdate, LLMConfig)
  - Fix clippy warnings (for_kv_map, unnecessary_lazy_evaluations)

- Update workflow/vertices/mod.rs with comprehensive re-exports
  - AgentVertex, ToolVertex, RouterVertex, SubAgentVertex
  - FanOutVertex, FanInVertex

Test results: 249 passed, 0 failed (8 new CompiledWorkflow tests)
2026-01-02 22:22:22 +09:00
HyunjunJeon
c2f99c211c fix(parallel): address clippy warnings for type_complexity and manual_map
- Add ReceivedMessages type alias for complex Arc<Mutex<Vec<...>>> type
- Replace manual if-else with or_else().cloned() pattern
2026-01-02 22:03:52 +09:00
HyunjunJeon
02d0c0ecfd fix(router): add missing type annotation 2026-01-02 22:01:14 +09:00
HyunjunJeon
4327e5d757 chore: add regex dependency 2026-01-02 22:00:55 +09:00
HyunjunJeon
26ba26514f feat(workflow): add FanOut and FanIn parallel execution vertices
- Implements FanOutVertex for broadcasting and splitting messages
- Implements FanInVertex for collecting and merging results
- Adds SplitStrategy (Broadcast, Split, RoundRobin) support
- Adds MergeStrategy (Collect, First, Last, Concat, Merge) support
- Includes comprehensive tests for parallel execution patterns
- Adds placeholder files for graph, router and tool vertices
2026-01-02 22:00:41 +09:00
HyunjunJeon
559ba4386a feat(subagent): implement SubAgent middleware and vertex system
Add comprehensive SubAgent delegation system matching Python DeepAgents:

SubAgent Middleware (middleware/subagent/):
- SubAgentSpec and CompiledSubAgent for agent definitions
- SubAgentRegistry for named agent lookup
- IsolatedState for context isolation (excludes messages, todos)
- TaskTool for delegating work to sub-agents
- SubAgentMiddleware for automatic tool injection
- SubAgentExecutorFactory pattern for testable execution

SubAgentVertex (workflow/vertices/subagent.rs):
- Pregel vertex for workflow-based SubAgent nodes
- Prompt extraction from incoming messages
- Recursion limit checking via superstep proxy
- Registry lookup and isolated execution

Executor Extensions (executor.rs):
- additional_tools support for custom tool injection
- system_prompt configuration
- recursion_depth tracking (H2 fix for nested calls)
- RuntimeConfig propagation to ToolRuntime

Error Types (error.rs):
- SubAgentExecution and SubAgentNotFound variants

All 221 tests pass, zero clippy warnings.
2026-01-02 21:53:25 +09:00
HyunjunJeon
e1dfb876c4 feat(pregel): add Mermaid diagram visualization for workflow graphs
Add visualization capabilities to PregelRuntime for debugging and monitoring:

- to_mermaid(): Static workflow structure diagram
- to_mermaid_with_state(): Diagram with execution state colors
- to_mermaid_with_kinds(): Diagram with proper NodeKind shapes
- log_state(): Terminal output with Unicode state symbols

Node shapes mapped to NodeKind variants:
- Agent → Rectangle, Tool → Subroutine, Router → Diamond
- SubAgent → Cylinder, FanOut/FanIn → Parallelogram
- START/END → Stadium shape

State colors: Active (green), Halted (orange), Completed (gray)

Also adds:
- VertexId.as_str() method for string access
- Ord/PartialOrd derives on VertexId for sorting
- Integration tests with PNG rendering verification
2026-01-02 18:15:08 +09:00
HyunjunJeon
64271798a6 docs(pregel): add Mermaid visualization design document
Design for workflow graph visualization feature:
- to_mermaid(): Static structure diagram for debugging
- to_mermaid_with_state(): Runtime state with colors
- log_state(): Terminal output for monitoring

Node types distinguished by shape, conditional edges
shown as dotted lines with labels.
2026-01-02 17:55:38 +09:00
HyunjunJeon
999a0b8f98 fix(pregel): add ExecutionMode for LangGraph-style edge-driven execution
Fixes two critical issues preventing LangGraph parity:

C1: Entry-point execution model
- Add ExecutionMode enum (MessageBased default, EdgeDriven)
- In EdgeDriven mode, only entry vertex starts Active
- Other vertices start Halted and await edge activation

C2: Edge-driven message routing
- Add activation_message() to VertexMessage trait
- When vertices halt in EdgeDriven mode, automatically send
  Activate messages to edge targets
- Enables A→B→C chain execution via graph edges

Backward compatible: MessageBased mode preserves existing behavior
where all vertices start Active.

Tests: 169 passed, 0 failed
2026-01-02 14:37:09 +09:00
HyunjunJeon
d8f2eb68d4 feat(workflow): implement workflow graph system with node types and agent vertex
- Added `mod.rs` for the workflow graph system, outlining the structure and usage.
- Introduced `node.rs` defining various node types (Agent, Tool, Router, etc.) and their configurations.
- Created `vertices/agent.rs` implementing the `AgentVertex` for LLM-based processing with tool calling capabilities.
- Added `vertices/mod.rs` to organize vertex implementations.
- Implemented serialization and deserialization for node configurations using Serde.
- Included tests for node configurations and agent vertex functionality.
2026-01-02 12:34:02 +09:00
HyunjunJeon
755c7f1321 docs: add comprehensive Pregel runtime design for rig-deepagents
Brainstorming session resulted in detailed design documents:

## Design Document (pregel-design.md)
- Full Pregel runtime architecture with superstep execution
- 4 checkpointer backends (File, Redis, SQLite, PostgreSQL)
- 7 node types (Agent, Tool, SubAgent, Router, FanOut, FanIn, Transform)
- Workflow Builder DSL with macros
- Type-safe SubAgent system with registry and executor
- Skills middleware with progressive disclosure
- Domain tools (Tavily search, Think)
- Three-phase research workflow

## Implementation Tasks (implementation-tasks.md)
- 35+ concrete tasks with TDD approach
- Parallel execution groups for efficiency
- Dependency tracking between tasks
- Estimated ~50h total dev time, ~35h with parallelism

Key design decisions:
- Rust-idiomatic enhancements over Python port
- Type-Safe Enum for SubAgentKind
- Lazy loading for Skills with dev-time validation
- Full Pregel with checkpointing and fault tolerance
2026-01-02 00:29:43 +09:00
HyunjunJeon
2e8a2f6880 feat(llm): implement LLMProvider abstraction with OpenAI and Anthropic support
Phase 7 implementation of provider-agnostic LLM interface:

- Add LLMProvider trait for unified completion interface
- Implement OpenAIProvider via rig-core's OpenAI client
- Implement AnthropicProvider via rig-core's Anthropic client
- Add message/tool conversion layer between DeepAgents and Rig formats
- Add LLMConfig for runtime configuration (model, temperature, max_tokens)
- Add TokenUsage for tracking input/output tokens
- Update AgentExecutor to use Arc<dyn LLMProvider>
- Add Conversion error variant for message conversion

All 71 tests pass with TDD approach. Clippy clean.
2026-01-01 23:32:00 +09:00
HyunjunJeon
76666fb9c5 docs: add Phase 7-9 implementation plan for rig-deepagents
Phase 7: LLM Provider Abstraction
- LLMProvider trait design
- OpenAI provider (1st priority)
- Anthropic provider (2nd priority)
- Message/Tool conversion layer

Phase 8: SubAgent Execution System
- SubAgent definition types
- Registry for dynamic lookup
- Executor with recursion control

Phase 9a: Skills Middleware
- Progressive disclosure pattern
- SKILL.md loader
- SkillsMiddleware implementation

Phase 9b: Domain Tools
- TavilySearchTool
- ThinkTool

All phases use TDD approach with verification steps.
2026-01-01 23:15:01 +09:00
HyunjunJeon
e116924ea9 feat(rig-deepagents): complete Phase 5-6 implementation
## Phase 1 - Security Fixes (HIGH Priority)
- Fix symlink path traversal in FilesystemBackend
- Add root path edge case handling in resolve_path

## Phase 2 - Backend Behavioral Fixes (MEDIUM Priority)
- Fix MemoryBackend::ls boundary check (prefix matching)
- Fix normalize_path to handle "." segments
- Fix grep glob_filter to match full relative paths
- Document grep literal vs regex design decision

## Phase 3 - Tool Implementations (CRITICAL)
Implement all 8 core tools:
- read_file: Read file content with offset/limit
- write_file: Create/overwrite files
- edit_file: String replacement in files
- ls: List directory contents
- glob: Pattern-based file search
- grep: Content search (literal)
- write_todos: Todo list management
- task: SubAgent delegation request
- Add default_tools() and all_tools() helpers

## Phase 4 - Executor Loop (CRITICAL)
- Add LLMProvider trait for LLM abstraction
- Implement AgentExecutor with tool execution loop
- Add MockLLM for testing
- Add max_iterations limit support

## Verification
- 46 tests passing
- Clippy clean (no warnings)
- All phases complete

Co-authored-by: Claude Code <claude@anthropic.com>
2026-01-01 22:18:55 +09:00
HyunjunJeon
f974fe6117 feat: add rig-deepagents Rust port with code review fixes
Initial implementation of rig-deepagents crate - a Rust port of the
LangChain DeepAgents middleware system using the Rig framework.

Core implementation (Phases 1-4):
- AgentState with messages, todos, files, and type-erased extensions
- MemoryBackend, FilesystemBackend, and CompositeBackend
- MiddlewareStack with pre/post hooks and tool injection
- ToolRuntime for execution context management

HIGH severity fixes (from Codex/Code Review):
- MemoryBackend glob() now respects base_path filtering (security fix)
- CompositeBackend write/edit restores files_update key paths
- CompositeBackend glob aggregates results from all backends
- AgentState.clone() logs warning when extensions are lost

MEDIUM severity fixes:
- Add centralized path_utils for consistent path normalization
- CompositeBackend route matching normalizes trailing slashes
- FilesystemBackend grep uses async tokio::fs (non-blocking)
- RuntimeConfig.max_recursion increased to 100 with custom constructor

Test coverage: 38 tests passing
Verified by: Codex CLI (gpt-5.2-codex), Code Reviewer subagent
2026-01-01 21:02:24 +09:00
HyunjunJeon
9b79bb4d6a 발표 후 업데이트 2025-12-31 15:48:56 +09:00
HyunjunJeon
ff7e9f609c Update README.md to enhance project description and structure details 2025-12-31 14:06:45 +09:00
HyunjunJeon
14628f22f6 Docs update 2025-12-31 14:02:10 +09:00
HyunjunJeon
9cb01f4abe project init 2025-12-31 11:32:36 +09:00