Skip to main content

Agent application with multi-endpoint support for the k agent framework

Project description

kcastle

PyPI

Agent application with multi-endpoint support for the K agent framework.

kcastle is a general-purpose agent application built on kagent. It provides a unified agent runtime accessible from multiple endpoints — each endpoint connects to the same agent instance and shares conversation history via kagent.Trace.

Architecture

┌─────────────────────────────────────────────┐
│  kcastle                                    │
│                                             │
│  ┌──────────┐ ┌──────────┐ ┌──────────┐    │
│  │ CLI      │ │ Telegram │ │ Discord  │    │
│  │ Endpoint │ │ Endpoint │ │ Endpoint │    │
│  └────┬─────┘ └────┬─────┘ └────┬─────┘    │
│       │             │            │          │
│       └──────┬──────┴────────────┘          │
│              │                              │
│       ┌──────▼──────┐                       │
│       │ kagent.Agent│ ◄── EventBus (SPMC)   │
│       │ + Trace     │                       │
│       └──────┬──────┘                       │
│              │                              │
│       ┌──────▼──────┐                       │
│       │  TraceStore │ (persistence)         │
│       └─────────────┘                       │
└─────────────────────────────────────────────┘

Endpoints

Each endpoint is an adapter that:

  1. Receives user input from its platform (terminal, Telegram, Discord, etc.)
  2. Sends commands to the shared Agent instance (run(), steer(), abort())
  3. Subscribes to the Agent's event stream and renders output for its platform

Shared State

All endpoints share the same Agent instance and its Trace. This means:

  • Conversation history is unified across all endpoints
  • A message sent via Telegram is visible when resuming from the CLI
  • Pause/resume works by persisting the Trace via TraceStore and reconstructing the Agent

What kcastle owns

  • Endpoint adapters — CLI, Telegram, Discord (and future endpoints)
  • Provider factory/registry — provider-id-to-constructor mapping policy (kcastle.provider_factory)
  • PersistenceTraceStore configuration and session management
  • Tool registration — Domain-specific tools for the agent
  • Configuration — Agent setup, system prompts, model selection
  • UI/rendering — Platform-specific output formatting

What kcastle does NOT own

These live in lower layers:

  • Agent runtimekagent (agent loop, state, events, context builders)
  • LLM abstractionkai (providers, streaming, tool schemas)

Configuration

kcastle uses explicit provider profiles. The default runtime selection is a provider + model pair:

default:
	provider: deepseek-openai
	model: deepseek-chat

You can override built-in providers by redefining the same provider key:

providers:
	deepseek-openai:
		api_key: ${DEEPSEEK_API_KEY}
		base_url: https://api.deepseek.com
		models:
			deepseek-chat:
				active: true
			deepseek-reasoner:
				active: true

Project details


Download files

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

Source Distribution

kcastle-0.0.1a0.tar.gz (48.0 kB view details)

Uploaded Source

Built Distribution

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

kcastle-0.0.1a0-py3-none-any.whl (63.9 kB view details)

Uploaded Python 3

File details

Details for the file kcastle-0.0.1a0.tar.gz.

File metadata

  • Download URL: kcastle-0.0.1a0.tar.gz
  • Upload date:
  • Size: 48.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kcastle-0.0.1a0.tar.gz
Algorithm Hash digest
SHA256 f4a70928bb549659ce5a5103fa790d407091e5ed8ea5d97b25dc84133003b544
MD5 b05ebbb588123076fdcb9ccf96727bc2
BLAKE2b-256 841c7004142200c4730e6525f8ce5b7fe4caf3d7744d9e6c02e151a127cc7dcf

See more details on using hashes here.

Provenance

The following attestation bundles were made for kcastle-0.0.1a0.tar.gz:

Publisher: release.yml on shenxiangzhuang/kcastle

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kcastle-0.0.1a0-py3-none-any.whl.

File metadata

  • Download URL: kcastle-0.0.1a0-py3-none-any.whl
  • Upload date:
  • Size: 63.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kcastle-0.0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 948e1da40c27e6768e410a71ab902b8c4529790def5f8b9d0e1a6a1ffd881c63
MD5 c6069b0a03afe63d4cbf2679d338773e
BLAKE2b-256 6ec3ef781aaaf4399496b120e8ce9a1864c347fce8af780bea8864d4ff95cbea

See more details on using hashes here.

Provenance

The following attestation bundles were made for kcastle-0.0.1a0-py3-none-any.whl:

Publisher: release.yml on shenxiangzhuang/kcastle

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page