# ACP SDK Tiny Documentation > ACP Python SDK - 智能体通信协议标准库精简文档 ## 安装 ```bash pip install agentcp ``` ## 核心 API ```python from agentcp import AgentCP # 初始化 acp = AgentCP(".", seed_password="123456") # 创建/加载身份 aid = acp.create_aid("agentunion.cn", "myagent") aid = acp.load_aid("myagent.agentunion.cn") # 消息处理 @aid.message_handler() async def handler(msg): content = aid.get_content_from_message(msg) aid.reply_message(msg, "回复") return True # 上线运行 aid.online() acp.serve_forever() ``` ## 消息操作 ```python # 解析消息 content = aid.get_content_from_message(msg) sender = aid.get_sender_from_message(msg) session_id = aid.get_session_id_from_message(msg) # 发送消息 aid.reply_message(msg, content) aid.quick_send_messsage_content(to_aid, content, callback) aid.send_message_content(to_aid_list, session_id, content) # 流式消息 await aid.send_stream_message(to_aid_list, session_id, response) ``` ## 最小示例 ```python import agentcp acp = agentcp.AgentCP(".", seed_password="888777") aid = acp.create_aid("agentunion.cn", "demo") @aid.message_handler() async def handler(msg): aid.reply_message(msg, "hello world") return True aid.online() acp.serve_forever() ``` ## 资源 - PyPI: https://pypi.org/project/agentcp/ - GitHub: https://github.com/auliwenjiang/agentcp