steerable-agent-runtime 0.2.5__tar.gz → 0.4.0__tar.gz
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.
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/PKG-INFO +3 -3
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/pyproject.toml +13 -3
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/__init__.py +410 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/antihallucination.py +6 -7
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/approval.py +404 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/approval_policy.py +243 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/branch.py +294 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/cache_control.py +154 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/calibration.py +1 -1
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/compaction.py +69 -29
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/default.harness.json +30 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/default.harness.yaml +28 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/errors.py +20 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/handoff.py +147 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/harness.py +674 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/harness_spec.py +339 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/history.py +774 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/hooks.py +402 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/llm/__init__.py +78 -10
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/llm/anthropic_native.py +104 -29
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/llm/compat.py +259 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/llm/errors.py +23 -2
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/llm/openai_compat.py +649 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/llm/parts.py +69 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/llm/system_proxy.py +177 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/loop.py +2474 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/maintenance.py +238 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/mcp.py +438 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/mcp_server.py +319 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/model_catalog.py +7619 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/model_info.py +247 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/model_resolve.py +151 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/observation_aging.py +196 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/orchestration.py +686 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/otel.py +82 -9
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/pricing.py +88 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/recording.py +455 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/reminders.py +279 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/resume.py +130 -11
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/retry.py +5 -1
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/sandboxed.py +188 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/skills.py +161 -36
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/storage/__init__.py +58 -3
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/storage/in_memory.py +64 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/storage/sqlalchemy_store.py +154 -22
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/storage/sqlite_store.py +414 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/storage/write_lease.py +134 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/subagent.py +59 -3
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/tokens.py +37 -33
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/tool_schema.py +124 -0
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/tool_search.py +177 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/tools.py +65 -8
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/tracing.py +122 -15
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime/world_state.py +345 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime.egg-info/PKG-INFO +3 -3
- steerable_agent_runtime-0.4.0/src/steerable_agent_runtime.egg-info/SOURCES.txt +131 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime.egg-info/requires.txt +2 -2
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_antihallucination.py +18 -18
- steerable_agent_runtime-0.4.0/tests/test_approval.py +470 -0
- steerable_agent_runtime-0.4.0/tests/test_approval_policy.py +185 -0
- steerable_agent_runtime-0.4.0/tests/test_branch.py +234 -0
- steerable_agent_runtime-0.4.0/tests/test_cache_control.py +185 -0
- steerable_agent_runtime-0.4.0/tests/test_cache_instrumentation.py +264 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_calibration.py +7 -7
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_compaction.py +131 -24
- steerable_agent_runtime-0.4.0/tests/test_content_parts.py +237 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_error_taxonomy.py +20 -9
- steerable_agent_runtime-0.4.0/tests/test_fragment_bounds.py +208 -0
- steerable_agent_runtime-0.4.0/tests/test_golden.py +257 -0
- steerable_agent_runtime-0.4.0/tests/test_handoff.py +113 -0
- steerable_agent_runtime-0.4.0/tests/test_harness.py +244 -0
- steerable_agent_runtime-0.4.0/tests/test_harness_spec.py +251 -0
- steerable_agent_runtime-0.4.0/tests/test_history.py +370 -0
- steerable_agent_runtime-0.4.0/tests/test_history_persistence.py +1150 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_hooks.py +144 -10
- steerable_agent_runtime-0.4.0/tests/test_llm_wire_helpers.py +653 -0
- steerable_agent_runtime-0.4.0/tests/test_long_session.py +163 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_loop.py +46 -8
- steerable_agent_runtime-0.4.0/tests/test_loop_cancellation.py +325 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_loop_replay.py +1 -1
- steerable_agent_runtime-0.4.0/tests/test_loop_sandbox_event.py +68 -0
- steerable_agent_runtime-0.4.0/tests/test_maintenance.py +136 -0
- steerable_agent_runtime-0.4.0/tests/test_mcp.py +480 -0
- steerable_agent_runtime-0.4.0/tests/test_mcp_server.py +209 -0
- steerable_agent_runtime-0.4.0/tests/test_model_catalog.py +183 -0
- steerable_agent_runtime-0.4.0/tests/test_model_equivalence.py +185 -0
- steerable_agent_runtime-0.4.0/tests/test_model_info.py +185 -0
- steerable_agent_runtime-0.4.0/tests/test_model_resolve.py +86 -0
- steerable_agent_runtime-0.4.0/tests/test_observation_aging.py +169 -0
- steerable_agent_runtime-0.4.0/tests/test_orchestration.py +923 -0
- steerable_agent_runtime-0.4.0/tests/test_otel.py +292 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_parallel_tools.py +7 -7
- steerable_agent_runtime-0.4.0/tests/test_provider_compat.py +269 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_pseudo.py +4 -4
- steerable_agent_runtime-0.4.0/tests/test_recording.py +345 -0
- steerable_agent_runtime-0.4.0/tests/test_reminders.py +136 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_resume.py +16 -16
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_retry_hooks.py +17 -4
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_safety_gate.py +24 -0
- steerable_agent_runtime-0.4.0/tests/test_sandboxed.py +188 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_skills.py +46 -30
- steerable_agent_runtime-0.4.0/tests/test_soft_timeout.py +1174 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_spill.py +5 -5
- steerable_agent_runtime-0.4.0/tests/test_sqlite_storage.py +238 -0
- steerable_agent_runtime-0.4.0/tests/test_steer.py +281 -0
- steerable_agent_runtime-0.4.0/tests/test_storage_contract.py +135 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_stream_strip.py +3 -3
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_subagent.py +90 -1
- steerable_agent_runtime-0.4.0/tests/test_system_proxy.py +211 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_tokens.py +7 -7
- steerable_agent_runtime-0.4.0/tests/test_tool_exposure.py +506 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_tool_hygiene.py +4 -4
- steerable_agent_runtime-0.4.0/tests/test_tool_schema.py +114 -0
- steerable_agent_runtime-0.4.0/tests/test_tool_timeout.py +311 -0
- steerable_agent_runtime-0.4.0/tests/test_trace_recorder.py +339 -0
- steerable_agent_runtime-0.4.0/tests/test_usage_attribution.py +137 -0
- steerable_agent_runtime-0.4.0/tests/test_world_state.py +408 -0
- steerable_agent_runtime-0.4.0/tests/test_write_lease.py +99 -0
- steerable_agent_runtime-0.2.5/src/steerable_agent_runtime/__init__.py +0 -165
- steerable_agent_runtime-0.2.5/src/steerable_agent_runtime/hooks.py +0 -250
- steerable_agent_runtime-0.2.5/src/steerable_agent_runtime/llm/openai_compat.py +0 -325
- steerable_agent_runtime-0.2.5/src/steerable_agent_runtime/loop.py +0 -1100
- steerable_agent_runtime-0.2.5/src/steerable_agent_runtime.egg-info/SOURCES.txt +0 -63
- steerable_agent_runtime-0.2.5/tests/test_llm_wire_helpers.py +0 -306
- steerable_agent_runtime-0.2.5/tests/test_otel.py +0 -161
- steerable_agent_runtime-0.2.5/tests/test_soft_timeout.py +0 -165
- steerable_agent_runtime-0.2.5/tests/test_steer.py +0 -127
- steerable_agent_runtime-0.2.5/tests/test_trace_recorder.py +0 -170
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/README.md +0 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/setup.cfg +0 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/pseudo.py +0 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/replay.py +0 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/spill.py +0 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/transport/__init__.py +0 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/transport/fastapi_sse.py +0 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime/transport/stdio_jsonrpc.py +0 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime.egg-info/dependency_links.txt +0 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/src/steerable_agent_runtime.egg-info/top_level.txt +0 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_in_memory_storage.py +0 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_replay_crosslang.py +0 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_tool_router.py +0 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_transport_jsonrpc.py +0 -0
- {steerable_agent_runtime-0.2.5 → steerable_agent_runtime-0.4.0}/tests/test_transport_sse.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: steerable-agent-runtime
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Steerable agent runtime: LLM, tool, storage, and transport adapters.
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -13,14 +13,14 @@ Provides-Extra: fastapi
|
|
|
13
13
|
Requires-Dist: fastapi>=0.110; extra == "fastapi"
|
|
14
14
|
Requires-Dist: starlette>=0.37; extra == "fastapi"
|
|
15
15
|
Provides-Extra: openai
|
|
16
|
-
Requires-Dist: httpx>=0.27; extra == "openai"
|
|
16
|
+
Requires-Dist: httpx[socks]>=0.27; extra == "openai"
|
|
17
17
|
Provides-Extra: anthropic
|
|
18
18
|
Requires-Dist: anthropic>=0.40; extra == "anthropic"
|
|
19
19
|
Provides-Extra: all
|
|
20
20
|
Requires-Dist: sqlalchemy>=2.0; extra == "all"
|
|
21
21
|
Requires-Dist: fastapi>=0.110; extra == "all"
|
|
22
22
|
Requires-Dist: starlette>=0.37; extra == "all"
|
|
23
|
-
Requires-Dist: httpx>=0.27; extra == "all"
|
|
23
|
+
Requires-Dist: httpx[socks]>=0.27; extra == "all"
|
|
24
24
|
Requires-Dist: anthropic>=0.40; extra == "all"
|
|
25
25
|
|
|
26
26
|
# steerable-agent-runtime
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "steerable-agent-runtime"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.4.0"
|
|
4
4
|
description = "Steerable agent runtime: LLM, tool, storage, and transport adapters."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -18,13 +18,17 @@ dependencies = [
|
|
|
18
18
|
[project.optional-dependencies]
|
|
19
19
|
sqlalchemy = ["sqlalchemy>=2.0"]
|
|
20
20
|
fastapi = ["fastapi>=0.110", "starlette>=0.37"]
|
|
21
|
-
|
|
21
|
+
# The `socks` extra is not optional in practice: httpx builds a transport for
|
|
22
|
+
# every proxy the environment declares while the client is constructed, so a
|
|
23
|
+
# host exporting `all_proxy=socks5://…` — the common shell proxy snippet — makes
|
|
24
|
+
# construction raise without it, failing provider calls that never reach a URL.
|
|
25
|
+
openai = ["httpx[socks]>=0.27"]
|
|
22
26
|
anthropic = ["anthropic>=0.40"]
|
|
23
27
|
all = [
|
|
24
28
|
"sqlalchemy>=2.0",
|
|
25
29
|
"fastapi>=0.110",
|
|
26
30
|
"starlette>=0.37",
|
|
27
|
-
"httpx>=0.27",
|
|
31
|
+
"httpx[socks]>=0.27",
|
|
28
32
|
"anthropic>=0.40",
|
|
29
33
|
]
|
|
30
34
|
|
|
@@ -38,6 +42,12 @@ package-dir = {"" = "src"}
|
|
|
38
42
|
[tool.setuptools.packages.find]
|
|
39
43
|
where = ["src"]
|
|
40
44
|
|
|
45
|
+
# default.harness.yaml/.json ship inside the wheel: the sidecar resolves
|
|
46
|
+
# the spec relative to the installed package (Harbor trial containers
|
|
47
|
+
# pip-install the wheels, so a repo-relative path would not exist there).
|
|
48
|
+
[tool.setuptools.package-data]
|
|
49
|
+
steerable_agent_runtime = ["*.yaml", "*.json"]
|
|
50
|
+
|
|
41
51
|
[tool.uv.sources]
|
|
42
52
|
steerable-agent-protocol = { workspace = true }
|
|
43
53
|
steerable-agent-harness = { workspace = true }
|
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
"""Steerable agent runtime — Tier 3 adapter package."""
|
|
2
|
+
|
|
3
|
+
from .antihallucination import (
|
|
4
|
+
AntiHallucinationConfig,
|
|
5
|
+
AntiHallucinationHooks,
|
|
6
|
+
detect_claimed_execution,
|
|
7
|
+
detect_deferred_execution,
|
|
8
|
+
detect_deferred_execution_eager,
|
|
9
|
+
detect_execution_intent_in_user_message,
|
|
10
|
+
parse_grounding_verdict,
|
|
11
|
+
parse_turn_route,
|
|
12
|
+
should_run_grounding_judge,
|
|
13
|
+
)
|
|
14
|
+
from .approval import (
|
|
15
|
+
ApprovalDecision,
|
|
16
|
+
ApprovalExecutor,
|
|
17
|
+
ApprovalRequest,
|
|
18
|
+
ApprovalStore,
|
|
19
|
+
Approver,
|
|
20
|
+
AutoApprover,
|
|
21
|
+
InMemoryApprovalStore,
|
|
22
|
+
JsonApprovalStore,
|
|
23
|
+
SessionApprovalCache,
|
|
24
|
+
)
|
|
25
|
+
from .approval_policy import (
|
|
26
|
+
ApprovalPolicy,
|
|
27
|
+
ApprovalRule,
|
|
28
|
+
JsonApprovalPolicyStore,
|
|
29
|
+
PolicyApprover,
|
|
30
|
+
rule_from_amendment,
|
|
31
|
+
)
|
|
32
|
+
from .branch import (
|
|
33
|
+
BranchPoint,
|
|
34
|
+
ForkResult,
|
|
35
|
+
branch_label,
|
|
36
|
+
fork_record,
|
|
37
|
+
lineage,
|
|
38
|
+
resolve_fork_seq,
|
|
39
|
+
)
|
|
40
|
+
from .cache_control import (
|
|
41
|
+
CacheControlProvider,
|
|
42
|
+
CacheRetention,
|
|
43
|
+
place_cache_breakpoints,
|
|
44
|
+
system_blocks_with_cache,
|
|
45
|
+
)
|
|
46
|
+
from .calibration import CalibratingProvider, ModelCalibration, UsageCalibration
|
|
47
|
+
from .compaction import CompactionHooks
|
|
48
|
+
from .errors import (
|
|
49
|
+
ApprovalAborted,
|
|
50
|
+
BudgetExhaustedError,
|
|
51
|
+
PolicyDeniedError,
|
|
52
|
+
StorageError,
|
|
53
|
+
ToolDispatchError,
|
|
54
|
+
TransportError,
|
|
55
|
+
)
|
|
56
|
+
from .errors import (
|
|
57
|
+
RuntimeError as SteerableRuntimeError,
|
|
58
|
+
)
|
|
59
|
+
from .history import (
|
|
60
|
+
RECORD_FORMAT_VERSION,
|
|
61
|
+
CompactionBoundary,
|
|
62
|
+
ContextFragment,
|
|
63
|
+
ContextManager,
|
|
64
|
+
HistoryItem,
|
|
65
|
+
HistorySeed,
|
|
66
|
+
HistoryStore,
|
|
67
|
+
RecordEntry,
|
|
68
|
+
RecordFormatError,
|
|
69
|
+
SystemPromptFragment,
|
|
70
|
+
entry_from_dict,
|
|
71
|
+
render_fragment_capped,
|
|
72
|
+
entry_to_dict,
|
|
73
|
+
message_from_dict,
|
|
74
|
+
message_to_dict,
|
|
75
|
+
upgrade_entry_dict,
|
|
76
|
+
)
|
|
77
|
+
from .hooks import (
|
|
78
|
+
ChainHooks,
|
|
79
|
+
CompletionAction,
|
|
80
|
+
CompletionDraft,
|
|
81
|
+
LoopHooks,
|
|
82
|
+
NoopHooks,
|
|
83
|
+
PreStepAction,
|
|
84
|
+
RetryAction,
|
|
85
|
+
RewriteRequest,
|
|
86
|
+
TranscriptAppend,
|
|
87
|
+
)
|
|
88
|
+
from .llm import (
|
|
89
|
+
ContentPart,
|
|
90
|
+
ImagePart,
|
|
91
|
+
LLMMessage,
|
|
92
|
+
LLMProvider,
|
|
93
|
+
LLMStreamChunk,
|
|
94
|
+
LLMUsage,
|
|
95
|
+
TextPart,
|
|
96
|
+
text_parts,
|
|
97
|
+
)
|
|
98
|
+
from .loop import (
|
|
99
|
+
CompletionDecision,
|
|
100
|
+
CoreLoop,
|
|
101
|
+
LoopConfig,
|
|
102
|
+
LoopContext,
|
|
103
|
+
LoopEvent,
|
|
104
|
+
RouterToolExecutor,
|
|
105
|
+
ToolExecutor,
|
|
106
|
+
)
|
|
107
|
+
from .mcp import (
|
|
108
|
+
DEFAULT_MAX_SERVER_TOOLS,
|
|
109
|
+
McpCallResult,
|
|
110
|
+
McpCatalogError,
|
|
111
|
+
McpError,
|
|
112
|
+
McpStdioClient,
|
|
113
|
+
McpToolInfo,
|
|
114
|
+
mcp_invoker,
|
|
115
|
+
parse_mcp_name,
|
|
116
|
+
qualify_mcp_name,
|
|
117
|
+
register_mcp_catalog,
|
|
118
|
+
)
|
|
119
|
+
from .model_info import (
|
|
120
|
+
MODEL_INFOS,
|
|
121
|
+
REASONING_EFFORT_ORDER,
|
|
122
|
+
ModelInfo,
|
|
123
|
+
clamp_reasoning_effort,
|
|
124
|
+
register_model_info,
|
|
125
|
+
resolve_model_info,
|
|
126
|
+
)
|
|
127
|
+
from .orchestration import (
|
|
128
|
+
AgentPool,
|
|
129
|
+
ChildOutcome,
|
|
130
|
+
OrchestrationBudgetExceeded,
|
|
131
|
+
OrchestrationConfig,
|
|
132
|
+
OrchestrationExecutor,
|
|
133
|
+
orchestration_tool_descriptors,
|
|
134
|
+
)
|
|
135
|
+
from .otel import PrivacyMode, export_otlp_http, export_trace, to_otlp_json
|
|
136
|
+
from .pricing import (
|
|
137
|
+
MODEL_PRICES,
|
|
138
|
+
ModelPrice,
|
|
139
|
+
estimate_cost_usd,
|
|
140
|
+
price_for_model,
|
|
141
|
+
register_model_price,
|
|
142
|
+
)
|
|
143
|
+
from .pseudo import extract_inline_tool_calls
|
|
144
|
+
from .recording import (
|
|
145
|
+
DEFAULT_MAX_ITEM_TOKENS,
|
|
146
|
+
InMemoryRequestSink,
|
|
147
|
+
JsonlRequestSink,
|
|
148
|
+
RecordedRequest,
|
|
149
|
+
RecordingProvider,
|
|
150
|
+
RequestSink,
|
|
151
|
+
assert_bounded_items,
|
|
152
|
+
assert_requests_match_record,
|
|
153
|
+
assert_stable_prefix,
|
|
154
|
+
load_recorded_requests,
|
|
155
|
+
)
|
|
156
|
+
from .replay import (
|
|
157
|
+
ExecutionBudget,
|
|
158
|
+
HarnessExecutionState,
|
|
159
|
+
HarnessTrajectoryEvent,
|
|
160
|
+
build_step_decision_event,
|
|
161
|
+
reduce_execution_state,
|
|
162
|
+
)
|
|
163
|
+
from .resume import (
|
|
164
|
+
close_dangling_tool_calls,
|
|
165
|
+
load_history_transcript,
|
|
166
|
+
load_transcript,
|
|
167
|
+
project_transcript,
|
|
168
|
+
)
|
|
169
|
+
from .retry import RetryHooks
|
|
170
|
+
from .sandboxed import (
|
|
171
|
+
DEFAULT_SHELL_TOOLS,
|
|
172
|
+
SandboxBackend,
|
|
173
|
+
SandboxedToolExecutor,
|
|
174
|
+
SandboxEnforcement,
|
|
175
|
+
)
|
|
176
|
+
from .skills import (
|
|
177
|
+
EAGER_PRIORITY_THRESHOLD,
|
|
178
|
+
FilesystemSkillProvider,
|
|
179
|
+
SkillConfig,
|
|
180
|
+
SkillDefinition,
|
|
181
|
+
SkillExecutor,
|
|
182
|
+
SkillHooks,
|
|
183
|
+
SkillProvider,
|
|
184
|
+
SkillSummary,
|
|
185
|
+
matches_conditions,
|
|
186
|
+
render_skill_catalog,
|
|
187
|
+
select_catalog,
|
|
188
|
+
select_skills,
|
|
189
|
+
skill_to_dict,
|
|
190
|
+
skill_tool_descriptor,
|
|
191
|
+
)
|
|
192
|
+
from .spill import FilesystemSpillStore, InMemorySpillStore, SpillHooks, SpillStore
|
|
193
|
+
from .storage import StorageAdapter
|
|
194
|
+
from .subagent import (
|
|
195
|
+
FilteredToolsExecutor,
|
|
196
|
+
SubagentConfig,
|
|
197
|
+
SubagentExecutor,
|
|
198
|
+
subagent_tool_descriptor,
|
|
199
|
+
)
|
|
200
|
+
from .tokens import (
|
|
201
|
+
MODEL_TOKEN_FACTORS,
|
|
202
|
+
estimate_text_tokens,
|
|
203
|
+
estimate_tokens,
|
|
204
|
+
factor_for_model,
|
|
205
|
+
register_model_factor,
|
|
206
|
+
)
|
|
207
|
+
from .tool_search import TOOL_SEARCH_NAME, register_tool_search, tool_search_descriptor
|
|
208
|
+
from .tools import RegisteredTool, ToolExposure, ToolRouter, tool
|
|
209
|
+
from .tracing import TraceRecorder
|
|
210
|
+
from .transport import TransportAdapter
|
|
211
|
+
from .world_state import (
|
|
212
|
+
StaticWorldStateSection,
|
|
213
|
+
WorldStateFragment,
|
|
214
|
+
WorldStateHooks,
|
|
215
|
+
WorldStatePatchFragment,
|
|
216
|
+
WorldStateSection,
|
|
217
|
+
apply_merge_patch,
|
|
218
|
+
last_world_state_snapshot,
|
|
219
|
+
merge_patch,
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
__all__ = [
|
|
223
|
+
"DEFAULT_MAX_ITEM_TOKENS",
|
|
224
|
+
"DEFAULT_MAX_SERVER_TOOLS",
|
|
225
|
+
"DEFAULT_SHELL_TOOLS",
|
|
226
|
+
"EAGER_PRIORITY_THRESHOLD",
|
|
227
|
+
"MODEL_INFOS",
|
|
228
|
+
"MODEL_PRICES",
|
|
229
|
+
"MODEL_TOKEN_FACTORS",
|
|
230
|
+
"REASONING_EFFORT_ORDER",
|
|
231
|
+
"RECORD_FORMAT_VERSION",
|
|
232
|
+
"TOOL_SEARCH_NAME",
|
|
233
|
+
"AgentPool",
|
|
234
|
+
"AntiHallucinationConfig",
|
|
235
|
+
"AntiHallucinationHooks",
|
|
236
|
+
"ApprovalAborted",
|
|
237
|
+
"ApprovalDecision",
|
|
238
|
+
"ApprovalExecutor",
|
|
239
|
+
"ApprovalPolicy",
|
|
240
|
+
"ApprovalRequest",
|
|
241
|
+
"ApprovalRule",
|
|
242
|
+
"ApprovalStore",
|
|
243
|
+
"Approver",
|
|
244
|
+
"AutoApprover",
|
|
245
|
+
"BranchPoint",
|
|
246
|
+
"BudgetExhaustedError",
|
|
247
|
+
"CacheControlProvider",
|
|
248
|
+
"CacheRetention",
|
|
249
|
+
"CalibratingProvider",
|
|
250
|
+
"ChainHooks",
|
|
251
|
+
"ChildOutcome",
|
|
252
|
+
"CompactionBoundary",
|
|
253
|
+
"CompactionHooks",
|
|
254
|
+
"CompletionAction",
|
|
255
|
+
"CompletionDecision",
|
|
256
|
+
"CompletionDraft",
|
|
257
|
+
"ContentPart",
|
|
258
|
+
"ContextFragment",
|
|
259
|
+
"ContextManager",
|
|
260
|
+
"CoreLoop",
|
|
261
|
+
"ExecutionBudget",
|
|
262
|
+
"FilesystemSkillProvider",
|
|
263
|
+
"FilesystemSpillStore",
|
|
264
|
+
"FilteredToolsExecutor",
|
|
265
|
+
"ForkResult",
|
|
266
|
+
"HarnessExecutionState",
|
|
267
|
+
"HarnessTrajectoryEvent",
|
|
268
|
+
"HistoryItem",
|
|
269
|
+
"HistorySeed",
|
|
270
|
+
"HistoryStore",
|
|
271
|
+
"ImagePart",
|
|
272
|
+
"InMemoryApprovalStore",
|
|
273
|
+
"InMemoryRequestSink",
|
|
274
|
+
"InMemorySpillStore",
|
|
275
|
+
"JsonApprovalPolicyStore",
|
|
276
|
+
"JsonApprovalStore",
|
|
277
|
+
"JsonlRequestSink",
|
|
278
|
+
"LLMMessage",
|
|
279
|
+
"LLMProvider",
|
|
280
|
+
"LLMStreamChunk",
|
|
281
|
+
"LLMUsage",
|
|
282
|
+
"LoopConfig",
|
|
283
|
+
"LoopContext",
|
|
284
|
+
"LoopEvent",
|
|
285
|
+
"LoopHooks",
|
|
286
|
+
"McpCallResult",
|
|
287
|
+
"McpCatalogError",
|
|
288
|
+
"McpError",
|
|
289
|
+
"McpStdioClient",
|
|
290
|
+
"McpToolInfo",
|
|
291
|
+
"ModelCalibration",
|
|
292
|
+
"ModelInfo",
|
|
293
|
+
"ModelPrice",
|
|
294
|
+
"NoopHooks",
|
|
295
|
+
"OrchestrationBudgetExceeded",
|
|
296
|
+
"OrchestrationConfig",
|
|
297
|
+
"OrchestrationExecutor",
|
|
298
|
+
"PolicyApprover",
|
|
299
|
+
"PolicyDeniedError",
|
|
300
|
+
"PreStepAction",
|
|
301
|
+
"PrivacyMode",
|
|
302
|
+
"RecordEntry",
|
|
303
|
+
"RecordFormatError",
|
|
304
|
+
"RecordedRequest",
|
|
305
|
+
"RecordingProvider",
|
|
306
|
+
"RegisteredTool",
|
|
307
|
+
"RequestSink",
|
|
308
|
+
"RetryAction",
|
|
309
|
+
"RetryHooks",
|
|
310
|
+
"RewriteRequest",
|
|
311
|
+
"RouterToolExecutor",
|
|
312
|
+
"SandboxBackend",
|
|
313
|
+
"SandboxEnforcement",
|
|
314
|
+
"SandboxedToolExecutor",
|
|
315
|
+
"SessionApprovalCache",
|
|
316
|
+
"SkillConfig",
|
|
317
|
+
"SkillDefinition",
|
|
318
|
+
"SystemPromptFragment",
|
|
319
|
+
"SkillExecutor",
|
|
320
|
+
"SkillHooks",
|
|
321
|
+
"SkillProvider",
|
|
322
|
+
"SkillSummary",
|
|
323
|
+
"SpillHooks",
|
|
324
|
+
"SpillStore",
|
|
325
|
+
"StaticWorldStateSection",
|
|
326
|
+
"SteerableRuntimeError",
|
|
327
|
+
"StorageAdapter",
|
|
328
|
+
"StorageError",
|
|
329
|
+
"SubagentConfig",
|
|
330
|
+
"SubagentExecutor",
|
|
331
|
+
"TextPart",
|
|
332
|
+
"ToolDispatchError",
|
|
333
|
+
"ToolExecutor",
|
|
334
|
+
"ToolExposure",
|
|
335
|
+
"ToolRouter",
|
|
336
|
+
"TraceRecorder",
|
|
337
|
+
"TranscriptAppend",
|
|
338
|
+
"TransportAdapter",
|
|
339
|
+
"TransportError",
|
|
340
|
+
"UsageCalibration",
|
|
341
|
+
"WorldStateFragment",
|
|
342
|
+
"WorldStateHooks",
|
|
343
|
+
"WorldStatePatchFragment",
|
|
344
|
+
"WorldStateSection",
|
|
345
|
+
"apply_merge_patch",
|
|
346
|
+
"assert_bounded_items",
|
|
347
|
+
"assert_requests_match_record",
|
|
348
|
+
"assert_stable_prefix",
|
|
349
|
+
"branch_label",
|
|
350
|
+
"build_step_decision_event",
|
|
351
|
+
"clamp_reasoning_effort",
|
|
352
|
+
"close_dangling_tool_calls",
|
|
353
|
+
"detect_claimed_execution",
|
|
354
|
+
"detect_deferred_execution",
|
|
355
|
+
"detect_deferred_execution_eager",
|
|
356
|
+
"detect_execution_intent_in_user_message",
|
|
357
|
+
"entry_from_dict",
|
|
358
|
+
"entry_to_dict",
|
|
359
|
+
"estimate_cost_usd",
|
|
360
|
+
"estimate_text_tokens",
|
|
361
|
+
"estimate_tokens",
|
|
362
|
+
"export_otlp_http",
|
|
363
|
+
"export_trace",
|
|
364
|
+
"extract_inline_tool_calls",
|
|
365
|
+
"factor_for_model",
|
|
366
|
+
"fork_record",
|
|
367
|
+
"last_world_state_snapshot",
|
|
368
|
+
"lineage",
|
|
369
|
+
"load_history_transcript",
|
|
370
|
+
"load_recorded_requests",
|
|
371
|
+
"load_transcript",
|
|
372
|
+
"matches_conditions",
|
|
373
|
+
"mcp_invoker",
|
|
374
|
+
"merge_patch",
|
|
375
|
+
"message_from_dict",
|
|
376
|
+
"message_to_dict",
|
|
377
|
+
"orchestration_tool_descriptors",
|
|
378
|
+
"parse_grounding_verdict",
|
|
379
|
+
"parse_mcp_name",
|
|
380
|
+
"parse_turn_route",
|
|
381
|
+
"place_cache_breakpoints",
|
|
382
|
+
"price_for_model",
|
|
383
|
+
"project_transcript",
|
|
384
|
+
"qualify_mcp_name",
|
|
385
|
+
"reduce_execution_state",
|
|
386
|
+
"register_mcp_catalog",
|
|
387
|
+
"register_model_factor",
|
|
388
|
+
"register_model_info",
|
|
389
|
+
"register_model_price",
|
|
390
|
+
"register_tool_search",
|
|
391
|
+
"render_fragment_capped",
|
|
392
|
+
"render_skill_catalog",
|
|
393
|
+
"resolve_fork_seq",
|
|
394
|
+
"resolve_model_info",
|
|
395
|
+
"rule_from_amendment",
|
|
396
|
+
"select_catalog",
|
|
397
|
+
"select_skills",
|
|
398
|
+
"should_run_grounding_judge",
|
|
399
|
+
"skill_to_dict",
|
|
400
|
+
"skill_tool_descriptor",
|
|
401
|
+
"subagent_tool_descriptor",
|
|
402
|
+
"system_blocks_with_cache",
|
|
403
|
+
"text_parts",
|
|
404
|
+
"to_otlp_json",
|
|
405
|
+
"tool",
|
|
406
|
+
"tool_search_descriptor",
|
|
407
|
+
"upgrade_entry_dict",
|
|
408
|
+
]
|
|
409
|
+
|
|
410
|
+
__version__ = "0.1.0"
|
|
@@ -471,28 +471,27 @@ class AntiHallucinationHooks(NoopHooks):
|
|
|
471
471
|
or not self._config.force_tool_choice
|
|
472
472
|
or not self._config.tools_available
|
|
473
473
|
):
|
|
474
|
-
return PreStepAction(kind="proceed"
|
|
474
|
+
return PreStepAction(kind="proceed")
|
|
475
475
|
self._route = await self._classify_route()
|
|
476
476
|
if self._route == "require_tool":
|
|
477
477
|
return PreStepAction(
|
|
478
478
|
kind="proceed",
|
|
479
|
-
transcript=transcript,
|
|
480
479
|
tool_choice=self._config.force_tool_choice,
|
|
481
480
|
)
|
|
482
|
-
return PreStepAction(kind="proceed"
|
|
481
|
+
return PreStepAction(kind="proceed")
|
|
483
482
|
|
|
484
483
|
async def _classify_route(self) -> DataNeedRoute:
|
|
485
484
|
from .llm import LLMMessage
|
|
486
485
|
|
|
487
486
|
try:
|
|
488
487
|
messages = [
|
|
489
|
-
LLMMessage(
|
|
488
|
+
LLMMessage.text_of(m["role"], m["content"])
|
|
490
489
|
for m in build_turn_route_messages(
|
|
491
490
|
self._config.user_question, self._config.last_assistant_tail
|
|
492
491
|
)
|
|
493
492
|
]
|
|
494
493
|
reply, _usage = await self._provider.complete(messages, temperature=0)
|
|
495
|
-
parsed = parse_turn_route(reply.
|
|
494
|
+
parsed = parse_turn_route(reply.content_text)
|
|
496
495
|
if parsed:
|
|
497
496
|
return parsed["route"] # type: ignore[return-value]
|
|
498
497
|
except Exception:
|
|
@@ -594,11 +593,11 @@ class AntiHallucinationHooks(NoopHooks):
|
|
|
594
593
|
|
|
595
594
|
try:
|
|
596
595
|
messages = [
|
|
597
|
-
LLMMessage(
|
|
596
|
+
LLMMessage.text_of(m["role"], m["content"])
|
|
598
597
|
for m in build_grounding_messages(user_question, assistant_reply)
|
|
599
598
|
]
|
|
600
599
|
reply, _usage = await self._provider.complete(messages, temperature=0)
|
|
601
|
-
return parse_grounding_verdict(reply.
|
|
600
|
+
return parse_grounding_verdict(reply.content_text)
|
|
602
601
|
except Exception:
|
|
603
602
|
return None
|
|
604
603
|
|