用 agent-service-toolkit 把 LangGraph 代理变成可上线的 AI 代理服务【免费下载链接】agent-service-toolkitFull toolkit for running an AI agent service built with LangGraph, FastAPI and Streamlit项目地址: https://gitcode.com/GitHub_Trending/ag/agent-service-toolkit用 LangGraph 写通一个 agent 之后真正费劲的往往在后面服务化、流式输出、会话持久化、前端界面每一块都要自己补。agent-service-toolkit 就是为这一步准备的 AI 代理服务工具包内置现成代理、FastAPI 服务和 Streamlit 聊天界面clone 下来几分钟内就能跑起完整闭环。适合谁解决什么问题已选定 LangGraph、不想从零搭服务框架的开发者需要快速给老板或用户演示 agent 效果的团队想试用 human-in-the-loop、多代理协作、RAG 等玩法的个人生产环境要把记忆后端换成 Postgres 或 MongoDB 的人十分钟跑起来先拿到代码git clone https://gitcode.com/GitHub_Trending/ag/agent-service-toolkit cd agent-service-toolkit配置里至少要有一个 LLM 的 API key照下面写即可cp .env.example .env echo OPENAI_API_KEYyour_openai_api_key .env用 uv 安装依赖并启动服务入口是 src/run_service.py跑起 FastAPI 后端uv sync --frozen source .venv/bin/activate python src/run_service.py再开一个终端启动聊天界面 src/streamlit_app.pystreamlit run src/streamlit_app.py浏览器打开http://localhost:8501就能对话。服务侧的 API 文档在http://localhost:8080/redoc/info端点会列出当前可用代理和模型。核心能力拆解记忆后端如何一键切换代理的对话状态靠 checkpoint 持久化。src/memory/ 下给了三套实现sqlite.py、postgres.py、mongodb.pysrc/memory/init.py 里的initialize_database()根据配置自动选择。你只需在.env里改一个变量DATABASE_TYPEpostgres # 可选 sqlite / postgres / mongo默认 sqlite选 Postgres 时再补上POSTGRES_USER、POSTGRES_PASSWORD、POSTGRES_HOST等变量缺失会在启动时报错提示不会静默回退。本地开发用默认 SQLite 即可零配置。如何注册你自己的代理src/agents/ 里有十几个可直接参考的样例chatbot.py、research_assistant.py、rag_assistant.py、github_mcp_agent/、langgraph_supervisor_agent.py覆盖了工具调用、RAG、MCP 工具和监督者-子代理层级编排。加一个新代理只需两步复制research_assistant.py改成你的逻辑再到 src/agents/agents.py 的agents字典里注册。之后直接通过/你的代理名/invoke或/你的代理名/stream访问无需改服务层。流式输出与语音怎么配服务层 src/service/service.py 同时提供 token 级和消息级流式端点前端不用额外处理拼接。语音方面src/voice/ 把 STT/TTS 封装成SpeechToText和TextToSpeech两个类在.env配VOICE_STT_PROVIDER、VOICE_TTS_PROVIDER后Streamlit 界面自动出现语音输入输出。如果不用 Streamlit 而是接 CopilotKit 这类前端所有代理还可通过 AG-UI 协议暴露用法见 docs/AGUI.md。进阶与扩展Docker 一键起栈cp .env.example .env配好 key 后执行docker compose watchcompose.yaml 会拉起 postgres、agent_service、streamlit_app 三个容器改代码自动热重载MongoDB 等可选后端在 docker/ 下有附加 compose 文件。本地模型接 Ollama 见 docs/Ollama.md本地 GPU 跑 vLLM/SGLang 见 docs/Local_GPU_Deployment.md。RAG 代理基于 ChromaDB 的实现和 scripts/create_chroma_db.py 建库流程写在 docs/RAG_Assistant.md。自建前端src/client/client.py 的AgentClient支持同步/异步、流式/非流式调用src/run_client.py 有完整用法示例拿它替换掉 Streamlit 即可接自己的应用。代理写得好只是第一步agent-service-toolkit 把写完到上线中间那段路铺平了你只需专注代理本身。延伸阅读docs/AGUI.md、docs/VertexAI.md、docs/File_Based_Credentials.md【免费下载链接】agent-service-toolkitFull toolkit for running an AI agent service built with LangGraph, FastAPI and Streamlit项目地址: https://gitcode.com/GitHub_Trending/ag/agent-service-toolkit创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考