Class: Insika::AgentProfile
- Inherits:
-
Data
- Object
- Data
- Insika::AgentProfile
- Defined in:
- lib/insika/agent_profile.rb,
lib/insika/agent_profile.rb
Overview
Reopened class (not a Data.define block): a constant assigned inside the block would leak into the lexical scope (Insika::DEFAULT_LIMITS).
Constant Summary collapse
- DEFAULT_LIMITS =
{ turn_timeout: 300, tool_timeout: 60, provider_timeout: 5, context_budget: 8_000, max_tool_calls: 50, approval_timeout: 3_600, # cap on the wait for human approval (~1h) # Item 30: parallel tool calls. ONE number is both the switch and the cap # (nil/0/1 = serial, the default; N > 1 = at most N tool calls in flight). # It sits next to tool_timeout/max_tool_calls because it is the third bound # on tool execution. Read through TurnState#tool_concurrency, which also # applies the approval gate (D3). tool_concurrency: 1 }.freeze
Instance Attribute Summary collapse
-
#approvals_required ⇒ Object
readonly
Returns the value of attribute approvals_required.
-
#base_prompt ⇒ Object
readonly
Returns the value of attribute base_prompt.
-
#capabilities ⇒ Object
readonly
Returns the value of attribute capabilities.
-
#capabilities_declared ⇒ Object
readonly
Returns the value of attribute capabilities_declared.
-
#context_providers ⇒ Object
readonly
Returns the value of attribute context_providers.
-
#edge_stream ⇒ Object
readonly
Returns the value of attribute edge_stream.
-
#guardrails ⇒ Object
readonly
Returns the value of attribute guardrails.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#limits ⇒ Object
readonly
Returns the value of attribute limits.
-
#memory ⇒ Object
readonly
Returns the value of attribute memory.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#model_policy ⇒ Object
readonly
Returns the value of attribute model_policy.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#policies ⇒ Object
readonly
Returns the value of attribute policies.
-
#prompt_caching ⇒ Object
readonly
Returns the value of attribute prompt_caching.
-
#prompt_files ⇒ Object
readonly
Returns the value of attribute prompt_files.
-
#prompt_refs ⇒ Object
readonly
Returns the value of attribute prompt_refs.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#refinement ⇒ Object
readonly
Returns the value of attribute refinement.
-
#sandbox ⇒ Object
readonly
Returns the value of attribute sandbox.
-
#skills ⇒ Object
readonly
Returns the value of attribute skills.
-
#subagents ⇒ Object
readonly
Returns the value of attribute subagents.
-
#tools_allow ⇒ Object
readonly
Returns the value of attribute tools_allow.
-
#tools_allow_groups ⇒ Object
readonly
Returns the value of attribute tools_allow_groups.
-
#tools_deferred ⇒ Object
readonly
Returns the value of attribute tools_deferred.
-
#tools_deny ⇒ Object
readonly
Returns the value of attribute tools_deny.
-
#workflows_allow ⇒ Object
readonly
Returns the value of attribute workflows_allow.
Class Method Summary collapse
-
.build(id:, model: nil, provider: nil, base_prompt: "", prompt_files: [], tools_allow: nil, tools_deny: [], tools_allow_groups: nil, skills: nil, context_providers: nil, workflows_allow: nil, policies: [], prompt_refs: [], limits: {}, approvals_required: nil, capabilities: nil, subagents: nil, tools_deferred: nil, memory: nil, prompt_caching: nil, params: {}, model_policy: nil, guardrails: nil, sandbox: nil, refinement: nil, capabilities_declared: nil, edge_stream: nil, metadata: {}) ⇒ Object
modelis OPTIONAL as of v2 (§10): an agent without one resolves the platformdefault_model(Settings) at turn start via the ModelResolver.
Instance Method Summary collapse
-
#store_id ⇒ Object
store_id of the turn context (ctx.store_id): lives in
metadata(stable per store, comes from the pack). -
#stream_public?(channel) ⇒ Boolean
May this channel (:thinking / :intermediate) cross to the customer? Tolerant of the string values a form or a pack round-trip produces ("1"/"true"), and of anything else being absent: the safe reading is the default one.
-
#tool_opted_in?(name) ⇒ Boolean
opt-in for an optional tool = being in the agent's allow list.
Instance Attribute Details
#approvals_required ⇒ Object (readonly)
Returns the value of attribute approvals_required
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def approvals_required @approvals_required end |
#base_prompt ⇒ Object (readonly)
Returns the value of attribute base_prompt
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def base_prompt @base_prompt end |
#capabilities ⇒ Object (readonly)
Returns the value of attribute capabilities
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def capabilities @capabilities end |
#capabilities_declared ⇒ Object (readonly)
Returns the value of attribute capabilities_declared
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def capabilities_declared @capabilities_declared end |
#context_providers ⇒ Object (readonly)
Returns the value of attribute context_providers
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def context_providers @context_providers end |
#edge_stream ⇒ Object (readonly)
Returns the value of attribute edge_stream
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def edge_stream @edge_stream end |
#guardrails ⇒ Object (readonly)
Returns the value of attribute guardrails
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def guardrails @guardrails end |
#id ⇒ Object (readonly)
Returns the value of attribute id
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def id @id end |
#limits ⇒ Object (readonly)
Returns the value of attribute limits
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def limits @limits end |
#memory ⇒ Object (readonly)
Returns the value of attribute memory
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def memory @memory end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def @metadata end |
#model ⇒ Object (readonly)
Returns the value of attribute model
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def model @model end |
#model_policy ⇒ Object (readonly)
Returns the value of attribute model_policy
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def model_policy @model_policy end |
#params ⇒ Object (readonly)
Returns the value of attribute params
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def params @params end |
#policies ⇒ Object (readonly)
Returns the value of attribute policies
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def policies @policies end |
#prompt_caching ⇒ Object (readonly)
Returns the value of attribute prompt_caching
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def prompt_caching @prompt_caching end |
#prompt_files ⇒ Object (readonly)
Returns the value of attribute prompt_files
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def prompt_files @prompt_files end |
#prompt_refs ⇒ Object (readonly)
Returns the value of attribute prompt_refs
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def prompt_refs @prompt_refs end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def provider @provider end |
#refinement ⇒ Object (readonly)
Returns the value of attribute refinement
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def refinement @refinement end |
#sandbox ⇒ Object (readonly)
Returns the value of attribute sandbox
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def sandbox @sandbox end |
#skills ⇒ Object (readonly)
Returns the value of attribute skills
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def skills @skills end |
#subagents ⇒ Object (readonly)
Returns the value of attribute subagents
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def subagents @subagents end |
#tools_allow ⇒ Object (readonly)
Returns the value of attribute tools_allow
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def tools_allow @tools_allow end |
#tools_allow_groups ⇒ Object (readonly)
Returns the value of attribute tools_allow_groups
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def tools_allow_groups @tools_allow_groups end |
#tools_deferred ⇒ Object (readonly)
Returns the value of attribute tools_deferred
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def tools_deferred @tools_deferred end |
#tools_deny ⇒ Object (readonly)
Returns the value of attribute tools_deny
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def tools_deny @tools_deny end |
#workflows_allow ⇒ Object (readonly)
Returns the value of attribute workflows_allow
15 16 17 |
# File 'lib/insika/agent_profile.rb', line 15 def workflows_allow @workflows_allow end |
Class Method Details
.build(id:, model: nil, provider: nil, base_prompt: "", prompt_files: [], tools_allow: nil, tools_deny: [], tools_allow_groups: nil, skills: nil, context_providers: nil, workflows_allow: nil, policies: [], prompt_refs: [], limits: {}, approvals_required: nil, capabilities: nil, subagents: nil, tools_deferred: nil, memory: nil, prompt_caching: nil, params: {}, model_policy: nil, guardrails: nil, sandbox: nil, refinement: nil, capabilities_declared: nil, edge_stream: nil, metadata: {}) ⇒ Object
model is OPTIONAL as of v2 (§10): an agent without one resolves the
platform default_model (Settings) at turn start via the ModelResolver.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/insika/agent_profile.rb', line 130 def self.build(id:, model: nil, provider: nil, base_prompt: "", prompt_files: [], tools_allow: nil, tools_deny: [], tools_allow_groups: nil, skills: nil, context_providers: nil, workflows_allow: nil, policies: [], prompt_refs: [], limits: {}, approvals_required: nil, capabilities: nil, subagents: nil, tools_deferred: nil, memory: nil, prompt_caching: nil, params: {}, model_policy: nil, guardrails: nil, sandbox: nil, refinement: nil, capabilities_declared: nil, edge_stream: nil, metadata: {}) new( id: id, model: model, provider: provider, base_prompt: base_prompt, prompt_files: Array(prompt_files), tools_allow: tools_allow, tools_deny: Array(tools_deny), tools_allow_groups: tools_allow_groups, skills: skills, context_providers: context_providers, workflows_allow: workflows_allow, policies: Array(policies), prompt_refs: Array(prompt_refs), limits: DEFAULT_LIMITS.merge(limits), approvals_required: approvals_required, capabilities: capabilities, # opt-in like capabilities: nil => NONE. Array-normalize a present value so # readers get a clean [] and the ChatBuilder gate (present? => wire) is stable. subagents: subagents.nil? ? nil : Array(subagents).map(&:to_s), tools_deferred: tools_deferred, memory: memory, prompt_caching: prompt_caching, # The free-form hashes arrive with symbol keys (internal build) OR string # keys (StoredProfileSource JSON round-trip). Normalize to string keys ONCE # here — the single front door every profile passes through — so no reader # downstream has to defend against both (store_id, model_policy, Studio forms). params: Coercion.deep_stringify(params || {}), model_policy: Coercion.deep_stringify(model_policy), guardrails: Coercion.deep_stringify(guardrails), sandbox: Coercion.deep_stringify(sandbox), refinement: Coercion.deep_stringify(refinement), # Flat [String] — the evals compare it against a case's `requires`, and a # symbol/string mix there would be a silent miss. capabilities_declared: Array(capabilities_declared).map(&:to_s), edge_stream: Coercion.deep_stringify(edge_stream || {}), metadata: Coercion.deep_stringify( || {}) ) end |
Instance Method Details
#store_id ⇒ Object
store_id of the turn context (ctx.store_id): lives in metadata (stable
per store, comes from the pack). build string-keys metadata, so a plain
string lookup is enough. nil = absent (the data-tool emits an empty header).
It is NOT achei-specific: store_id is a field of the turn-context contract
(§5), generic per project.
178 |
# File 'lib/insika/agent_profile.rb', line 178 def store_id = ( || {})["store_id"] |
#stream_public?(channel) ⇒ Boolean
May this channel (:thinking / :intermediate) cross to the customer? Tolerant of the string values a form or a pack round-trip produces ("1"/"true"), and of anything else being absent: the safe reading is the default one.
183 184 185 186 |
# File 'lib/insika/agent_profile.rb', line 183 def stream_public?(channel) v = (edge_stream || {})[channel.to_s] [true, "true", "1", "yes", "on"].include?(v) end |
#tool_opted_in?(name) ⇒ Boolean
opt-in for an optional tool = being in the agent's allow list.
169 170 171 |
# File 'lib/insika/agent_profile.rb', line 169 def tool_opted_in?(name) Array(tools_allow).include?(name) end |