Akshay66777/agentscope-chat
0
AgentScope Chat on Hugging Face Spaces
A single-file Gradio app running an AgentScope Agent in-process — no FastAPI server, no React frontend, just Gradio + AgentScope. That makes it eligible for HF Spaces' free zero-a10g (ZeroGPU) hardware.
Features
- Streaming chat with an AgentScope
ReActAgent - Built-in tools: bash, read, write, edit, glob, grep — the agent can read and modify files in its workspace
- OpenAI-compatible: works with OpenAI or any OpenAI-compatible endpoint (set
OPENAI_BASE_URL) - MCP / custom skills / custom OpenAI-compatible API: all supported by AgentScope's framework — extend
app.pyto wire them in
Setup (Hugging Face Spaces)
- Create a Space with SDK = Gradio and hardware = ZeroGPU (free)
- Add these Secrets under Settings → Variables and secrets:
- Push these files to the Space:
app.py— the Gradio apprequirements.txt— Python depspyproject.toml— AgentScope package metadatasrc/— the AgentScope source (installed editable)README.md— this file (Space frontmatter above)
- The Space auto-builds and serves the app on port 7860.
Local run
cd /home/z/my-project/agentscope
pip install -e ".[rag,tools]"
pip install -r requirements.txt
export OPENAI_API_KEY=sk-...
python app.py
# → http://localhost:7860Extending
The app is a single app.py — edit freely:
- Add MCP servers → pass
mcps=[MCPClient(...)]toToolkit(...)(seeagentscope.mcp.StdioMCPConfig/HttpMCPConfig) - Add custom skills → pass
skills_or_loaders=["/path/to/skill-dir"]toToolkit(...)(skill dir must containSKILL.md) - Add custom tools → subclass
agentscope.tool.ToolBaseand add to thetools=[...]list - Stream tokens → swap
agent.reply()foragent.reply_stream()and yield chunks into the Gradio chatbot - Add long-term memory → pass
middlewares=[Mem0Middleware(...)]toAgent(...)
Source
Upstream: https://github.com/agentscope-ai/agentscope
