作者回复: Agent SDK 的 Skills 走的是文件系统路径,而不是配置字段。 详细示例https://code.claude.com/docs/en/agent-sdk/skills -------------复制网页中的示例 要将 Skills 与 SDK 结合使用需要: "Skill"请在allowed_tools配置中包含以下内容 配置settingSources/setting_sources从文件系统加载技能 配置完成后,Claude 会自动从指定的目录中发现技能,并在与用户请求相关时调用这些技能。 import asyncio from claude_agent_sdk import query, ClaudeAgentOptions async def main(): options = ClaudeAgentOptions( cwd="/path/to/project", # Project with .claude/skills/ setting_sources=["user", "project"], # Load Skills from filesystem allowed_tools=["Skill", "Read", "Write", "Bash"], # Enable Skill tool ) async for message in query( prompt="Help me process this PDF document", options=options ): print(message) asyncio.run(main())
作者回复: 原生的不支持,但是总有其它方法。比如 https://docs.litellm.ai/docs/tutorials/claude_agent_sdk Claude Agent SDK with LiteLLM Use Anthropic's Claude Agent SDK with any LLM provider through LiteLLM Proxy.
作者回复: 有啊https://opencode.ai/docs/sdk/ opencode JS/TS SDK 提供了一个类型安全的客户端,用于与服务器进行交互。 你可以用它来构建集成方案,并以编程方式控制 opencode。 一般都有,包括DiFY, Coze, 都有编程接口。