Skip to main content

Reusable ADK-based agent infrastructure — plugin loader, background workflow engine, FastAPI server, memory service.

Project description

kaze-agent-base

Reusable ADK-based agent infrastructure — plugin loader, background workflow engine, FastAPI server, memory service, LLM wrapper with trace propagation.

Extracted from kaze-agent-ops so other agents can be built on the same framework.

Install

pip install kaze-agent-base
# Optional extras:
pip install "kaze-agent-base[memory]"    # Mem0 + pgvector
pip install "kaze-agent-base[tracing]"   # Langfuse callbacks

Build your own agent

Your agent package owns:

  • plugin.yaml + tools.py files under my_agent/plugins/<name>/
  • config.yaml listing models and specialists
  • A package __init__.py that builds the workflow
  • An entrypoint script that calls create_app(...)

Directory layout

my_agent/
  pyproject.toml              # depends on kaze-agent-base
  config.yaml                 # model tiers, specialists
  my_agent/
    __init__.py               # builds workflow, exposes _workflow_*
    serve.py                  # calls create_app(...)
    plugins/
      root/plugin.yaml + prompt.md
      <specialist>/plugin.yaml + tools.py [+ workflows/]

my_agent/__init__.py

from pathlib import Path

from kaze.agent_base.workflow.graph import build_workflow

_PKG_ROOT = Path(__file__).parent

_workflow, _agents = build_workflow(
    config_path=_PKG_ROOT.parent / "config.yaml",
    plugins_root=_PKG_ROOT / "plugins",
    plugins_package="my_agent.plugins",
    workflow_name="my_agent",
    workflow_description="My agent — short tagline",
)

_workflow_agents = _agents
_workflow_config = _workflow._kaze_config
_workflow_mcp_toolsets = _workflow._kaze_mcp_toolsets

root_agent = _workflow
__all__ = ["root_agent"]

my_agent/serve.py

from pathlib import Path

from kaze.agent_base import create_app
from kaze.agent_base.server import run


def main():
    app, host, port = create_app(
        app_module="my_agent",
        agents_dir=Path(__file__).resolve().parents[1],
        title="My Agent API",
        description="…",
        version="0.1.0",
    )
    run(app, host, port)


if __name__ == "__main__":
    main()

Wire up a [project.scripts] entry (e.g., my-agent-serve = "my_agent.serve:main") and you have a deployable agent.

Environment variables

Var Purpose Default
KAZE_GATEWAY_URL / _API_KEY LLM gateway endpoint http://localhost:4200
KAZE_CONFIG_PATH Path to config.yaml ./config.yaml
KAZE_PLUGINS_ROOT / KAZE_PLUGINS_PACKAGE Plugin location (required; pass args or env)
KAZE_APP_NAME ADK app name kaze_app
KAZE_DATA_DIR SQLite location .adk/
KAZE_A2A_HOST / KAZE_A2A_PORT Server bind 0.0.0.0:8080
KAZE_MEM0_* Mem0 config (see state/memory.py)
LANGFUSE_* Tracing (optional)
AGENT_API_KEY Bearer token for /api/v1/*

The KAZE_ prefix is historical; downstream agents can use the same prefix or layer on their own env vars.

Public API

from kaze.agent_base import (
    acompletion,           # LLM call with trace linkage
    set_trace_id,
    reset_trace_id,
    ToolAgent,             # ADK BaseAgent that runs a tool in a thread
    get_engine,            # background WorkflowEngine singleton
    spill,                 # persist large outputs to disk
    discover_plugins,
    get_workflow_templates,
    get_tool_registry,
    resolve_tools,
    create_app,            # FastAPI factory
)

Layout

src/kaze/agent_base/
  config.py                  load_config(path)
  models.py                  LiteLlm factory (gateway-routed)
  llm.py                     acompletion + trace propagation
  plugin.py                  discover_plugins(plugins_root, plugins_package)
  tool_registry.py           framework:* + <plugin>:* namespaces
  tools/                     background, memory, notify, system, code, bash, fs, artifacts
  jobs/                      engine, store, tool_agent (background workflows)
  state/                     memory (mem0), config_store, sessions, services
  server/                    app (create_app, run), routes, schemas
  workflow/                  graph, agents, callbacks, mcp

License

Apache-2.0

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

kaze_agent_base-0.1.0.tar.gz (46.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kaze_agent_base-0.1.0-py3-none-any.whl (51.2 kB view details)

Uploaded Python 3

File details

Details for the file kaze_agent_base-0.1.0.tar.gz.

File metadata

  • Download URL: kaze_agent_base-0.1.0.tar.gz
  • Upload date:
  • Size: 46.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kaze_agent_base-0.1.0.tar.gz
Algorithm Hash digest
SHA256 90e55d0abc3d1336f612d1db2b8d10c8a8aad66d23ff69826c65262881c338f8
MD5 a699c5ccc35b80d4c10116ef1bc9621c
BLAKE2b-256 6c9c9b91acbae6612f33e0de1c107dd253661e579de409e18de13827aef4a336

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaze_agent_base-0.1.0.tar.gz:

Publisher: publish.yml on speedrun-labs/kaze-agent-base

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kaze_agent_base-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kaze_agent_base-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 51.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kaze_agent_base-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e05d10108d2467dbe3fff7a2151317ea708092a1cf6a9b13713303628436875
MD5 a3edc0affde2b355afd68d3d6256cd40
BLAKE2b-256 07765e80ac995e65f25ff42ef59efdbc0c2db53ead234613473facbcc5d850bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaze_agent_base-0.1.0-py3-none-any.whl:

Publisher: publish.yml on speedrun-labs/kaze-agent-base

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