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

OpenTelemetry hooks are disabled by default. Set OTEL_EXPORTER_OTLP_ENDPOINT (e.g. http://localhost:4317) to enable trace export.

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.1a1.tar.gz (50.7 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.1a1-py3-none-any.whl (67.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kcastle-0.0.1a1.tar.gz
  • Upload date:
  • Size: 50.7 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.1a1.tar.gz
Algorithm Hash digest
SHA256 b90409fcf333df743ce079920d06e2a7a790f9558a5307ceb4a5847e27807973
MD5 5a9ae024e1e18d3d9e10b78617eada70
BLAKE2b-256 65e4dc713601c37d2ed58c3de5713bd1235f8ea317f99c528baa23dff6444d59

See more details on using hashes here.

Provenance

The following attestation bundles were made for kcastle-0.0.1a1.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.1a1-py3-none-any.whl.

File metadata

  • Download URL: kcastle-0.0.1a1-py3-none-any.whl
  • Upload date:
  • Size: 67.4 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.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 b8f55abbe2917ceed663202dc8e6f50a67fc802e392c0f26991fc2a8d4f90940
MD5 9e96ac796ba8df81314a7103adaf6ffc
BLAKE2b-256 8e82992835025a800acf720194403d27d3eb9ec14b8324ea8bb9b2cbcd4f29ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for kcastle-0.0.1a1-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