Agent application with multi-endpoint support for the k agent framework
Project description
kcastle
kcastle also provides a short k command alias, so you can start the agent with either kcastle or k.
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:
- Receives user input from its platform (terminal, Telegram, Discord, etc.)
- Sends commands to the shared
Agentinstance (run(),steer(),abort()) - 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
TraceviaTraceStoreand reconstructing theAgent
What kcastle owns
- Endpoint adapters — CLI, Telegram, Discord (and future endpoints)
- Provider factory/registry — provider-id-to-constructor mapping policy (
kcastle.provider_factory) - Persistence —
TraceStoreconfiguration 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 runtime —
kagent(agent loop, state, events, context builders) - LLM abstraction —
kai(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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kcastle-0.0.1a2.tar.gz.
File metadata
- Download URL: kcastle-0.0.1a2.tar.gz
- Upload date:
- Size: 52.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c950b4137d694a65f18426203c3bb99fb317a9af6a888aae30241cf701725306
|
|
| MD5 |
0dfefce03149dd2b2078cee30d67ca44
|
|
| BLAKE2b-256 |
ddfbf45ca0b244a82a439f94f53c51d53ed4bf014c65e931b6b6086faf9fa1fe
|
Provenance
The following attestation bundles were made for kcastle-0.0.1a2.tar.gz:
Publisher:
release.yml on shenxiangzhuang/kcastle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kcastle-0.0.1a2.tar.gz -
Subject digest:
c950b4137d694a65f18426203c3bb99fb317a9af6a888aae30241cf701725306 - Sigstore transparency entry: 1183048843
- Sigstore integration time:
-
Permalink:
shenxiangzhuang/kcastle@b06efe81823098fa16b6388a351240ef50be484c -
Branch / Tag:
refs/tags/v0.0.1a2 - Owner: https://github.com/shenxiangzhuang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b06efe81823098fa16b6388a351240ef50be484c -
Trigger Event:
release
-
Statement type:
File details
Details for the file kcastle-0.0.1a2-py3-none-any.whl.
File metadata
- Download URL: kcastle-0.0.1a2-py3-none-any.whl
- Upload date:
- Size: 69.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3cc607239aebe1ceb218eafd40ad0456c28b1e4a0a0e6682819310ff7ff2bfe
|
|
| MD5 |
992a588fb841beb64c4fe6df01701ea3
|
|
| BLAKE2b-256 |
cde9a8b1a00a4cb78c11c84156afec2da121e73dbe02324c0abc500fe8283248
|
Provenance
The following attestation bundles were made for kcastle-0.0.1a2-py3-none-any.whl:
Publisher:
release.yml on shenxiangzhuang/kcastle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kcastle-0.0.1a2-py3-none-any.whl -
Subject digest:
b3cc607239aebe1ceb218eafd40ad0456c28b1e4a0a0e6682819310ff7ff2bfe - Sigstore transparency entry: 1183048883
- Sigstore integration time:
-
Permalink:
shenxiangzhuang/kcastle@b06efe81823098fa16b6388a351240ef50be484c -
Branch / Tag:
refs/tags/v0.0.1a2 - Owner: https://github.com/shenxiangzhuang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b06efe81823098fa16b6388a351240ef50be484c -
Trigger Event:
release
-
Statement type: