Class: Insika::DSL::WorkflowAdapter::Context
- Inherits:
-
Object
- Object
- Insika::DSL::WorkflowAdapter::Context
- Defined in:
- lib/insika/dsl/workflow_adapter.rb
Overview
What a workflow block receives. Deliberately tiny: the value of a workflow is deterministic Ruby AROUND model calls, not a framework.
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
contextis the turn's ContextPackage;toolsare the resolved, enveloped tool instances (already filtered by the agent's policy). -
#tools ⇒ Object
readonly
contextis the turn's ContextPackage;toolsare the resolved, enveloped tool instances (already filtered by the agent's policy).
Instance Method Summary collapse
-
#ask(agent, message, timeout: nil) ⇒ Object
One turn against one agent of the system → its text.
-
#gather(*blocks, max: 8) ⇒ Object
Runs blocks CONCURRENTLY on the turn's reactor and returns their values IN ORDER — the fan-out/fan-in step.
-
#initialize(runtime:, context:, tools:) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(runtime:, context:, tools:) ⇒ Context
Returns a new instance of Context.
30 31 32 33 34 |
# File 'lib/insika/dsl/workflow_adapter.rb', line 30 def initialize(runtime:, context:, tools:) @runtime = runtime @context = context @tools = tools end |
Instance Attribute Details
#context ⇒ Object (readonly)
context is the turn's ContextPackage; tools are the resolved,
enveloped tool instances (already filtered by the agent's policy).
28 29 30 |
# File 'lib/insika/dsl/workflow_adapter.rb', line 28 def context @context end |
#tools ⇒ Object (readonly)
context is the turn's ContextPackage; tools are the resolved,
enveloped tool instances (already filtered by the agent's policy).
28 29 30 |
# File 'lib/insika/dsl/workflow_adapter.rb', line 28 def tools @tools end |
Instance Method Details
#ask(agent, message, timeout: nil) ⇒ Object
One turn against one agent of the system → its text.
Stateless by design (no session): a workflow step is a unit of work, not a conversation, and threading a session here would also drag in the serving teardown path. Each step is its own Task, so every step of a workflow is separately visible in the Studio and the trace.
42 43 44 |
# File 'lib/insika/dsl/workflow_adapter.rb', line 42 def ask(agent, , timeout: nil) @runtime.chat(.to_s, agent: agent.to_s, timeout: timeout) end |
#gather(*blocks, max: 8) ⇒ Object
Runs blocks CONCURRENTLY on the turn's reactor and returns their values IN ORDER — the fan-out/fan-in step. Thin pass-through to the engine's own helper so a workflow does not hand-roll Async.
sec, perf = ctx.gather(-> { ctx.ask("security", code) },
-> { ctx.ask("performance", code) })
52 53 54 55 |
# File 'lib/insika/dsl/workflow_adapter.rb', line 52 def gather(*blocks, max: 8) require_relative "../tools/concurrency" Insika::Tools::Concurrency.gather(*blocks, max: max) end |