본문으로 건너뛰기
cccskills
무료GitHub에 공개

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.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md8.6 KB
  • _scores.json2.6 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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, description="Finds and summarizes sources."),
        TeamMember(agent=writer, description="Drafts the report from findings."),
    ],
)

Member names must be unique and differ from the leader's. Tasks for different members run concurrently. launch_console(pipe) from agentscope.console runs it in the terminal.

Persist and resume

agent.state (an AgentState) serializes to JSON: context, permissions, tool state and the position of a paused reply. Pass state= when constructing an agent to resume. agentscope.app.storage.RedisStorage stores it under (user_id, agent_id, session_id); use upsert_session on the first turn, because update_session_state raises KeyError for a session that does not exist yet. Saved states are your audit trail of what the agent saw and did.

Examples

Example 1: Trace a support agent into a local Jaeger

Request: "Add tracing to my support agent so I can see each model and tool call in Jaeger."

Start Jaeger with OTLP enabled (docker run --rm -p 16686:16686 -p 4318:4318 jaegertracing/all-in-one), use the exporter at http://localhost:4318/v1/traces from the section above, add middlewares=[TracingMiddleware()], run the agent, and open http://localhost:16686. Choose the service name you set (TracerProvider(resource=Resource.create({"service.name": "support-agent"})), Resource from opentelemetry.sdk.resources) and you will see one trace per reply with child spans for each model call and get_order_status execution, including token counts.

Example 2: Researcher and writer team with a spend limit

Request: "I want a leader that sends research to one agent and drafting to another, and never spends more than about 20k tokens per reply."

Build researcher and writer as ordinary Agent instances with ReplyBudgetControlMiddleware(token_budget=20000) each, build a leader = Agent(..., toolkit=Toolkit()), wrap them in TeamPipeline as above, and call launch_console(pipe). The leader's trace shows TeamAssign calls; each member's own spans carry their token use. A reply that hits its budget finishes with a short wrap-up instead of more tool calls.

Guidelines

  • Do not copy AgentScope 1.x snippets. Search results and older tutorials show agentscope.init(...), ReActAgent, msghub; none apply to 2.x.
  • Everything is async: await agent.reply(...) inside asyncio.run.
  • Check finished_reason in production code: exceed_max_iters and error replies still return a Msg.
  • Traces contain full prompts and tool arguments. Do not send them to a shared collector if they hold personal data, and keep API keys in environment variables, never in prompts.
  • TeamPipeline, SOP and realtime features are marked experimental; their interfaces can change between 2.0.x releases. Pin the version.
  • Tools that run shell commands (Bash, Write, Edit) are powerful; keep AgentScope's permission mode and a sandboxed workspace (Docker or similar) for untrusted tasks.
  • Not the right tool when you need a hosted tracing UI with evaluations out of the box; pair it with an OTLP backend that has one.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Scripts and configures production rendering in Autodesk 3ds Max with the V-Ray and Corona renderers: output size and files, render elements, denoising, light mix, batch and command-line rendering, and network rendering. Use when a user asks to set up a production render, render several cameras in one batch, render from the command line or on a render farm, add render passes for compositing, or cut render time for archviz and product shots.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

TerminalSkills/skills1722026년 10월 14일 업데이트

Covers scripting Autodesk 3ds Max, the 3D modeling and rendering application, with MAXScript and Python (pymxs): scene manipulation, object creation, material assignment, camera and light setup, batch operations, and file I/O. Use when tasks involve automating repetitive 3ds Max workflows, batch processing scenes, running scripts headless with 3dsmaxbatch, creating custom tools, or scripting scene setup for archviz, product visualization, or VFX.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

TerminalSkills/skills1722026년 10월 14일 업데이트

3proxy

무료

3proxy is a small open-source proxy server that runs HTTP/HTTPS, SOCKS4/5, SNI and TCP/UDP port-mapping proxies from one config file. Use when a user asks to set up an HTTP or SOCKS5 proxy, add proxy users and passwords, write 3proxy access rules, chain or rotate upstream (parent) proxies, limit bandwidth, connections or monthly traffic per user, run 3proxy in Docker, or fix a 3proxy.cfg that will not start.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

TerminalSkills/skills1722026년 10월 14일 업데이트

Builds Agent2Agent (A2A) servers and clients, the open protocol (originally from Google, now under the Linux Foundation) that lets AI agents from different frameworks call each other. Use when the user wants to create an A2A-compliant agent, build an Agent Card, implement task management, connect agents across frameworks, set up agent discovery, handle streaming responses, implement push notifications, or orchestrate multi-agent workflows. Trigger words: a2a, agent to agent, agent2agent, a2a protocol, a2a server, a2a client, agent card, agent interoperability, agent collaboration, multi-agent, agent discovery, a2a sdk, a2a task.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

TerminalSkills/skills1722026년 10월 14일 업데이트

Plans a controlled experiment (A/B test) so its result can be trusted: writes the hypothesis, picks one primary metric and the guardrails, computes sample size and run time, specifies how visitors are assigned and when exposure is logged, and reads out the result with a confidence interval. Use when someone says "set up an A/B test", "split test this page", "how many visitors do I need", "how long should the experiment run", "is this result significant", "can I stop the test early", or wants to test a headline, price, layout or onboarding change against the current version.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

TerminalSkills/skills1722026년 10월 14일 업데이트

ably

무료

Ably is a hosted realtime messaging service: clients publish and subscribe to named channels over WebSockets, see who is present, replay message history, and resume after a dropped connection. Use when a user asks to "add realtime updates", "push live notifications to the browser", "show who is online", "add a chat room with typing indicators", "publish from a serverless function", or "authenticate Ably clients without exposing the API key". Covers the ably 2.x JavaScript SDK (Realtime and REST), JWT token authentication, presence, history and rewind, batch publishing, and the @ably/chat 1.x SDK.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

TerminalSkills/skills1722026년 10월 14일 업데이트

TerminalSkills의 스킬 모두 보기

이 스킬의 문제 신고