hippodb-agent-sdk 1.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hippodb_agent/__init__.py +22 -0
- hippodb_agent/config.py +168 -0
- hippodb_agent/core/__init__.py +0 -0
- hippodb_agent/core/agent.py +815 -0
- hippodb_agent/core/llm.py +440 -0
- hippodb_agent/core/role.py +58 -0
- hippodb_agent/core/runner.py +506 -0
- hippodb_agent/creator/__init__.py +6 -0
- hippodb_agent/creator/__main__.py +5 -0
- hippodb_agent/creator/generators.py +758 -0
- hippodb_agent/creator/main.py +40 -0
- hippodb_agent/creator/openapi_parser.py +358 -0
- hippodb_agent/creator/role.py +104 -0
- hippodb_agent/creator/state.py +115 -0
- hippodb_agent/creator/tools.py +762 -0
- hippodb_agent/defaults.env +21 -0
- hippodb_agent/feedback/__init__.py +6 -0
- hippodb_agent/feedback/classifier.py +85 -0
- hippodb_agent/gateway/__init__.py +22 -0
- hippodb_agent/gateway/audit.py +113 -0
- hippodb_agent/gateway/compliance.py +427 -0
- hippodb_agent/gateway/gateway.py +505 -0
- hippodb_agent/gateway/masker.py +307 -0
- hippodb_agent/gateway/policies.py +69 -0
- hippodb_agent/gateway/summarizer.py +146 -0
- hippodb_agent/gateway/tokens.py +94 -0
- hippodb_agent/logging/__init__.py +0 -0
- hippodb_agent/logging/setup.py +130 -0
- hippodb_agent/memory/__init__.py +0 -0
- hippodb_agent/memory/audit.py +219 -0
- hippodb_agent/memory/client.py +1190 -0
- hippodb_agent/memory/conflicts.py +171 -0
- hippodb_agent/memory/formatter.py +366 -0
- hippodb_agent/memory/instructions.py +20 -0
- hippodb_agent/memory/seed.py +281 -0
- hippodb_agent/monitor/__init__.py +25 -0
- hippodb_agent/monitor/brain_report.py +371 -0
- hippodb_agent/monitor/metrics.py +164 -0
- hippodb_agent/monitor/neuro_monitor.py +385 -0
- hippodb_agent/network/__init__.py +6 -0
- hippodb_agent/network/client.py +416 -0
- hippodb_agent/network/control.py +240 -0
- hippodb_agent/network/enterprise.py +29 -0
- hippodb_agent/network/models.py +59 -0
- hippodb_agent/network/safety.py +147 -0
- hippodb_agent/network/telemetry.py +264 -0
- hippodb_agent/network/tools.py +147 -0
- hippodb_agent/prompt/__init__.py +5 -0
- hippodb_agent/prompt/composer.py +101 -0
- hippodb_agent/rules/__init__.py +94 -0
- hippodb_agent/rules/compiler.py +387 -0
- hippodb_agent/rules/dsl.py +359 -0
- hippodb_agent/rules/enforcer.py +331 -0
- hippodb_agent/rules/interpreter.py +228 -0
- hippodb_agent/rules/sandbox.py +343 -0
- hippodb_agent/terminal.py +124 -0
- hippodb_agent/tools/__init__.py +0 -0
- hippodb_agent/tools/base.py +165 -0
- hippodb_agent/tools/builtin.py +1557 -0
- hippodb_agent/tools/calc_tools.py +831 -0
- hippodb_agent/tools/discovery.py +392 -0
- hippodb_agent/tools/os_tools.py +427 -0
- hippodb_agent/tools/registry.py +451 -0
- hippodb_agent/tuning/__init__.py +0 -0
- hippodb_agent/tuning/applier.py +65 -0
- hippodb_agent/tuning/diagnoser.py +129 -0
- hippodb_agent/tuning/models.py +115 -0
- hippodb_agent/tuning/orchestrator.py +229 -0
- hippodb_agent/tuning/planner.py +113 -0
- hippodb_agent/tuning/simulator.py +106 -0
- hippodb_agent/tuning/tracker.py +97 -0
- hippodb_agent/tuning/validator.py +106 -0
- hippodb_agent_sdk-1.2.0.dist-info/METADATA +355 -0
- hippodb_agent_sdk-1.2.0.dist-info/RECORD +77 -0
- hippodb_agent_sdk-1.2.0.dist-info/WHEEL +5 -0
- hippodb_agent_sdk-1.2.0.dist-info/licenses/LICENSE +75 -0
- hippodb_agent_sdk-1.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""HippoDb Agent SDK — build self-tuning AI agents with biological memory."""
|
|
2
|
+
|
|
3
|
+
from hippodb_agent.config import AgentSettings
|
|
4
|
+
from hippodb_agent.core.role import RoleConfig
|
|
5
|
+
from hippodb_agent.core.runner import AgentRunner
|
|
6
|
+
from hippodb_agent.tools.base import BaseTool, ApiClients
|
|
7
|
+
from hippodb_agent.tools.os_tools import get_os_tools
|
|
8
|
+
from hippodb_agent.tools.calc_tools import get_calc_tools
|
|
9
|
+
from hippodb_agent.memory.formatter import BaseMemoryFormatter, get_formatter
|
|
10
|
+
from hippodb_agent.gateway.policies import MaskStrategy, FieldPolicy
|
|
11
|
+
from hippodb_agent.gateway.gateway import DataGateway
|
|
12
|
+
from hippodb_agent.network.client import AgentNetwork
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"AgentSettings", "RoleConfig", "AgentRunner",
|
|
16
|
+
"BaseTool", "ApiClients",
|
|
17
|
+
"get_os_tools", "get_calc_tools",
|
|
18
|
+
"BaseMemoryFormatter", "get_formatter",
|
|
19
|
+
"MaskStrategy", "FieldPolicy", "DataGateway",
|
|
20
|
+
"AgentNetwork",
|
|
21
|
+
]
|
|
22
|
+
__version__ = "1.1.1"
|
hippodb_agent/config.py
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"""Base configuration for all agents.
|
|
2
|
+
|
|
3
|
+
Configuration inheritance
|
|
4
|
+
─────────────────────────
|
|
5
|
+
Values are loaded in this order (later sources override earlier ones):
|
|
6
|
+
|
|
7
|
+
1. Field defaults defined on the model classes below
|
|
8
|
+
2. `defaults.env` shipped inside the SDK package (SDK-wide defaults)
|
|
9
|
+
3. `.env` in the agent's working directory (per-agent overrides)
|
|
10
|
+
4. Process environment variables
|
|
11
|
+
|
|
12
|
+
This lets an agent's .env override anything set by the SDK while still
|
|
13
|
+
benefiting from the SDK's curated defaults.
|
|
14
|
+
|
|
15
|
+
Nested settings use `__` as a delimiter. For example, to disable the
|
|
16
|
+
consolidation batch job from an agent's .env:
|
|
17
|
+
|
|
18
|
+
MEMORY_JOBS__CONSOLIDATION=false
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
24
|
+
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# ─── Package-shipped defaults ────────────────────────────────────
|
|
28
|
+
|
|
29
|
+
_SDK_DEFAULTS_ENV = Path(__file__).parent / "defaults.env"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# ─── Memory batch job toggles ────────────────────────────────────
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class MemoryJobsConfig(BaseModel):
|
|
36
|
+
"""Enable/disable per-job for memory-related background workers.
|
|
37
|
+
|
|
38
|
+
Currently empty — all retired batch jobs (st_capture, st_pruning,
|
|
39
|
+
consolidation, prompt_evolution, feedback_coordination,
|
|
40
|
+
sleep_orchestrator) have been removed. The class is retained as
|
|
41
|
+
the canonical place for the upcoming reasoning-witness job flag
|
|
42
|
+
and any future memory-plasticity workers.
|
|
43
|
+
|
|
44
|
+
extra="ignore" so .env files that still set retired keys parse
|
|
45
|
+
cleanly without raising.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
model_config = ConfigDict(extra="ignore")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# ─── Agent settings ──────────────────────────────────────────────
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class AgentSettings(BaseSettings):
|
|
55
|
+
model_config = SettingsConfigDict(
|
|
56
|
+
env_file=(str(_SDK_DEFAULTS_ENV), ".env"),
|
|
57
|
+
env_file_encoding="utf-8",
|
|
58
|
+
env_nested_delimiter="__",
|
|
59
|
+
extra="allow",
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# LLM provider — any LiteLLM-supported model string:
|
|
63
|
+
# "anthropic/claude-sonnet-4-20250514"
|
|
64
|
+
# "openai/gpt-4o"
|
|
65
|
+
# "xai/grok-3-fast-latest"
|
|
66
|
+
# "google/gemini-2.0-flash"
|
|
67
|
+
# "ollama/llama3"
|
|
68
|
+
model: str = "anthropic/claude-sonnet-4-20250514"
|
|
69
|
+
|
|
70
|
+
# API key — LiteLLM routes to the right provider env var automatically.
|
|
71
|
+
# You can also set provider-specific env vars directly:
|
|
72
|
+
# ANTHROPIC_API_KEY, OPENAI_API_KEY, XAI_API_KEY, etc.
|
|
73
|
+
anthropic_api_key: str = "" # backward compat — also used as generic llm_api_key
|
|
74
|
+
llm_api_key: str = "" # preferred: provider-agnostic key
|
|
75
|
+
|
|
76
|
+
# Provider API keys — set whichever providers you use.
|
|
77
|
+
# These are the standard env var names each provider expects.
|
|
78
|
+
openai_api_key: str = ""
|
|
79
|
+
xai_api_key: str = ""
|
|
80
|
+
google_api_key: str = ""
|
|
81
|
+
gemini_api_key: str = ""
|
|
82
|
+
cohere_api_key: str = ""
|
|
83
|
+
mistral_api_key: str = ""
|
|
84
|
+
|
|
85
|
+
# LLM routing — optional. Leave empty for single-model mode.
|
|
86
|
+
# JSON map of model → task description. The router LLM reads these
|
|
87
|
+
# descriptions to decide which model handles each user message.
|
|
88
|
+
# Example:
|
|
89
|
+
# LLM_ROUTING_MODELS={"anthropic/claude-opus-4-8": "complex reasoning and analysis", "openai/gpt-4o-mini": "simple questions and lightweight tasks"}
|
|
90
|
+
llm_routing_models: str = ""
|
|
91
|
+
# Model used to make routing decisions (LLM-as-router).
|
|
92
|
+
# Can be any model whose provider key is already declared above.
|
|
93
|
+
# Example: LLM_ROUTER_MODEL=anthropic/claude-haiku-4-5-20251001
|
|
94
|
+
llm_router_model: str = ""
|
|
95
|
+
|
|
96
|
+
hippodb_url: str = "http://localhost:7700"
|
|
97
|
+
|
|
98
|
+
# Brain capacity — max neurons (concepts) in the agent's fabric.
|
|
99
|
+
# 0 = unlimited. Configured per-agent in .env.
|
|
100
|
+
brain_capacity: int = 0
|
|
101
|
+
|
|
102
|
+
# (Removed in PR S4: st_max_age_days, st_promotion_threshold_*.
|
|
103
|
+
# Short-term memory is now conversation_log + load_recent_context;
|
|
104
|
+
# no concept-layer pruning or promotion thresholds. AgentSettings
|
|
105
|
+
# has extra="allow" so old .env files with these keys still parse.)
|
|
106
|
+
|
|
107
|
+
# Tool discovery settings
|
|
108
|
+
enable_tool_discovery: bool = True # on by default — keeps tool schemas focused per-turn
|
|
109
|
+
discovery_max_tools: int = 12 # max tools from THINK (excluding always-on)
|
|
110
|
+
discovery_min_activation: float = 0.05 # THINK activation threshold for tools
|
|
111
|
+
# When the count of registered enterprise tools (allocated via
|
|
112
|
+
# TOOLS_SYNC) is at or below this threshold, all enterprise tools
|
|
113
|
+
# bypass discovery and appear in every LLM turn — same treatment
|
|
114
|
+
# as system tools. Past the threshold, enterprise tools revert to
|
|
115
|
+
# THINK-gated discovery to keep the schema list bounded.
|
|
116
|
+
enterprise_always_on_threshold: int = 25
|
|
117
|
+
|
|
118
|
+
# Hard rule enforcement settings
|
|
119
|
+
require_hard_rule_approval: bool = True # newly compiled hard rules wait
|
|
120
|
+
# for explicit approval before enforcing
|
|
121
|
+
|
|
122
|
+
# Logging
|
|
123
|
+
log_dir: str = "agent_logs"
|
|
124
|
+
|
|
125
|
+
# Data Gateway — PII masking + summarization
|
|
126
|
+
enable_data_gateway: bool = True
|
|
127
|
+
gateway_summary_threshold: int = 10 # summarize arrays > N items
|
|
128
|
+
gateway_sample_size: int = 3 # representative rows in summary
|
|
129
|
+
gateway_builtin_pii: bool = True # include built-in PII patterns
|
|
130
|
+
gateway_compliance: str = "" # compliance framework: "GDPR", "HIPAA", "PCI_DSS"
|
|
131
|
+
# Extra tool names to skip in the audit trail, on top of the SDK
|
|
132
|
+
# defaults (memory_*, discover_more). CSV — e.g. "health_ping,heartbeat".
|
|
133
|
+
# Masking still runs for skipped tools; only the audit record is suppressed.
|
|
134
|
+
gateway_audit_skip_tools: str = ""
|
|
135
|
+
# Attach the masked output (what the LLM actually saw) to each
|
|
136
|
+
# audit event so reviewers can see what crossed the boundary. The
|
|
137
|
+
# pre-gateway payload is never stored — only the protected form.
|
|
138
|
+
# Keep off by default: capturing N kB per call grows the audit
|
|
139
|
+
# table quickly. Applications that want it should enable it and
|
|
140
|
+
# tune `gateway_capture_output_max` to their retention budget.
|
|
141
|
+
gateway_capture_output: bool = False
|
|
142
|
+
gateway_capture_output_max: int = 8192 # bytes per event
|
|
143
|
+
|
|
144
|
+
# Memory formatting — how THINK results are presented to the LLM
|
|
145
|
+
# Options: "structured" (sections), "narrative" (paragraphs),
|
|
146
|
+
# "xml" (tagged blocks), "raw" (JSON, backward compat)
|
|
147
|
+
memory_format: str = "structured"
|
|
148
|
+
memory_format_max_tokens: int = 800 # token budget for formatted output
|
|
149
|
+
|
|
150
|
+
# Memory batch job toggles — see MemoryJobsConfig for per-field docs.
|
|
151
|
+
# Override from .env using nested env vars, e.g.
|
|
152
|
+
# MEMORY_JOBS__CONSOLIDATION=false
|
|
153
|
+
memory_jobs: MemoryJobsConfig = Field(default_factory=MemoryJobsConfig)
|
|
154
|
+
|
|
155
|
+
# Session context — how many recent conversations to preload at session start.
|
|
156
|
+
# Gives the LLM immediate context of prior exchanges so users can reference
|
|
157
|
+
# previous responses ("about that analysis you showed me yesterday...").
|
|
158
|
+
# Set to 0 to disable. Conversations are loaded from the conversation_log table.
|
|
159
|
+
session_context_preload: int = 5
|
|
160
|
+
|
|
161
|
+
# Agent Network — NATS-based agent discovery and messaging.
|
|
162
|
+
# Set network_nats_url to enable networking (empty = disabled).
|
|
163
|
+
network_nats_url: str = "" # "nats://localhost:4222"
|
|
164
|
+
network_registry_url: str = "" # "http://localhost:7800"
|
|
165
|
+
network_hostname: str = "" # "behaviol.finance.mandodari"
|
|
166
|
+
network_secret: str = "" # admin-provided secret
|
|
167
|
+
network_heartbeat_interval: int = 30 # seconds between heartbeats
|
|
168
|
+
network_mode: str = "required" # "required" (fail if unavailable) or "optional" (work offline)
|
|
File without changes
|