Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
356 changes: 356 additions & 0 deletions docs/plans/agentscope-integration.md

Large diffs are not rendered by default.

78 changes: 78 additions & 0 deletions docs/plans/agentscope-research-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# AgentScope integration: research notes

> Companion to [agentscope-integration.md](./agentscope-integration.md). Collected 2026-12-03. These are raw findings, citations, and things that didn't belong in the plan. "✅" means the page or file was fetched during this run (via WebFetch, `gh api` read-only, or the PyPI JSON API). Quotes are verbatim from the fetched content; paraphrases are not quoted.

## 1. Pages and files opened

| Source | URL | Status | Key findings |
| --- | --- | --- | --- |
| Legacy tool tutorial | https://doc.agentscope.io/tutorial/task_tool.html | ✅ (version selector shows "Stable(v1.0)" and "v0.1.x") | v1 API: tool functions return `ToolResponse`; `toolkit.register_tool_function(my_search, preset_kwargs={"api_key": "xxx"})`; `create_tool_group`, `update_tool_groups(group_names=[...], active=True)`, `reset_equipped_tools`. Built-ins listed: `execute_python_code`, `execute_shell_command`, `view_text_file`, `write_text_file`, `insert_text_file`, DashScope/OpenAI multimodal tools. No web search tool. **Not the current API.** |
| Docs root | https://docs.agentscope.io/ | ✅ (HTTP 308 redirect to the versioned site) | PyPI's `Documentation` URL for `agentscope`. Sourced from https://github.com/agentscope-ai/docs (`en/versions/<ver>/…mdx`; versions 1.0.21 and 2.0.10 through 2.0.13dev are present). |
| Tool overview 2.0.12 | `agentscope-ai/docs` `en/versions/2.0.12/building-blocks/tool/overview.mdx` | ✅ | Concepts table: Tool (`ToolBase`, `FunctionTool`, `MCPTool`), Toolkit, Tool Group. `Toolkit(tools=[Bash(), Read(), Write(), Edit()])`; "A `Toolkit` created with `tools` alone exposes those tools in the special `"basic"` group, which is always active." |
| Python Tool 2.0.12 | https://docs.agentscope.io/en/versions/2.0.12/building-blocks/tool/python-tool | ✅ (live page and docs-repo source) | `ToolBase` attribute and method tables. The custom-tool example is `class WebSearch(ToolBase)` with `is_read_only = True` and `check_permissions` returning `PermissionDecision(behavior=PermissionBehavior.ALLOW, message="Web search is read-only.")`, and `call` returning `ToolChunk(content=[TextBlock(text=results)])`. `FunctionTool` args: `func, name, description, input_schema (dict or BaseModel), is_concurrency_safe=True, is_read_only=False, is_state_injected=False`. Note: "Wrapped functions default to `ASK` permission behavior: the user must explicitly allow each call. Subclass `ToolBase` directly when you need custom permission logic." Tool middleware (`ToolMiddlewareBase.on_tool_call`), onion order. |
| Meta Tool 2.0.12 | `…/building-blocks/tool/manage-tools.mdx` | ✅ | `ToolGroup(name, description, instructions, tools=[…])`; `reset_tools` auto-registered when non-basic groups exist; "The meta tool input represents the **final state** of all groups". |
| MCP 2.0.12 | `…/building-blocks/tool/mcp.mdx` | ✅ (first ~80 lines) | `MCPClient(name, is_stateful, mcp_config=StdioMCPConfig(...) / HttpMCPConfig(url, headers={"Authorization": "Bearer xxx"}))`; `Toolkit(mcps=[client])`; tools are named `mcp__{server_name}__{tool_name}`; "tools annotated with `readOnlyHint` are recognized as read-only by the permission system (auto-allowed in EXPLORE and ACCEPT_EDITS modes; in DEFAULT they still ASK unless an allow rule matches)". "AgentScope 2.0.11 uses the MCP Python SDK 2.x (`mcp>=2.0.0`)." `enable_tools` / `disable_tools` filters. |
| MCP Hub 2.0.12 | `…/deploy/hub/mcp-hub.mdx` | ✅ (first ~90 lines) | "An MCP hub is a catalog of MCP servers your users browse and install from inside the app." Ships `GitHubMCPHub` (base_url `https://api.mcp.github.com`). A feature of Agent Service (`create_app(mcp_hubs=[...])`). Credentials are entered once at install time. **For MCP servers only.** |
| Skill Hub 2.0.12 | `…/deploy/hub/skill-hub.mdx` | ✅ (first ~90 lines) | "A skill hub is a catalog of skills … A skill is a folder, a `SKILL.md` …". Ships `ClawSkillHub` (`https://clawhub.ai`). `create_app(skill_hubs=[...])`. **For skills only.** |
| 2.0.12 docs tree | `agentscope-ai/docs` `en/versions/2.0.12/` | ✅ | No "integrations", "partners", or "ecosystem" page. Sections: building-blocks, deploy (agent-service, channel, hub, rag, sharing, sop, workspace-manager), quickstart, release notes, FAQ. |
| Repo metadata | https://github.com/agentscope-ai/agentscope | ✅ | `gh api repos/modelscope/agentscope` returns `agentscope-ai/agentscope` (redirect). Default branch `main`, ~37k stars, pushed 2026-12-03. Branches include `main`, `v0`, `v1`. Releases: v2.0.12 (2026-11-16), v2.0.11 (2026-10-27), v2.0.10 (2026-10-12). `_version.py` on main: `2.0.13dev`. |
| `pyproject.toml` | …/blob/main/pyproject.toml | ✅ (top 60 lines + grep) | `name = "agentscope"`, licence `Apache-2.0`, `requires-python = ">=3.11"`, deps include `httpx`, `mcp>=2.0.0`, `pydantic`. No `entry-points` section. |
| `src/agentscope/tool/__init__.py` | …/tree/main/src/agentscope/tool | ✅ | Exports `ToolBase, ParamsBase, ToolMiddlewareBase, MCPTool, FunctionTool, ToolGroup, Toolkit, ToolChunk, ToolResponse, RegisteredTool`, plus built-ins `AskUser, ResetTools, Bash, PowerShell, Edit, Glob, Grep, Read, Write, Task*`, and backends. |
| `tool/_base.py` | same | ✅ | `ToolBase` attributes as documented; `async def call(...)`: "This is the new override point for tool implementations. Subclasses should override this method instead of `__call__`." `__call__` runs middlewares. `check_permissions` is abstract. `check_read_only` defaults to `self.is_read_only`. `ParamsBase(BaseModel)` strips `title` from the JSON schema. |
| `tool/_toolkit.py` | same | ✅ | `Toolkit.__init__(tools, skills_or_loaders, mcps, tool_groups, meta_tool_response_template, skill_instruction_template)`; `"basic"` reserved; `async add_tool(tool, group_name="basic")` logs "Duplicate tool name '%s' found in group '%s', overwriting it."; `async get_tool_schemas(groups=None)`; `async call_tool(tool_call, state)` docstring: "the tool functions only need to return/yield the ToolChunk objects in an incremental manner." |
| `tool/_adapters.py` | same | ✅ | `FunctionTool.check_permissions` returns `ASK` with "Custom function tools must be explicitly allowed by the user." unless a `permission` was passed. `MCPTool` sets `is_read_only` from the MCP `readOnlyHint` annotation. |
| `tool/_response.py` | same | ✅ | `ToolChunk(content: List[TextBlock\|DataBlock], state=RUNNING, is_last=True, metadata: dict, id)`. `ToolResponse` has accumulated content and a final state (`ERROR`, `DENIED`, `INTERRUPTED`, `SUCCESS`). |
| `tool/_types.py` | same | ✅ (grep) | The only remaining `preset_kwargs` mention is in a docstring ("Remove preset_kwargs from the JSON schema"). GitHub code search for `preset_kwargs` in the repo finds only this file. |
| `tool/_tool_group.py` | same | ✅ | `ToolGroup(name, description=None, instructions=None, tools=None, skills_or_loaders=None, mcps=None)`; a description is required unless the name is `"basic"`. |
| `permission/_types.py` | …/tree/main/src/agentscope/permission | ✅ | `PermissionMode`: DEFAULT, ACCEPT_EDITS, EXPLORE, BYPASS, DONT_ASK. The DEFAULT row says "Every operation asks for permission unless: an allow rule matches, OR the tool's `check_permissions` explicitly returns ALLOW". |
| `permission/_engine.py` | same | ✅ | DEFAULT order: deny rules → ask rules → **read-only fast path → ALLOW** → tool `check_permissions` → allow rules → ASK. `_check_read_only_fast_path` docstring: "A read-only invocation has no side effects, so it is auto-allowed in every `PermissionMode`." Present at v2.0.8 and v2.0.10; **absent at v2.0.3**. |
| `credential/_base.py`, `_openai.py` | …/tree/main/src/agentscope/credential | ✅ | `CredentialBase(BaseModel)` with `id` and `name`; classmethods `get_chat_model_class()` etc. raise `NotImplementedError`. `OpenAICredential(api_key: SecretStr, organization, base_url)`. Model-oriented; no tool credentials. |
| `agent/_agent.py` | …/blob/main/src/agentscope/agent/_agent.py | ✅ (`__init__`) | `Agent(name, system_prompt, model, toolkit=None, middlewares=None, state=None, offloader=None, model_config=None, context_config=None, react_config=None, injection_config=None)`; toolkit is "the sole source" of tools, MCPs, and skills. |
| `_base.py` at tags | `?ref=v2.0.0 … v2.0.8` | ✅ | `async def call(` count: v2.0.0 0, v2.0.1 0, v2.0.2 0, **v2.0.3 1**, v2.0.5 1, v2.0.8 1. |
| `CONTRIBUTING.md` | …/blob/main/CONTRIBUTING.md | ✅ (426 lines) | Claim or create an issue first; max 5 open issues per contributor; PR against `main`; Conventional Commits; companion docs PR in `agentscope-ai/docs`. "Open an issue before non-trivial work." "Don't add dependencies casually." Lazy-import principle. Module guides exist only for Chat Model (credential + model + model-card YAML + two formatters), Agent, Workspace, and Examples. **No guide for tools.** "For other modules, please open an issue first so we can coordinate." Examples: `examples/` for feature demos; "For more complete, production-style applications, please contribute them to agentscope-samples". There is also an "AI-assisted contributions" section. |
| PR #2931 | https://github.com/agentscope-ai/agentscope/pull/2931 | ✅ | "feat(tool): add WebSearch and Python builtin tools", opened 2026-09-28, still **open**, not merged. The only comment is from the `github-actions` PR-guard bot: "This pull request does not close an issue. Please open one…". |
| Issue search | `repo:agentscope-ai/agentscope tavily OR exa OR firecrawl OR serpapi OR brave` | ✅ | Only DeepResearch example fixes (Tavily naming) and hub fixes. No vendor-tool intake issues. |
| `agentscope-samples` | https://github.com/agentscope-ai/agentscope-samples | ✅ (tree + `deep_research/agent_deep_research/main.py`) | Tavily via MCP: `StdIOStatefulClient(name="tavily_mcp", … args=["-y", "tavily-mcp@latest"], env={"TAVILY_API_KEY": os.getenv("TAVILY_API_KEY", "")})`. Pushed 2026-11-11. Note: this uses the 1.x-style `StdIOStatefulClient`; 2.x uses `MCPClient(...)`. |
| `agentscope-runtime` | https://github.com/agentscope-ai/agentscope-runtime | ✅ (tree) | `src/agentscope_runtime/adapters/agentscope/tool/{tool.py,sandbox_tool.py}`, cookbook `tools/modelstudio_search.md`. PyPI `agentscope-runtime` 1.1.6.post2. Last pushed 2026-06-04. |
| Runtime tools page (search result only) | https://runtime.agentscope.io/en/tools/tools.html | ⚠️ search snippet | Says ModelstudioSearch / ModelstudioSearchLite connect to AgentScope via `agentscope_tool_adapter`. Not opened directly. |
| `agentscope-bricks` | https://github.com/agentscope-ai/agentscope-bricks | ✅ | **Archived**, last pushed 2026-01-19. PyPI `agentscope-bricks` 0.1.2, author "Modelstudio Team". |
| `agentscope-datacircle` | https://github.com/waynehamadi/agentscope-datacircle · PyPI JSON | ✅ | PyPI 0.1.0 (no author metadata). hatchling, MIT, `requires-python >=3.10`, `dependencies = ["agentscope>=1.0.0"]`. `__init__` picks v1 or v2 code by the installed major version. v2: `DatacircleTool(ToolBase)` with `is_read_only = True`, `check_permissions` → `ALLOW`, `call` → `ToolChunk`, `ToolResultState.ERROR` on refusal. A `tools()` factory is used as `Toolkit(tools=agentscope_datacircle.tools())`. Shim comment: "AgentScope 2.0.0 calls a tool's __call__, later ones its call". |
| GitHub repo search | `agentscope tool in:name,description -org:agentscope-ai -org:modelscope` | ✅ | Mostly apps and dashboards. `agentscope-datacircle` is the only vendor-tool package. |
| PyPI JSON | `https://pypi.org/pypi/<name>/json` | ✅ | `agentscope` 2.0.12 (2026-11-16), `requires_python >=3.11`; 1.x last = 1.0.21 (2026-05-25); 2.0.0 = 2026-05-25. **404 (unclaimed):** `agentscope-diffbot`, `diffbot-agentscope`, `agentscope-{tavily,exa,firecrawl,serpapi,brightdata,jina,apify,composio,mem0,browserbase,e2b,studio,scrapegraph,oxylabs,zep,perplexity,bing,tools,tool,plugin,extensions,contrib,langchain}`, `{tavily,exa,firecrawl,brightdata,apify,composio,scrapegraph}-agentscope`. |
| Official MCP Registry | https://registry.modelcontextprotocol.io/v0/servers?search=diffbot | ✅ | `io.github.diffbot/diffbot-mcp` v0.2.1, "Web search, page extraction, crawling, and Knowledge Graph queries from Diffbot's web index."; PyPI stdio package `diffbot-mcp`; remote `streamable-http` `https://mcp.diffbot.com/mcp` with an optional `Authorization: Bearer {diffbot_token}` header. |
| GitHub MCP Registry | https://api.mcp.github.com/v0/servers?search=diffbot | ⚠️ inconclusive | The `search` parameter didn't filter (it returned the generic top 30 of 1,142). Whether `diffbot-mcp` is listed there is **unverified**. |
| Web search | "AgentScope integration third-party tool package…" | ✅ | Surfaced PR #2931, the runtime tools page, and Java PRs #4103 (built-in web tools opt-in) and #3242 (Parallel search). No vendor PyPI packages for Python AgentScope. |

