Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

kaiwen-agent

Provider-neutral, asynchronous Python runtime for building tool-using agents. Product applications own their prompts, domain tools, authorization context, persistence choice, and HTTP surface.

pip install "kaiwen-agent[openai]"

For OpenAI Live primary WebSocket support:

pip install "kaiwen-agent[openai-live]"

Minimal agent

import asyncio

from pydantic import BaseModel

from kaiwen_agent import Agent, AgentContext, tool
from kaiwen_agent.models.openai import OpenAIResponsesProvider
from kaiwen_agent.types import AgentInput


class ProjectQuery(BaseModel):
    category: str | None = None


@tool(
    name="projects.read",
    description="List projects visible to the current user",
    input_model=ProjectQuery,
    permissions={"projects.read"},
)
async def read_projects(
    context: AgentContext,
    query: ProjectQuery,
) -> list[dict[str, str]]:
    repository = context.services["projects"]
    return await repository.list(category=query.category)


async def main() -> None:
    agent = Agent(
        name="portfolio",
        model=OpenAIResponsesProvider(
            model="your-model-id",
            instructions="Help visitors discover relevant products.",
            store=False,
        ),
        tools=[read_projects],
        permissions={"projects.read"},
    )
    result = await agent.run(
        AgentInput(text="Show me the games"),
        context=AgentContext(
            session_id="session-id",
            permissions=frozenset({"projects.read"}),
            services={"projects": your_repository},
        ),
    )
    print(result.text)


asyncio.run(main())

OPENAI_API_KEY is read by the OpenAI SDK from the server environment. The runtime never stores it and it must never be exposed to browser code.

Runtime capabilities

  • Provider-neutral async agent loop and deterministic fake provider.
  • Typed Pydantic tool inputs and deny-by-default permission intersection.
  • Approval, idempotency, timeout, and retry handling for side effects.
  • Session, run, event, and audit ports with a SQLite reference adapter.
  • SSE event fan-out and trace propagation.
  • Durable task graphs, workers, checkpoints, mailbox control, resource locks, cancellation, and bounded concurrency.
  • Optional OpenAI Responses API adapter.
  • Provider-neutral Realtime sessions, OpenAI Live/WebRTC adapters, durable text-and-voice conversations, and allowlisted background task delegation.
  • Trusted OpenAI Live sideband execution through the same permission, approval, idempotency, and audit pipeline used by text agents.

Realtime usage and integration boundaries are documented in the repository's docs/realtime.md, docs/openai-live.md, and docs/conversation-bridge.md files.

Side effects

Tools marked reversible or destructive receive a runtime idempotency key. Set requires_approval=True and supply an application-owned ApprovalGate for publishing, deleting, deploying, calling, or sending messages. Applications must still perform authorization inside their own service boundary.

Coding-agent handoff

When asking another coding agent to integrate this package, provide the root repository files AGENTS.md and docs/consumer-agent-brief.md. The complete, provider-free example is in examples/basic-agent.

Metadata

Release files for kaiwen-agent 0.4.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kaiwen-agent 0.4.0a1
File Size Uploaded
kaiwen_agent-0.4.0a1.tar.gz 50.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kaiwen-agent 0.4.0a1
File Interpreter ABI Platform
kaiwen_agent-0.4.0a1-py3-none-any.whl Python 3 none any Details

Total release size: 111.0 kB

Release files / kaiwen_agent-0.4.0a1.tar.gz

Download URL kaiwen_agent-0.4.0a1.tar.gz
Size 50.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c692fb7072cb6f3faa51de4482c4566fd4f9b0971b3167a8e861790ff1cdd888
BLAKE2b-256 checksum
How to use checksums
a49aa78c2c0602ec7661146174f1ea40b2cefe47bbedf0b35348758b1609395b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release files / kaiwen_agent-0.4.0a1-py3-none-any.whl

Download URL kaiwen_agent-0.4.0a1-py3-none-any.whl
Size 61.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
507d2fede2e8ac883b47bdede55da97a100bba2c1fa97b7b686bef8d86e4e5e4
BLAKE2b-256 checksum
How to use checksums
3a70ba8d4861ddddbd23b61e29ac2a218a55a0d26390728c09e47a2bf00239bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log
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