$ show agentscope-ai/agentscope
AgentScope is a full-stack, production-grade multi-agent orchestration platform. The core library (`src/agentscope/`) provides a FastAPI-based agent service with CRUD endpoints for agents, sessions, credentials, channels, knowledge bases, schedules, and SOPs. It features a modular middleware onion pattern for agent lifecycle hooks (reply, reasoning, acting, tool execution), a pluggable storage abstraction (Redis, SQL with Alembic migrations, S3 blob store), and a message bus (in-memory or Redis) for inter-session communication and distributed coordination. The system supports real-time voice (WebRTC, DashScope/OpenAI/Gemini/xAI), RAG pipelines with document parsing and vector stores (Qdrant, Milvus, MongoDB, Elasticsearch), channel integrations (Feishu, DingTalk, Discord), and sandboxed workspace backends (Docker, Kubernetes, E2B, Daytona, Apple Containers, Bubblewrap, OpenSandbox). A full React/TypeScript web UI (`examples/web_ui/frontend`) provides chat, channel management, schedule calendar, knowledge base browsing, and MCP hub browsing. Additionally, a terminal console and a goal-oriented pipeline are provided for developer workflows. The framework emphasizes transparency, controllability, and separation between agent logic and infrastructure, supporting multi-agent collaboration, human-in-the-loop permissions, and long-term memory via ReMe and mem0 middleware.
The LLM identified 5 files worth highlighting for reuse:
Provides `DictMixin`, a generic dataclass-to-dict converter with attribute access and nesting support. Demonstrates a clean, reusable pattern for serializing Pydantic-like objects without external dependencies. Could be extracted into any Python project needing structured data conversion.
Defines `MiddlewareBase`, an abstract class implementing the onion pattern for agent lifecycle hooks (`on_reply`, `on_reasoning`, `on_acting`, etc.). Composable, non-invasive, and easily extracted into any framework needing a pipeline of cross-cutting concerns (logging, tracing, permissions).
In-memory implementation of `MessageBusBase`, providing publish/subscribe, queues, distributed locks, and a registry for session-to-bus mapping. Clean async interface with comprehensive error handling. Could be extracted as a standalone lightweight event bus for any asyncio application.
Defines `ToolBase` with Pydantic input schema, permission checking (`check_permissions`), streaming chunk support (`ToolChunk`), and concurrency safety flags. Demonstrates a robust pattern for exposing agent-callable functions with safety and streaming. Could be reused in any LLM agent framework.
Implements a projector pattern for mirroring events from one session to another (e.g., subagent HITL results to team leader). Uses message bus registry and lifecycle hooks. Clean separation of concerns, extractable into any event-driven system requiring cross-session state synchronization.