Skip to main content

tabapp-agent-sdk

Python Agent SDK。给小抄这类 Python Host 调 Tab。浏览器不要用这个包,Web Composer 是 @tabapp/agent-sdk/composer。

形状对齐 Cursor Agent SDK:Agent → Run。控制面是 Tab。底层协议(Open API + A2A)都封装在里面,Host 不要再手写 HTTP。

from tabapp_agent_sdk import Agent, Tab, AgentSdkError

tab = Tab("https://www.xtabapp.com", api_key=tak, user_jwt=jwt)
experts = await tab.experts.list()
hook = await tab.hooks.create(expert_id, name="xiaochao", source="xiaochao")

async with await Agent.connect(
    base_url="https://www.xtabapp.com",
    expert_id=expert_id,
    hook_url=hook["hook_url"],
    hook_token=hook["token"],
    a2a_url=hook["a2a_url"],
    signing_secret=hook.get("signing_secret"),
) as agent:
    run = await agent.send(
        "请校对这篇稿",
        event="draft.review",
        payload={"draft_id": "d_1", "account_id": "sp_1"},
        callback_url="https://weixin.xtabapp.com/api/agent-runs/callback",
        thread_key="account:sp_1",
        idempotency_key="xiaochao:draft:d_1:v2",
    )
    async for event in run.stream():
        print(event.state, event.message, event.tool)
    result = await run.wait()
    if result.status == "error":
        raise SystemExit(2)

Agent.create 是 connect 的别名:Tab Open API 还不能创建专家,连接的是已有专家 + Hook。

Agent.prompt(...) 是一次性:connect → send → wait → close。

Agent.resume(task_id, ...) 挂回已有任务,返回 Run。

Run.stream / Run.wait 会在 Tab 约 15 秒断开后自动重订,直到终态、input-required / auth-required,或 max_seconds。单次 tasks/subscribe 仍可通过 AgentClient.subscribe_task 拿到。

和 Cursor SDK 的对应

Cursor Tab
Agent.create Agent.connect / Agent.create(绑已有专家)
Agent.resume Agent.resume(task_id, …)
Agent.prompt Agent.prompt
agent.send agent.send / agent.trigger
run.stream / run.wait 同名;内部消化 15 秒 SSE
run.cancel run.cancel
result.status == "error" 任务已执行后失败
CursorAgentError AgentSdkError(没跑起来:鉴权 / 网络)
Cursor.models Tab.keys / Tab.experts / Tab.hooks

创建、发布、部署专家仍未进入 Open API:tab.experts.create|publish|deploy 会抛 unimplemented。

控制面

await tab.keys.create(label="xiaochao")
await tab.keys.list()
await tab.keys.rotate(key_id)
await tab.keys.revoke(key_id)

await tab.experts.list()
await tab.experts.get(agent_id)
await tab.experts.agent_card(agent_id)

await tab.hooks.create(agent_id, name="xiaochao", continuity_mode="thread")
await tab.hooks.list(agent_id)
await tab.hooks.get(hook_id)
await tab.hooks.update(hook_id, {"enabled": False})
await tab.hooks.rotate(hook_id)
await tab.hooks.deliveries(hook_id)
await tab.hooks.delete(hook_id)

A2A

任务操作走 A2A。只读工单页用 share token:

async for frame in tab.embed.subscribe(share_token):
    ...
await tab.embed.answer(share_token, "改标题")

回调验签:

from tabapp_agent_sdk import verify_callback

if not verify_callback(signing_secret, raw_body, signature, timestamp):
    raise AgentSdkError("tab_unauthorized", "回调签名无效。", 401)

小抄现有调用

AgentClient 保留原来的方法签名(create_key / list_experts / trigger / subscribe_task …),内部走同一套协议实现。新代码请改用 Tab + Agent。

Metadata

Release files for tabapp-agent-sdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tabapp-agent-sdk 0.1.0
File Size Uploaded Provenance Actions
tabapp_agent_sdk-0.1.0.tar.gz 21.8 kB Without provenance Details for tabapp_agent_sdk-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tabapp-agent-sdk 0.1.0
File Interpreter ABI Platform Actions
tabapp_agent_sdk-0.1.0-py3-none-any.whl Python 3 none any Details for tabapp_agent_sdk-0.1.0-py3-none-any.whl

Total release size: 41.1 kB

Release files / tabapp_agent_sdk-0.1.0.tar.gz

Download URL tabapp_agent_sdk-0.1.0.tar.gz
Size 21.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1aac73e467718f29290b997b0a9d2e1626621ff71fea26ec933d7bab81aeedc4
BLAKE2b-256 checksum
How to use checksums
e3979e07966adac134b92bb201a745b79b1d733eb3ee1fa29bc946010a0f6e41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.11

Release files / tabapp_agent_sdk-0.1.0-py3-none-any.whl

Download URL tabapp_agent_sdk-0.1.0-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1c19dbd48797a4885a49e9e19c56614b4396e6b8bbb25a7c671237dd1bd4eb9
BLAKE2b-256 checksum
How to use checksums
fcb7440eae2bd2954af086137c9a74d0d2bff5d991ac1ef35f4ccea2173dce96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.11

Security for tabapp-agent-sdk 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page