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.3.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.3.0a1
File Size Uploaded
kaiwen_agent-0.3.0a1.tar.gz 44.1 kB Details

Built distribution (wheel)

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

Total release size: 98.6 kB

Release files / kaiwen_agent-0.3.0a1.tar.gz

Download URL kaiwen_agent-0.3.0a1.tar.gz
Size 44.1 kB
Tags Source
SHA-256 checksum
How to use checksums
000d87b2a08ed2b3ed43c291cfaf4758ba9b1d7b6e4906c80cd68a5c73e8bf4d
BLAKE2b-256 checksum
How to use checksums
51ff0654c6988d4c449bbff053fa3910156cb2f2e515c8746d88491096c3d3f0
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 18, 2026.

Transparency log

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

Download URL kaiwen_agent-0.3.0a1-py3-none-any.whl
Size 54.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4fff36d73014a6269b15353ec61f69f8900ef9539e3b9ce6976c5a940f411232
BLAKE2b-256 checksum
How to use checksums
4330f7bc9756fb120a229232fb2739181c4bd9c7de07600dae045e9579a76fc1
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 18, 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