Metadata-Version: 2.4
Name: sema-core
Version: 2.0.10
Summary: Python SDK for sema-core: thin client over the sema-grpc bridge
Author: SemaCode
License-Expression: MIT
Project-URL: Homepage, https://midea-ai.github.io/sema-code-core
Project-URL: Documentation, https://midea-ai.github.io/sema-code-core
Project-URL: Repository, https://github.com/midea-ai/sema-code-core
Project-URL: Issues, https://github.com/midea-ai/sema-code-core/issues
Keywords: sema-core,ai,agent,sdk,grpc
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: grpcio>=1.60
Requires-Dist: protobuf>=4.25
Provides-Extra: dev
Requires-Dist: grpcio-tools>=1.60; extra == "dev"
Dynamic: license-file

# Sema Python SDK

[Sema Code Core](https://github.com/midea-ai/sema-code-core) 的官方 Python SDK：一个事件驱动的 AI 编程助手核心引擎,支持多代理协作、Skill 扩展、Plan 模式任务规划等能力。SDK 内嵌 core 运行时(sidecar),`pip install` 后开箱即用,asyncio-first。

## 安装

```bash
pip install sema-core
```

要求:Python 3.10+,本机 Node.js ≥ 18(core 运行时依赖)。

## 快速开始

```python
import asyncio
from sema_core import SemaCore

async def main():
    core = await SemaCore.start({"workingDir": "/path/to/your/project"})
    session = await core.create_session()
    session.on("message:text:chunk", lambda d: print(d["delta"], end="", flush=True))

    done = asyncio.Event()
    session.on("state:update", lambda d: done.set() if (d or {}).get("state") == "idle" else None)

    await session.process_user_input("你好")
    await done.wait()          # 等回复完成再关
    await core.close()

asyncio.run(main())
```

模型配置与更多用法见 [文档](https://midea-ai.github.io/sema-code-core),完整示例见 [example/python-demo](https://github.com/midea-ai/sema-code-core/tree/main/example/python-demo)(交互式 CLI 与一次性执行)。

## License

[MIT](https://github.com/midea-ai/sema-code-core/blob/main/LICENSE)