## 2. Diffbot SDK facts (this checkout, `diffbot` 3.4.1)

- `pyproject.toml`: `version = "3.4.1"`, `requires-python = ">=3.9"`. LICENSE: MIT, "Copyright (c) 2023 Diffbot".
- `DiffbotAsync.__init__(self, token: str, …)`: `if not token: raise ValidationError("token is required")`. It does **not** call `resolve_token()`; the docstring example passes `token=os.getenv("DIFFBOT_API_TOKEN")`.
- `DiffbotAsync` methods: `close`, `request`, `extract` (default `api="analyze"`, `fmt="markdown"`), `ask(messages, *, response_format)` (async iterator of text), `ask_json(messages, schema, *, response_format)`, `crawl*`, `dql` (overloads), `dql_parallel`, ontology helpers, `web_search`, `account`, `verify_token`, `entities`, `nlp`.
- `grep -rni enhance src/diffbot` finds only `types.py:35` "DQL / Enhance-bulk export formats". **No Enhance wrapper**, which doesn't matter because Enhance is deferred.
- `resolve_token()` (`_auth.py`): explicit → `DIFFBOT_API_TOKEN` → `~/.diffbot/credentials`. Not used by the integration.
- User-Agent is hard-coded as `diffbot-python/<version>` (`client.py` lines 166 and 547).

