agentscope
БесплатноБез исполняемых скриптовНе проверенBuild and trace AI agents in Python with AgentScope, an open-source agent framework with a ReAct loop, tools, middleware, team pipelines and OpenTelemetry…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
AgentScope
Overview
AgentScope is a Python framework (Apache-2.0) for building agents on a reasoning-acting (ReAct) loop. Version 2.x (2.0.9 at the time of writing) is a rewrite of the 1.x line: the 1.x names (agentscope.init, ReActAgent, DialogAgent, msghub) are gone, and docs for the two majors must not be mixed. Check the installed version with pip show agentscope and read the matching docs at https://docs.agentscope.io/stable/en/index.
Observability is built in through middleware. TracingMiddleware emits OpenTelemetry spans for each reply, model call and tool execution, so traces flow to any OTLP backend (Jaeger, Grafana Tempo, Langfuse, Datadog). AgentScope does not ship its own trace store, decision logger, audit-trail class or replay tool; use your OTLP backend, the streamed events, and persisted agent state for those jobs.
Requires Python 3.11 or newer. There is no Node.js package.
Instructions
Install
pip install agentscope
# 2.0.9 already installs the OpenTelemetry SDK and OTLP exporters; pin them yourself if you depend on them
pip install opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
# Redis state storage and the agent service need extras
pip install "agentscope[storage-redis,service]"
A minimal agent
An agent needs a name, system prompt and a chat model. Credentials are objects built from environment variables, never literals.
import asyncio, os
from agentscope.agent import Agent
from agentscope.credential import AnthropicCredential
from agentscope.message import UserMsg
from agentscope.model import AnthropicChatModel
from agentscope.tool import FunctionTool, Toolkit
def get_order_status(order_id: str) -> str:
"""Look up the shipping status of an order.
Args:
order_id: The order number, for example A-10482.
"""
return f"Order {order_id} shipped on 2026-09-30 and arrives Monday."
agent = Agent(
name="support-agent",
system_prompt="You answer order questions. Use the tool for any order lookup.",
model=AnthropicChatModel(
credential=AnthropicCredential(api_key=os.environ["ANTHROPIC_API_KEY"]),
model="claude-sonnet-4-5",
),
toolkit=Toolkit(tools=[FunctionTool(get_order_status)]),
)
async def main():
reply = await agent.reply(UserMsg(name="user", content="Where is order A-10482?"))
print(reply.get_text_content())
print(reply.finished_reason, reply.usage)
asyncio.run(main())
reply() returns one Msg. Check finished_reason (completed, interrupted, exceed_max_iters, error; None means the reply paused for human confirmation) and usage (total input/output tokens). Use agent.reply_stream(msg) to receive events as they are produced, and structured_schema=<Pydantic class> to force a validated result in reply.structured_output.
Other providers use the same shape: OpenAIChatModel, GeminiChatModel, DashScopeChatModel, OllamaChatModel, each with a matching *Credential from agentscope.credential.
Trace with OpenTelemetry
Register a tracer provider once per process, then add the middleware to every agent you want traced.
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from agentscope.middleware import TracingMiddleware
provider = TracerProvider()
provider.add_span_processor(
BatchSpanProcessor(OTLPSpanExporter(endpoint="http://localhost:4318/v1/traces"))
)
trace.set_tracer_provider(provider)
agent = Agent(..., middlewares=[TracingMiddleware()])
Spans are nested: the reply span (agent name, session ID, input and output messages) contains model-call spans (model, provider, token counts, messages) and tool spans (tool name, call ID, arguments, result). Without a registered provider the middleware does nothing and costs almost nothing. For custom spans, use trace.get_tracer("agentscope", agentscope.__version__) and the standard OTel API.
To see spans locally without a collector, swap in ConsoleSpanExporter from opentelemetry.sdk.trace.export.
Cap cost per reply
from agentscope.middleware import ReplyBudgetControlMiddleware
middlewares=[TracingMiddleware(),
ReplyBudgetControlMiddleware(token_budget=20000, output_token_weight=3.0)]
Once the weighted token cost reaches the budget, the agent is told to wrap up and tools are disabled for the next step.
Leader and members
TeamPipeline (experimental) lets a leader agent assign tasks to member agents through an internal TeamAssign tool. The leader sees only each member's final reply.
from agentscope.pipeline import TeamMember, TeamPipeline
pipe = TeamPipeline(
leader=leader, # Agent with a Toolkit()
members=[
TeamMember(agent=researcher, d
Установить agentscope в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл agentscope?
Build and trace AI agents in Python with AgentScope, an open-source agent framework with a ReAct loop, tools, middleware, team pipelines and OpenTelemetry tracing. Use when building production agents that need observability, debugging an agent's model and tool calls, capping token spend per reply, or coordinating a leader with specialist agents.
Как установить скилл agentscope?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл agentscope запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic