Guide for AI coding agents
Ground generated code in the framework, verify behavior, and integrate external work safely.
Learn the actual framework first
This is a guide for coding agents building JanelKit applications, not a native AI or LLM SDK. Start with the project README, docs/api.md, docs/lenguaje.md, and docs/estilos.md. Check the installed version and its migration notes before borrowing examples. Generate Python expressions, not JavaScript; use .value in scripts, direct state names in templates, a single template root, explicit props and events, and stable keys for changing lists. Keep services in ordinary Python modules so they can be reviewed and tested separately.
For JanelKit 0.2, write built-in elements in lowercase (<text>, <button>, <column>) and imported components with a capital letter. Import navigation from janelkit_router (pages, sections, navigation, Pages, Sections), stores and persisted from janelkit_store, dialogs and clipboard from janelkit_desktop, and t and i18n from janelkit_i18n; never from janelkit. History and notify no longer exist. The plain-text index of this site is /llms.txt, and the whole documentation is /llms-full.txt.
Respect the public contract
Use the exports documented in docs/api.md. Do not import runtime internals, depend on generated QML, or assume private compiler structures are stable. Treat requested APIs as unverified until found in the versioned documentation. Distinguish implemented ecosystem packages from proposals. Never run untrusted .janel scripts as if they were harmless markup: they execute Python with application privileges. Keep credentials in application-managed configuration rather than component examples.
Integrate an external service as ordinary async work
An external model or network service is an application dependency, not a built-in JanelKit feature. For an asynchronous client, await the application service directly from an async handler or task. For a synchronous client, put the call behind background and return plain data. The snippet below is an integration skeleton: services.assistant.generate_reply is an application-owned synchronous function you must implement using your chosen provider. It is not supplied by JanelKit. Render loading and error states, and do not assume canceling the UI task stops a provider request or worker thread.
from janelkit import state, task, background
from services.assistant import generate_reply # Implement in your application.
prompt = state("")
@task
async def reply(text):
return await background(generate_reply, text)
def send():
text = prompt.value.strip()
if text:
reply.run(text)
# Template wiring:
# <textfield bind:value={prompt} on:submit={send} label="Prompt" />
# <button on:click={send} enabled={not reply.loading}>Send</button>
# Render reply.loading, reply.error, and reply.value explicitly.CopyVerify generated work and disclose limits
Run janel build for compilation checks, then test user-visible behavior with janelkit.inspect and application tests. Include successful results, empty input, failure, repeated submissions, and component unmount during a request. For streaming services, keep state updates on the UI loop and batch updates rather than creating a new control for every token. Show untrusted output as plain text or with format="markdown", which does not interpret HTML; never with format="html". Report what you actually executed and what remains untested, especially alpha APIs and platform-specific packaging.
janel build
python -m pytest
# Inspect generated output only when diagnosing a compilation issue:
janel compile src/App.janelCopyEnglish documentation based on the JanelKit source. For additional details, browse the source docs ↗.