## 3. Discrepancies against the task's starting notes

- The starting URL `doc.agentscope.io/tutorial/task_tool.html` serves the **v1.0** docs. The current 2.x docs are at `docs.agentscope.io`.
- The starting notes refer to `modelscope/agentscope`. The official repo is now `agentscope-ai/agentscope` (redirect).
- "Toolkit / ToolBase": confirmed for 2.x. `register_tool_function` is the v1 API.
- "MCP Hub, Skill Hub": both exist, but only in Agent Service, and only for MCP servers and `SKILL.md` skills respectively. Neither is a Python-tool gallery.

## 4. Things not verified (carry into the M1 spike)

- Whether `check_permissions → ALLOW` and `is_read_only=True` produce no prompt in DEFAULT mode on **every** 2.0.x from 2.0.3. The read-only fast path is absent at v2.0.3; `ALLOW` from `check_permissions` should cover that case, but it hasn't been run.
- Whether a shared, lazily created `DiffbotAsync` is safe across Agent Service requests (event-loop affinity of `httpx.AsyncClient`).
- Whether AgentScope ships a scripted or mock chat model for tests.
- How `ToolChunk.metadata` and long `TextBlock`s render in the console and web UI, and how the agent `offloader` treats large tool results.
- Whether streaming `ToolChunk`s (for Ask) render incrementally in the console and web UI.
- Whether `agentscope-runtime` adapters are compatible with `agentscope` 2.x. Not needed for the plan.
- Whether `diffbot-mcp` is in the GitHub MCP Registry (and so installable via `GitHubMCPHub`).
- Any policy on third-party use of the `agentscope-` PyPI prefix. None was found; the absence of a policy is not proof that the prefix is unrestricted.

## 5. Decisions log

| Date | Decision | Source / evidence |
| --- | --- | --- |
| 2026-12-02 | Org/Person Enhance deferred from v0.1 across integrations; ship 7 read-only operations. | Andrew, recorded in the Langflow plan. Reason: matches Jerome's 2026-11-17 view that Enhance is "bloat for the LLM" and Dify's scope; no SDK change needed. |
| 2026-12-03 | *(Proposed, pending Andrew)* Package `agentscope-diffbot`, Diffbot-owned, PyPI, stable 0.1.0 without RCs. | §5.3–§5.4 and §4.12 of the plan. |
Loading