phronomy 0.17.0 → 0.18.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +97 -1134
- data/README.md +68 -1280
- data/benchmark/bench_regression.rb +25 -5
- data/docs/changelog/0.14-and-earlier.md +1137 -0
- data/docs/decisions/008-orchestrator-uses-os-threads.md +46 -48
- data/docs/decisions/010-cooperative-first-concurrency.md +155 -235
- data/docs/features.md +87 -0
- data/docs/getting-started.md +351 -0
- data/docs/migrations/0.15.md +35 -0
- data/docs/migrations/0.16.md +43 -0
- data/docs/runtime-and-concurrency.md +258 -0
- data/examples/workflows/generic_task_event_mapping.rb +14 -6
- data/lib/phronomy/agent/agent_invocation_session_builder.rb +2 -2
- data/lib/phronomy/agent/async_event_api.rb +3 -3
- data/lib/phronomy/agent/base.rb +35 -19
- data/lib/phronomy/agent/context/capability/base.rb +13 -3
- data/lib/phronomy/agent/execution_coordinator.rb +6 -6
- data/lib/phronomy/agent/shared_state.rb +2 -0
- data/lib/phronomy/agent/tool_executor.rb +29 -71
- data/lib/phronomy/agent/tool_invocation.rb +97 -47
- data/lib/phronomy/agent/tool_invocation_session_builder.rb +55 -161
- data/lib/phronomy/configuration.rb +5 -29
- data/lib/phronomy/diagnostics.rb +12 -41
- data/lib/phronomy/engine/concurrency/async_queue.rb +5 -188
- data/lib/phronomy/engine/concurrency/cancellation_scope.rb +6 -7
- data/lib/phronomy/engine/concurrency/cancellation_token.rb +48 -3
- data/lib/phronomy/engine/concurrency/deadline.rb +2 -3
- data/lib/phronomy/engine/concurrency/offload_pool.rb +696 -0
- data/lib/phronomy/engine/concurrency/pool_registry.rb +5 -5
- data/lib/phronomy/engine/event_loop.rb +89 -190
- data/lib/phronomy/engine/runtime/timer_queue.rb +48 -71
- data/lib/phronomy/engine/runtime/timer_service.rb +13 -21
- data/lib/phronomy/engine/runtime.rb +45 -158
- data/lib/phronomy/engine/task.rb +136 -277
- data/lib/phronomy/llm_adapter/base.rb +14 -14
- data/lib/phronomy/llm_adapter/ruby_llm.rb +3 -4
- data/lib/phronomy/llm_adapter.rb +2 -2
- data/lib/phronomy/metrics.rb +15 -30
- data/lib/phronomy/multi_agent/fan_out_invocation.rb +146 -0
- data/lib/phronomy/multi_agent/fan_out_session_builder.rb +125 -0
- data/lib/phronomy/multi_agent/handoff.rb +1 -0
- data/lib/phronomy/multi_agent/orchestrator.rb +147 -99
- data/lib/phronomy/multi_agent/team_coordinator.rb +2 -0
- data/lib/phronomy/testing/eval/comparison.rb +23 -0
- data/lib/phronomy/testing/eval/dataset.rb +27 -0
- data/lib/phronomy/testing/eval/eval_case.rb +13 -0
- data/lib/phronomy/testing/eval/eval_result.rb +16 -0
- data/lib/phronomy/testing/eval/metrics.rb +43 -0
- data/lib/phronomy/testing/eval/runner.rb +52 -0
- data/lib/phronomy/testing/eval/scorer/base.rb +15 -0
- data/lib/phronomy/testing/eval/scorer/exact_match.rb +25 -0
- data/lib/phronomy/testing/eval/scorer/includes_scorer.rb +25 -0
- data/lib/phronomy/testing/eval/scorer/llm_judge.rb +46 -0
- data/lib/phronomy/testing/eval/scorer.rb +10 -0
- data/lib/phronomy/testing/eval.rb +9 -0
- data/lib/phronomy/testing/fake_clock.rb +6 -53
- data/lib/phronomy/testing.rb +2 -6
- data/lib/phronomy/tools/agent.rb +141 -6
- data/lib/phronomy/vector_store/async_backend.rb +21 -17
- data/lib/phronomy/vector_store/base.rb +2 -2
- data/lib/phronomy/vector_store/embeddings/base.rb +6 -5
- data/lib/phronomy/version.rb +1 -1
- data/lib/phronomy/workflow_runner.rb +2 -4
- data/lib/phronomy.rb +7 -4
- data/scripts/api_snapshot.rb +4 -4
- metadata +23 -31
- data/lib/phronomy/engine/concurrency/blocking_adapter_pool.rb +0 -561
- data/lib/phronomy/engine/runtime/deterministic_scheduler.rb +0 -439
- data/lib/phronomy/engine/runtime/fake_scheduler.rb +0 -165
- data/lib/phronomy/engine/runtime/runtime_metrics.rb +0 -116
- data/lib/phronomy/engine/runtime/scheduler.rb +0 -98
- data/lib/phronomy/engine/runtime/scheduler_timer_adapter.rb +0 -79
- data/lib/phronomy/engine/runtime/task_registry.rb +0 -95
- data/lib/phronomy/engine/runtime/thread_scheduler.rb +0 -30
- data/lib/phronomy/engine/task/backend.rb +0 -80
- data/lib/phronomy/engine/task/deferred_backend.rb +0 -73
- data/lib/phronomy/engine/task/fiber_backend.rb +0 -157
- data/lib/phronomy/engine/task/immediate_backend.rb +0 -89
- data/lib/phronomy/engine/task/mapped_backend.rb +0 -90
- data/lib/phronomy/engine/task/thread_backend.rb +0 -84
- data/lib/phronomy/engine/task_group.rb +0 -193
- data/lib/phronomy/eval/comparison.rb +0 -47
- data/lib/phronomy/eval/dataset.rb +0 -45
- data/lib/phronomy/eval/eval_case.rb +0 -17
- data/lib/phronomy/eval/eval_result.rb +0 -29
- data/lib/phronomy/eval/metrics.rb +0 -66
- data/lib/phronomy/eval/runner.rb +0 -94
- data/lib/phronomy/eval/scorer/base.rb +0 -22
- data/lib/phronomy/eval/scorer/exact_match.rb +0 -31
- data/lib/phronomy/eval/scorer/includes_scorer.rb +0 -32
- data/lib/phronomy/eval/scorer/llm_judge.rb +0 -72
- data/lib/phronomy/eval/scorer.rb +0 -9
- data/lib/phronomy/eval.rb +0 -7
- data/lib/phronomy/testing/fake_scheduler.rb +0 -104
- data/lib/phronomy/testing/scheduler_helpers.rb +0 -68
|
@@ -2,12 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
# bench_regression.rb — Targeted regression benchmarks.
|
|
4
4
|
#
|
|
5
|
-
# Measures the
|
|
5
|
+
# Measures the six minimum regression targets:
|
|
6
6
|
# 1. WorkflowContext#merge throughput
|
|
7
7
|
# 2. Workflow.define (graph build) time
|
|
8
8
|
# 3. Tool::Base#params_schema generation (10 params)
|
|
9
9
|
# 4. Orchestrator#dispatch_parallel overhead (10 stub agents, no LLM)
|
|
10
|
-
# 5. CancellationToken#cancelled? throughput
|
|
10
|
+
# 5. CancellationToken#cancelled? throughput under deliberate Thread contention
|
|
11
|
+
# 6. CancellationToken#raise_if_cancelled! hot path
|
|
12
|
+
#
|
|
13
|
+
# Target 4 deliberately uses thread-free completion handles so the benchmark
|
|
14
|
+
# measures EventLoop/FanOut coordination rather than fake per-child Thread.new
|
|
15
|
+
# overhead. Target 5 intentionally uses Threads because cross-thread token access
|
|
16
|
+
# is the behavior being measured there; it is not a Phronomy runtime execution
|
|
17
|
+
# path.
|
|
11
18
|
#
|
|
12
19
|
# Results are stored in a global REGRESSION_RESULTS hash (keyed by metric name,
|
|
13
20
|
# value = iterations per second) for use by run_all.rb baseline comparison.
|
|
@@ -89,10 +96,20 @@ end
|
|
|
89
96
|
# ---------------------------------------------------------------------------
|
|
90
97
|
stub_agent_class = Class.new(Phronomy::Agent::Base) do
|
|
91
98
|
agent_definition id: "bench-stub", version: 1
|
|
99
|
+
|
|
92
100
|
define_method(:invoke) do |_input, thread_id: nil, config: {}|
|
|
93
101
|
{output: "stub", messages: []}
|
|
94
102
|
end
|
|
95
|
-
|
|
103
|
+
|
|
104
|
+
define_method(:invoke_async) do |input, **_kw|
|
|
105
|
+
task = Phronomy::Task.deferred(name: "bench-stub")
|
|
106
|
+
begin
|
|
107
|
+
task.complete(invoke(input))
|
|
108
|
+
rescue => error
|
|
109
|
+
task.fail(error)
|
|
110
|
+
end
|
|
111
|
+
task
|
|
112
|
+
end
|
|
96
113
|
end
|
|
97
114
|
|
|
98
115
|
orchestrator_class = Class.new(Phronomy::MultiAgent::Orchestrator)
|
|
@@ -108,8 +125,11 @@ t4 = Benchmark.measure("Orchestrator#dispatch_parallel (10 agents)") do
|
|
|
108
125
|
end
|
|
109
126
|
|
|
110
127
|
# ---------------------------------------------------------------------------
|
|
111
|
-
# Target 5: CancellationToken#cancelled? throughput (8
|
|
128
|
+
# Target 5: CancellationToken#cancelled? throughput (8 application Threads)
|
|
112
129
|
# ---------------------------------------------------------------------------
|
|
130
|
+
# Threads are intentional here: the benchmark specifically measures concurrent
|
|
131
|
+
# access to one shared CancellationToken. They are not used to execute Phronomy
|
|
132
|
+
# Agent/Workflow/Tool lifecycle work.
|
|
113
133
|
CANCEL_TOKEN = Phronomy::Concurrency::CancellationToken.new
|
|
114
134
|
CANCEL_ITERATIONS = 10_000
|
|
115
135
|
|
|
@@ -123,7 +143,7 @@ end
|
|
|
123
143
|
# ---------------------------------------------------------------------------
|
|
124
144
|
# Target 6: CancellationToken#raise_if_cancelled! hot path (no-op, single thread)
|
|
125
145
|
# ---------------------------------------------------------------------------
|
|
126
|
-
RAISE_TOKEN = Phronomy::Concurrency::CancellationToken.new
|
|
146
|
+
RAISE_TOKEN = Phronomy::Concurrency::CancellationToken.new # not cancelled — no-op path
|
|
127
147
|
RAISE_ITERATIONS = 200_000
|
|
128
148
|
|
|
129
149
|
t6 = Benchmark.measure("CancellationToken#raise_if_cancelled! (no-op)") do
|