phronomy 0.4.0 → 0.5.1
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 +77 -0
- data/README.md +19 -15
- data/lib/phronomy/agent/base.rb +109 -379
- data/lib/phronomy/agent/checkpoint.rb +12 -5
- data/lib/phronomy/agent/concerns/before_completion.rb +105 -0
- data/lib/phronomy/agent/concerns/guardrailable.rb +42 -0
- data/lib/phronomy/agent/concerns/retryable.rb +88 -0
- data/lib/phronomy/agent/concerns/suspendable.rb +116 -0
- data/lib/phronomy/agent/react_agent.rb +37 -16
- data/lib/phronomy/agent/team_coordinator.rb +4 -4
- data/lib/phronomy/ruby_llm_patches.rb +15 -11
- data/lib/phronomy/tool/mcp_tool.rb +21 -7
- data/lib/phronomy/version.rb +1 -1
- data/lib/phronomy.rb +0 -3
- metadata +6 -7
- data/lib/generators/phronomy/install/install_generator.rb +0 -41
- data/lib/generators/phronomy/install/templates/create_phronomy_messages.rb.tt +0 -15
- data/lib/generators/phronomy/install/templates/initializer.rb.tt +0 -18
- data/lib/generators/phronomy/install/templates/message_model.rb.tt +0 -8
- data/lib/phronomy/railtie.rb +0 -39
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8ca63f10e2d505005a6011a8755135e0dea1c3d8e8013ae3b2ea1d3b5ecf13d3
|
|
4
|
+
data.tar.gz: 420ec691725b6450a0430cdce90372c13da4e73d7013a630b2aa33a7b72e496d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 300b155e482fe0b0015bba5d3985c8d37f2599828d9d87763cc5d9925c3bf399cbee46a658d48a79e152d9b410505609e35a89d3b02db632d51b85280938dc8c
|
|
7
|
+
data.tar.gz: 88184d595d04eb1ed1be8c6ec145476a5e1f7e6e02e52658f9d80ad3893a29fbcfc377c736b7c0de10deb14e6105bd9594d6b950bd2fb3afda800e770a2219c4
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,83 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [0.5.1] - 2026-05-21
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **Remove broken Rails generator and Railtie** (#85): The generator template
|
|
15
|
+
referenced `Phronomy::ActiveRecord::ActsAs` which no longer exists, causing
|
|
16
|
+
`rails generate phronomy:install` to produce broken model files. Removed
|
|
17
|
+
`lib/generators/`, `lib/phronomy/railtie.rb`, and all references in
|
|
18
|
+
`lib/phronomy.rb`.
|
|
19
|
+
|
|
20
|
+
- **Fix thread-safety of `StdioTransport#rpc_call`** (#86): Concurrent calls
|
|
21
|
+
to the same `McpTool` instance could interleave JSON-RPC writes and reads,
|
|
22
|
+
corrupting request/response pairing. A `Mutex` is now held around each
|
|
23
|
+
write+read cycle. Also adds the missing `require "securerandom"`.
|
|
24
|
+
|
|
25
|
+
### Documentation
|
|
26
|
+
|
|
27
|
+
- **README corrections** (#87): Remove stale Rails generator installation
|
|
28
|
+
instructions. Clarify that `TeamCoordinator` worker state is local to a
|
|
29
|
+
single `invoke` call (not persistent across calls). Annotate app-level
|
|
30
|
+
examples (`09_rails_chat`, `15_rails_secure_chat`, `18_rails_agent_job`,
|
|
31
|
+
`19_trust_pipeline`) as requiring external infrastructure. Add scope note
|
|
32
|
+
to `Agent::Orchestrator` section.
|
|
33
|
+
|
|
34
|
+
### Maintenance
|
|
35
|
+
|
|
36
|
+
- **Add version guard to `ruby_llm_patches.rb`** (#88): The monkey-patch for
|
|
37
|
+
the upstream `handle_error_chunk` bug (ruby_llm <= 1.15.0) is now
|
|
38
|
+
gated behind a `Gem::Version` check so upgrading ruby_llm will
|
|
39
|
+
automatically disable the override.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## [0.5.0] - 2026-05-20
|
|
44
|
+
|
|
45
|
+
### Breaking Changes
|
|
46
|
+
|
|
47
|
+
- **`Agent::Base#invoke` and `#stream` — `messages` and `thread_id` promoted to
|
|
48
|
+
top-level keyword arguments**:
|
|
49
|
+
Previously these values were passed inside the `config:` hash. They are now
|
|
50
|
+
explicit keyword arguments. The `config:` hash retains other runtime options
|
|
51
|
+
such as `:knowledge_sources`, `:user_id`, and `:session_id`.
|
|
52
|
+
|
|
53
|
+
**Before (v0.4.x)**:
|
|
54
|
+
```ruby
|
|
55
|
+
agent.invoke(input, config: { messages: prior_msgs, thread_id: "t1" })
|
|
56
|
+
agent.stream(input, config: { messages: prior_msgs, thread_id: "t1" }) { |e| ... }
|
|
57
|
+
```
|
|
58
|
+
**After (v0.5.0)**:
|
|
59
|
+
```ruby
|
|
60
|
+
agent.invoke(input, messages: prior_msgs, thread_id: "t1")
|
|
61
|
+
agent.stream(input, messages: prior_msgs, thread_id: "t1") { |e| ... }
|
|
62
|
+
```
|
|
63
|
+
Applications that only pass `:knowledge_sources`, `:user_id`, or `:session_id`
|
|
64
|
+
in `config:` require no changes.
|
|
65
|
+
|
|
66
|
+
- **`Agent::Checkpoint#initialize` — `original_input:` is now a required keyword
|
|
67
|
+
argument**: Applications that construct `Checkpoint` instances directly must
|
|
68
|
+
add `original_input: input`. Checkpoints produced by `#invoke` already include
|
|
69
|
+
this field automatically.
|
|
70
|
+
|
|
71
|
+
### Fixed
|
|
72
|
+
|
|
73
|
+
- **`ReactAgent#step` — system instructions were never applied**: The first
|
|
74
|
+
iteration of the ReAct loop now calls `build_context` to assemble the system
|
|
75
|
+
prompt and history, matching the behaviour of `Agent::Base`. Subsequent
|
|
76
|
+
iterations re-apply instructions via `build_cached_system_text` before calling
|
|
77
|
+
`chat.complete`. Previously, all iterations silently omitted the system prompt.
|
|
78
|
+
|
|
79
|
+
- **`Agent::Base#resume` — system instructions were not re-applied after
|
|
80
|
+
suspension**: Resuming from a `Checkpoint` now calls `build_cached_system_text`
|
|
81
|
+
using the original input stored in the checkpoint, so the LLM receives the
|
|
82
|
+
correct system prompt when the conversation continues. Previously, the LLM was
|
|
83
|
+
called without any system instructions on resume.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
10
87
|
## [0.4.0] - 2026-05-19
|
|
11
88
|
|
|
12
89
|
### Removed
|
data/README.md
CHANGED
|
@@ -20,7 +20,7 @@ It provides composable building blocks — Workflows, Agents, Tools, Guardrails,
|
|
|
20
20
|
| **Multi-agent** — Agent-as-Tool pattern and hub-and-spoke handoff routing | Beta |
|
|
21
21
|
| **GeneratorVerifier** — Generator-Verifier loop with injectable prompt builders/parsers | Beta |
|
|
22
22
|
| **Agent::Orchestrator** — Parallel subagent dispatch, fan-out, and `subagent` DSL | Beta |
|
|
23
|
-
| **Agent::TeamCoordinator** — Agent teams pattern: LLM coordinator +
|
|
23
|
+
| **Agent::TeamCoordinator** — Agent teams pattern: LLM coordinator + stateful worker pool with task queue (worker-local message history per run) | Beta |
|
|
24
24
|
| **Agent::SharedState** — Shared state pattern: peer agents collaborate via a shared KnowledgeStore; `member` DSL with per-agent instructions and `coordination` team protocol | Experimental |
|
|
25
25
|
| **Guardrails** — Input/output validation; built-in PII and prompt-injection detectors | Beta |
|
|
26
26
|
| **Output Parser** — JSON and Struct-mapped parsers for structured LLM responses | Stable |
|
|
@@ -42,14 +42,6 @@ Then run:
|
|
|
42
42
|
bundle install
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
For Rails apps, run the install generator after bundling:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
rails generate phronomy:install
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
This creates a configuration initializer.
|
|
52
|
-
|
|
53
45
|
## Quick Start
|
|
54
46
|
|
|
55
47
|
### Agent — ReAct tool-calling agent
|
|
@@ -279,6 +271,11 @@ end
|
|
|
279
271
|
|
|
280
272
|
### Agent::Orchestrator — Parallel subagent dispatch
|
|
281
273
|
|
|
274
|
+
> **Note:** `dispatch_parallel` and `fan_out` use plain Ruby threads and are
|
|
275
|
+
> intended for small-scale fan-out (a handful of subagents). For large-scale
|
|
276
|
+
> parallel dispatch, manage concurrency (thread pools, rate limiting) at the
|
|
277
|
+
> application level.
|
|
278
|
+
|
|
282
279
|
```ruby
|
|
283
280
|
class ResearchOrchestrator < Phronomy::Agent::Orchestrator
|
|
284
281
|
model "gpt-4o"
|
|
@@ -396,18 +393,19 @@ search_tool = Phronomy::Tool::McpTool.from_server(
|
|
|
396
393
|
|
|
397
394
|
### Conversation History — passing prior messages
|
|
398
395
|
|
|
399
|
-
Phronomy does not manage conversation history internally.
|
|
400
|
-
message array and passes it in via `
|
|
396
|
+
Phronomy does not manage conversation history internally. The application owns the
|
|
397
|
+
message array and passes it in via the `messages:` keyword argument:
|
|
401
398
|
|
|
402
399
|
```ruby
|
|
403
400
|
# First turn
|
|
404
|
-
result1 = MyAgent.new.invoke("Hello! I'm Alice.",
|
|
401
|
+
result1 = MyAgent.new.invoke("Hello! I'm Alice.", thread_id: "session-1")
|
|
405
402
|
prior_messages = result1[:messages] # Array<RubyLLM::Message>
|
|
406
403
|
|
|
407
404
|
# Second turn — pass prior messages so the agent has context
|
|
408
405
|
result2 = MyAgent.new.invoke(
|
|
409
406
|
"What is my name?",
|
|
410
|
-
|
|
407
|
+
messages: prior_messages,
|
|
408
|
+
thread_id: "session-1"
|
|
411
409
|
)
|
|
412
410
|
puts result2[:output] # => "Your name is Alice."
|
|
413
411
|
```
|
|
@@ -490,15 +488,21 @@ bundle exec ruby NN_example_name/run.rb
|
|
|
490
488
|
| 06 | `06_guardrails/` | Input/output guardrails |
|
|
491
489
|
| 07 | `07_tracing/` | Custom observability with Langfuse tracer |
|
|
492
490
|
| 08 | `08_mcp_tool/` | MCP tool integration |
|
|
493
|
-
| 09 | `09_rails_chat/` | Rails chat app with ActionCable streaming |
|
|
494
491
|
| 10 | `10_context_management/` | Token budget and context pruning |
|
|
495
492
|
| 11 | `11_agent_streaming/` | Streaming agent responses |
|
|
496
493
|
| 12 | `12_prompt_template/` | Advanced prompt templates |
|
|
497
494
|
| 13 | `13_mcp_http_tool/` | HTTP-based MCP tool server |
|
|
498
495
|
| 14 | `14_code_review/` | Automated code review agent |
|
|
499
|
-
| 15 | `15_rails_secure_chat/` | Rails chat with PII guardrails |
|
|
500
496
|
| 16 | `16_before_completion_hook/` | Global/class/instance before_completion hooks |
|
|
501
497
|
| 17 | `17_multi_agent_handoff/` | Hub-and-spoke agent routing via Runner |
|
|
498
|
+
|
|
499
|
+
The following examples are **app-level demos** (Rails apps or advanced pipelines)
|
|
500
|
+
that require additional infrastructure (a running Rails server, database, etc.):
|
|
501
|
+
|
|
502
|
+
| # | Directory | What it demonstrates |
|
|
503
|
+
|---|-----------|----------------------|
|
|
504
|
+
| 09 | `09_rails_chat/` | Rails chat app with ActionCable streaming |
|
|
505
|
+
| 15 | `15_rails_secure_chat/` | Rails chat with PII guardrails |
|
|
502
506
|
| 18 | `18_rails_agent_job/` | Rails app with AgentJob + ActionCable streaming |
|
|
503
507
|
| 19 | `19_trust_pipeline/` | Generator-Verifier pattern with citation tracking, self-review loop and confidence gate |
|
|
504
508
|
|