chore: initial commit

This commit is contained in:
你的用户名
2025-11-01 21:58:31 +08:00
commit 0406b5664f
101 changed files with 20458 additions and 0 deletions

29
test_agent_response.py Normal file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env python3
import asyncio
import os
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions
async def test_agent():
# 设置环境
os.environ['ANTHROPIC_API_KEY'] = os.environ.get('ANTHROPIC_AUTH_TOKEN', '')
# 配置选项
options = ClaudeAgentOptions(
system_prompt="你是一个友好的助手,请用中文回复。"
)
# 测试对话
async with ClaudeSDKClient(options=options) as client:
print('发送查询...')
await client.query('你好1+1等于几请简短回复。')
print('接收响应...')
full_response = []
async for message in client.receive_response():
print(f'收到: {message}')
full_response.append(str(message))
print(f'\n完整响应: {"".join(full_response)}')
if __name__ == '__main__':
asyncio.run(test_agent())