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]"

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.

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.1.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.1.0a1
File Size Uploaded
kaiwen_agent-0.1.0a1.tar.gz 25.4 kB Details

Built distribution (wheel)

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

Total release size: 59.3 kB

Release files / kaiwen_agent-0.1.0a1.tar.gz

Download URL kaiwen_agent-0.1.0a1.tar.gz
Size 25.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8338c3881e5b9870971379be14618f5a257960ac3913fc1c789f3d63ad2905d5
BLAKE2b-256 checksum
How to use checksums
8c35784a400bc24045715c5e4c37c66a1a13934ea79d309fecf270927cec1f9b
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 17, 2026.

Transparency log

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

Download URL kaiwen_agent-0.1.0a1-py3-none-any.whl
Size 33.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bbb3fd14279a958467e365136eac98cdaab0740d6ea8f5bd94bccc0e34f85c09
BLAKE2b-256 checksum
How to use checksums
d277271ea77a65de00906970527d5dc17ec6ec563171e491d32ed89fa93203f6
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 17, 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