Skip to content

feat: Kaapi Agentic Chatbot Flow & State Management - #1300

Open
Ayush8923 wants to merge 10 commits into
mainfrom
feat/kaapi-chatbot-flow-v2
Open

Ayush8923 wants to merge 10 commits into
mainfrom
feat/kaapi-chatbot-flow-v2

Conversation

@Ayush8923

@Ayush8923 Ayush8923 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Closes #1230 #1278

Summary

  • Added POST /chatbot/message, stateless chatbot endpoint; caller sends full message history each turn, gets back the updated transcript
  • Built ChatbotEngine using LangGraph + LangChain (ChatAnthropic), single-node graph handles one conversation turn
  • Added token-based history summarization: when history exceeds the token budget, older turns are compressed into a summary note before the model call
  • Wired chatbot model settings to existing Kaapi config system (config_id + optional config_version) so model, max tokens, and reasoning effort come from saved configs
  • Added langchain-anthropic dependency
  • Added two Alembic seed migrations (086, 087) for Anthropic text model configs
  • Added wiki docs for the chatbot module

Chatbot State Management Related Updates

  • chatbot conversation history is now stored on the server, the caller doesn't need to send the full history every time
  • create a session once (POST /chatbot/sessions), you'll get a session_id
  • send every message using that session_id (POST /chatbot/sessions/{session_id}/message), the server tracks history itself
  • on sending a message the API immediately returns 202; the bot's reply is processed in the background and POSTed to the caller webhook_url.
  • system prompt and config get locked while creating the session, the same settings stay throughout the conversation

Checklist

Before submitting a pull request, please ensure that you mark these task.

  • Ran fastapi run --reload app/main.py or docker compose up in the repository root and test.
  • If you've fixed a bug or added code that is tested and has test cases.

@Ayush8923 Ayush8923 changed the title feat: Kaapi Agentic Chatbot Flow- #1273 feat: Kaapi Agentic Chatbot Flow Oct 21, 2026
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 1
  • ready-for-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot changed the title feat: Kaapi Agentic Chatbot Flow feat(chatbot): Implement Stateless Chatbot Endpoint Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

OpenAPI changes   🟢 4 non-breaking changes

Tip

Safe to merge from an API-contract perspective.

Full changelog  ·  4
Method Path Change
🟢 POST /api/v1/chatbot/message endpoint added
🟢 GET /api/v1/chatbot/sessions endpoint added
🟢 POST /api/v1/chatbot/sessions endpoint added
🟢 POST /api/v1/chatbot/sessions/{session_id}/message endpoint added

main ↔ 2318b2e1 · generated by oasdiff

@Ayush8923 Ayush8923 self-assigned this Oct 21, 2026
@Ayush8923 Ayush8923 changed the title feat(chatbot): Implement Stateless Chatbot Endpoint feat: Kaapi Agentic Chatbot Flow Oct 21, 2026
@Ayush8923
Ayush8923 marked this pull request as ready for review October 21, 2026 18:59
@Ayush8923 Ayush8923 mentioned this pull request Oct 21, 2026
1 of 2 tasks
@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.77703% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
backend/app/services/chatbot/session.py 94.80% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Ayush8923 Ayush8923 linked an issue Oct 21, 2026 that may be closed by this pull request
4 tasks
@Ayush8923 Ayush8923 changed the title feat: Kaapi Agentic Chatbot Flow feat: Kaapi Agentic Chatbot Flow & State Management Oct 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chabot: Server-side chatbot state management Chatbot Engine: Dynamic, configurable conversations

1 participant