Skip to content

Python API Reference

This reference is generated dynamically from the docstrings and type annotations in the Python source code using mkdocstrings.


Engine Entry Point

chakra_convai.app.run()

Start the service. Reads the LiveKit CLI command from sys.argv (start, dev, console, download-files …).

chakra_convai.core.bootstrap.init()


Skills & Prompts

chakra_convai.core.plugin_loader.BaseSkill

Base class for a client skill: a group of related tools.

get_flows()

Conversation flows handled by this skill (merged into the prompt).

get_instructions()

Tool name -> {"when_to_use": "..."} routing advice for the prompt.

get_tools()

Extra tools built at runtime (decorated methods are found automatically).

chakra_convai.core.prompt_loader.PromptLoader

Namespace class for loading module prompt configs from JSON files.

All loaded configs are cached in-process so the file is only read once per module per process lifetime.

get(module_name, *keys, default=None) staticmethod

Convenience helper for nested key access.

Example::

msg = PromptLoader.get("catch_data", "messages", "success",
                       default="Recorded.")

Parameters:

Name Type Description Default
module_name str

Module directory name.

required
*keys str

Sequence of nested dict keys.

()
default Any

Value returned when any key is missing.

None

Returns:

Type Description
Any

The value at the nested key path, or default.

load(module_name) staticmethod

Return the parsed prompts.json for module_name.

Parameters:

Name Type Description Default
module_name str

The subdirectory name under config/modules/, e.g. "fish_health", "weather".

required

Returns:

Type Description
dict[str, Any]

Parsed JSON as a plain Python dict. Returns {} if the file

dict[str, Any]

does not exist or contains invalid JSON.

chakra_convai.core.instructions.tool_description(name)

Function-calling description for a tool, sourced from instructions.json.

Only for tools that declare one here. Skill tools carry their description on the @llm.function_tool decorator instead, which is where the model already reads it from — see the rendering note in chakra_convai.llm.prompt.

chakra_convai.core.instructions.require_instr(*keys)

Strict lookup against the loaded INSTRUCTIONS config.


Multimodal & Web Sessions

chakra_convai.core.web_session.build_metadata(*, mode=None, language=None, user=None, context=None)

The room metadata (JSON) for a session, in the standard form. For an application backend in Python that creates the room or its token.


Integrations & Database

chakra_convai.integrations.database.get_db_pool()

The live asyncpg pool, or None when there is no database (or it is down).

For an application's own tables. Always call it at use time rather than keeping the result: the pool is created when the first call starts.


Utilities & Logging

chakra_convai.core.logging_setup.logger = logging.getLogger(settings.AGENT_NAME) module-attribute