Skip to main content

Ghemud AgentKit

A secure, provider-agnostic runtime for AI agents to discover and execute tools — with explicit permissions, budgets, retries, approvals, and a tamper-evident audit trail.

Created and maintained by Yashraj Sachin Ghemud, Ghemud AgentKit is the runtime boundary between an AI agent decision and a real-world side effect. It validates model output as untrusted input, checks capabilities before execution, and records an observable, bounded, auditable invocation lifecycle.

Built for Python developers who need secure AI-agent tool execution. Ghemud AgentKit brings permissions, approvals, budgets, retries, redaction, and auditability into a provider-agnostic runtime.

from ghemud_agentkit import ToolRegistry, ToolRuntime, tool

@tool(description="Add two integers")
def add(a: int, b: int) -> int:
    """Add a and b."""
    return a + b

registry = ToolRegistry()
registry.register(add)
runtime = ToolRuntime(registry)   # conservative defaults

result = await runtime.run("add", {"a": 2, "b": 3})
assert result.content == 5

Why Ghemud AgentKit

Without a runtime boundary With Ghemud AgentKit
Model output trusted as function calls Model output validated against JSON Schema with size/depth limits
"The agent has access to everything" Capability-based permissions: allow / deny / human-approval, evaluated before side effects
Unbounded tool loops Time, cost, and tool-call budgets with atomic reservation
Secrets sprayed through logs Mandatory redaction in every event, audit record, and model-visible result
No answer to "who approved what, when" Hash-chained (optionally HMAC-signed) audit trail
Untestable without a provider API key Deterministic fake models; zero network in the entire test suite

The 30-second tour

import asyncio
from ghemud_agentkit import (
    AgentLoop, LoopConfig, ScriptedModel,
    ToolRegistry, ToolRuntime, tool,
)
from ghemud_agentkit.models import tool_call, text_response

registry = ToolRegistry()
# ... register tools ...

runtime = ToolRuntime(registry)

# Deterministic loop with a scripted model (no API key, no network):
model = ScriptedModel([
    tool_call("add", {"a": 19, "b": 23}),   # 1) model calls a tool
    text_response("19 + 23 = 42"),           # 2) model answers
])
loop = AgentLoop(model, runtime, config=LoopConfig(max_iterations=5))
result = asyncio.run(loop.run("what is 19+23?"))
print(result.final_text)          # -> "19 + 23 = 42"
print(result.stop_reason)         # -> StopReason.COMPLETED

Swap ScriptedModel for the OpenAI adapter (pip install "ghemud-agentkit[openai]") and the same loop, policies, budgets, and audit trail run against a real provider.

What's in the box

  • Tool API@tool decorator with schema inference from type hints (dataclasses, pydantic, Literal, enums, containers); sync and async tools; injected ctx: ToolContext for cancellation, state, and deadlines.
  • Registries — namespaced, composite (first-match-wins with conflict detection), immutable snapshots, capability discovery.
  • Invocation lifecycle — validated state machine (requested → validated → authorized → [approval] → queued → running → terminal) with structured events at every transition under one stable invocation ID.
  • Permissions — capability-based policies with deny > approval > allow precedence, risk tiers, and a conservative DefaultPolicy.
  • Human approval — TTL'd approval requests and TTL'd decisions; auto-deny for non-interactive environments; pluggable providers (console, callback, static).
  • Resilience — bounded exponential backoff with jitter; retries only for idempotent/retryable tools; failure classification (validation/policy/approval/timeout/transient/application/…).
  • Budgets — time, cost, and tool-call ceilings with atomic reserve/commit/release; budget state never leaks into error messages.
  • Observability — typed event bus, in-memory collectors, mandatory secret redaction, debug events opt-in.
  • Audit — hash-chained records (args digested from the redacted view), optional HMAC signing, JSONL file sink, chain verification API.
  • Agent loop — model ↔ tools alternation with parallel tool calls, deterministic ordering, and eight explicit stop conditions.
  • CLIlist, inspect, validate-policy, run --dry-run, trace.
  • Interop — MCP adapter (optional extra); discovery schemas are byte-identical to enforcement schemas.

Installation

pip install ghemud-agentkit            # core, zero required dependencies
pip install "ghemud-agentkit[openai]"  # + OpenAI adapter
pip install "ghemud-agentkit[mcp]"     # + MCP interop

Python 3.10+ · Apache-2.0.

Documentation

Compatibility policy

Semantic versioning. The public API is from ghemud_agentkit import ... plus stable submodules; anything documented in this README is covered. Internals (underscore-prefixed modules and names) may change at any patch release.

Author, citation, and contribution

Ghemud AgentKit was created by Yashraj Sachin Ghemud. Use the metadata in CITATION.cff when citing this software, review CREDITS.md for project attribution, and see CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md before participating or reporting a vulnerability.


Ghemud AgentKit treats model output as adversarial input even when the application trusts the model. If you remember one thing about this library, remember that.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ghemud_agentkit-0.1.0.tar.gz (141.5 kB view details)

Uploaded Source

Built Distribution

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

ghemud_agentkit-0.1.0-py3-none-any.whl (116.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ghemud_agentkit-0.1.0.tar.gz
  • Upload date:
  • Size: 141.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for ghemud_agentkit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5fe3fdba37c06ce89880a0b996653d2dd8b58a3a2cf6c9cfed557c418ef79787
MD5 7eb15d85aefaf6b0eff9d222c01d5d79
BLAKE2b-256 e14f8276aecf6ac4b8276509f173ae1a38991d478e5f97e2fa46c6081c5be108

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ghemud_agentkit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f69c50dc086e714162e300c86a7e9ac746a671cf6a4820ad4f3ca294564d65f
MD5 2cee76e132cc5262207cf6d88f51ce12
BLAKE2b-256 711659b376b57d08fb6539ba93e79d3a3ae3f095c1a261a5da8daf0b8376b0b8

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page