Skip to main content

Sema Python SDK

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

安装

pip install sema-core

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

快速开始

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())

模型配置与更多用法见 文档,完整示例见 example/python-demo(交互式 CLI 与一次性执行)。

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sema_core-2.1.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sema_core-2.1.0-py3-none-any.whl (1.2 MB view details)

Uploaded Python 3

File details

Details for the file sema_core-2.1.0.tar.gz.

File metadata

  • Download URL: sema_core-2.1.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for sema_core-2.1.0.tar.gz
Algorithm Hash digest
SHA256 83d495912a018be6a30c83f7e0f37c829aa3bee5999a6139c387f276adf4f9ad
MD5 b84798e5be3b0cd75c55e2e174ea2e47
BLAKE2b-256 48dd00e63de511ff264dd5aff6ab5cdbe96ef13c7997a02a5700ff2cfd255f0a

See more details on using hashes here.

File details

Details for the file sema_core-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: sema_core-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for sema_core-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68841f61f321d2efcb69c277bad4451c5f8a7568a050bb4dc93409869f2d75a7
MD5 491941dfbc834a4205a7a0ddba5b99f8
BLAKE2b-256 9efc16196818f6080297e17235078bca4bca7fc6367f9c50b18f09a3da2366a6

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 files

2.0.16

2 files

2.0.15

2 files

2.0.14

2 files

2.0.13

2 files

2.0.12

2 files

2.0.11

2 files

2.0.10

2 files

2.0.9

2 files

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