Commit graph

14 commits

Author SHA1 Message Date
Nick Misasi
1838ea84c5 chore: complete v1.1 LangChain Agent Demo milestone
Archived:
- milestones/v1.1-ROADMAP.md (phases 14-18, 5 plans)
- milestones/v1.1-REQUIREMENTS.md (9 requirements shipped)

Deleted (fresh for next milestone):
- ROADMAP.md

Updated:
- MILESTONES.md (added v1.1 entry with stats and accomplishments)
- PROJECT.md (updated tech stack, key decisions, last updated timestamp)
- STATE.md (ready for v1.2 planning)

v1.0 and v1.1 both shipped and archived. Ready for next milestone.
2026-01-21 10:55:51 -05:00
Nick Misasi
eff1402d23 feat(18-01): add graceful tool error handling with tenacity retry
- Added tenacity>=8.0.0 dependency for retry logic
- Created _invoke_agent_with_retry helper with @retry decorator
- Retries up to 3 times with exponential backoff (1-10 seconds)
- Retries only on ConnectionError and TimeoutError (transient)
- Graceful fallback to tool-less model on repeated failures
2026-01-20 14:05:21 -05:00
Nick Misasi
dee764f260 feat(18-01): enable extended thinking for Anthropic model
- ChatAnthropic now uses thinking={"type": "enabled", "budget_tokens": 2000}
- Increased max_tokens to 5000 to accommodate thinking + response
- Updated system prompt to leverage thoughtful reasoning
2026-01-20 14:04:33 -05:00
Nick Misasi
0334f2c6ad feat(18-01): add recursion limit to prevent infinite agent loops
- Agent invocation now uses config={"recursion_limit": 10}
- Limits ReAct agent to 10 reasoning iterations max
- Prevents infinite loops in complex multi-step tasks
2026-01-20 14:04:04 -05:00
Nick Misasi
b5f5973521 feat(17-01): add MCP client initialization and async agent handlers
- Add _get_mcp_server_config() method for server configuration
- Initialize MCP client in on_activate() after model initialization
- Add async _handle_message_async() that uses create_react_agent with MCP tools
- Update _handle_openai_message and _handle_anthropic_message to use asyncio.run()
- Graceful fallback to basic model.invoke() when no MCP servers configured
2026-01-20 13:44:15 -05:00
Nick Misasi
994f016486 feat(17-01): add MCP dependencies and imports
- Add langchain-mcp-adapters>=0.2.0 and langgraph>=0.2.0 to requirements.txt
- Bump langchain to >=1.2.0 for MCP adapter compatibility
- Add asyncio, MultiServerMCPClient, create_react_agent imports
- Add mcp_client attribute to __init__
2026-01-20 13:42:50 -05:00
Nick Misasi
f25d90e9c9 feat(16-01): update handlers to use conversation history
- OpenAI handler now uses _build_conversation_history
- Anthropic handler now uses _build_conversation_history
- Both handlers determine root_id and pass to response methods
- Bot remembers previous messages in thread conversations
- Updated bot_id type hint to accept str | None
2026-01-20 13:07:46 -05:00
Nick Misasi
5452456ebf feat(16-01): add conversation history builder from thread
- Import AIMessage from langchain_core.messages
- Add _build_conversation_history method
- Fetches thread posts and converts to LangChain message types
- User posts become HumanMessage, bot posts become AIMessage
- Graceful fallback if thread fetch fails
2026-01-20 13:07:05 -05:00
Nick Misasi
ced3c57ccb feat(16-01): add threading support to response methods
- Added root_id parameter to _send_response method
- Added root_id parameter to _send_error_response method
- Post creation now includes root_id for threaded replies
2026-01-20 13:06:35 -05:00
Nick Misasi
5f2f3c261b feat(15-01): replace placeholder handlers with LangChain invocation
- Replace _handle_openai_message with real LangChain model.invoke()
- Replace _handle_anthropic_message with real LangChain model.invoke()
- Add _send_response helper for posting messages
- Add _send_error_response helper for error messages
- Check for None model before invocation (missing API key)
- Wrap API calls in try/except with user-friendly error messages
2026-01-20 11:51:06 -05:00
Nick Misasi
39a370b177 feat(15-01): add LangChain dependencies and model initialization
- Add langchain, langchain-openai, langchain-anthropic to requirements.txt
- Import ChatOpenAI, ChatAnthropic, and message types
- Add openai_model and anthropic_model instance variables
- Initialize models in on_activate with error handling for missing API keys
2026-01-20 11:50:17 -05:00
Nick Misasi
6750a88eed feat(14-01): implement DM message routing to bot handlers
- Add MessageHasBeenPosted hook for message routing
- Check channel type for DM detection
- Route messages based on bot membership in channel
- Add _handle_openai_message stub with placeholder response
- Add _handle_anthropic_message stub with placeholder response
- Include proper error handling for API calls

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 11:30:44 -05:00
Nick Misasi
9a27ea5bcb feat(14-01): implement bot creation on plugin activation
- Create LangChainAgentPlugin class with OnActivate/OnDeactivate hooks
- Add OpenAI bot (langchain-openai-agent) creation
- Add Anthropic bot (langchain-anthropic-agent) creation
- Store bot IDs as instance attributes for message routing
- Include proper error handling and logging

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 11:30:10 -05:00
Nick Misasi
c83ec9656e feat(14-01): create LangChain Agent plugin structure
- Add plugin.json manifest with plugin metadata
- Add requirements.txt with placeholder for future LangChain deps
- Add Makefile with venv, dist, clean targets

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 11:29:39 -05:00