Castia SDK map
Application code should stay small. Castia keeps the agent loop, protocols, local testing, evaluation, optimization, and deployment handoff on the same rail.
Shape of an app
Section titled “Shape of an app”from pathlib import Path
from castia import Agent, Depends, Model, Teams, configured_model, load_agent_config
app = Agent(name="my-agent")
def model() -> Model: config = load_agent_config(Path(__file__).parent / ".agent_configs") if not (config.instructions or "").strip(): raise RuntimeError("No baseline instructions loaded from .agent_configs.") return configured_model(config)()
@app.activity(Teams.direct, Teams.group, Teams.channel_mention)@app.responses()@app.invocations()async def reply(text: str, model: Model = Depends(model)) -> str: return await model.respond(text)
if __name__ == "__main__": app.run(host="0.0.0.0", port=8088)Use HOST=127.0.0.1 for local runs only. Hosted deployments need 0.0.0.0
so platform ingress can reach the process.
SDK pieces
Section titled “SDK pieces”The root package exposes the short public API (Agent, Router, Depends,
Model, Message, Teams, and related helpers). The SDK is split by what you
are trying to do.
| Area | What it is for |
|---|---|
protocols |
Activity wire models and protocol accessors. |
runtime |
Agent and router composition, dependency injection, turn context, and dispatch. |
hosting |
HTTP endpoints, local run policy, credentials, and agentic identity. |
messaging |
Teams surfaces, Activity routing, replies, cards, entities, invoke helpers, streaming, and connector support. |
inference |
Model calls and executable tool definitions. |
integrations |
Foundry toolbox adapters and Graph operations. |
building |
Scaffolding, readiness checks, and offline protocol testing. |
evaluation |
Evaluation suite configuration, rubric validation, and azd evaluation commands. |
observe |
Telemetry, tracing, execution records, queries, and drift checks. |
optimizing |
Candidate configuration, baseline generation, and optimizer jobs. |
finetuning |
RFT preparation, submission, and existing job management. |
lifecycle |
Snapshots, datasets, evidence, acceptance, and promotion records. |
delivery |
Manifest generation and guarded azd deployment. |
What is shipped
Section titled “What is shipped”| Surface | Status |
|---|---|
| Python SDK | Shipped. |
| Responses, Activity, and Invocations adapters | Shipped. |
| FastAPI-style dependency injection and routers | Shipped. |
| Local protocol test harness | Shipped. |
Baseline .agent_configs resolution |
Shipped through castia[optimize]. |
| Foundry toolbox MCP specs | Shipped for Responses API server-side MCP execution. |
| Evaluation suites, observation, optimizer handoff, lifecycle evidence | Shipped as guarded workflows. |
| SFT, DPO, and reinforcement fine-tuning helpers | Provisional wire acceptance; check before submit. |
| Rust SDK and Typra generation | Experimental, unpublished; contracts and portable parity tests are in this repo. |
| Prompty integration, managed agent memory | Not shipped. |