flock-core 0.4.0b44__py3-none-any.whl → 0.4.0b45__py3-none-any.whl

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.

Potentially problematic release.


This version of flock-core might be problematic. Click here for more details.

@@ -5,6 +5,7 @@ including listing, adding, editing, and removing agents.
5
5
  """
6
6
 
7
7
  import questionary
8
+ from rich.box import Box
8
9
  from rich.console import Console
9
10
  from rich.panel import Panel
10
11
  from rich.table import Table
@@ -104,9 +105,11 @@ def _list_agents(flock: Flock):
104
105
  model = agent.model or flock.model or "Default"
105
106
 
106
107
  # Format description (truncate if too long)
107
- description = str(agent.description)
108
- if len(description) > 30:
108
+ description = agent.resolved_description
109
+ if description and len(description) > 30:
109
110
  description = description[:27] + "..."
111
+ elif not description:
112
+ description = "N/A"
110
113
 
111
114
  # Format input/output (truncate if too long)
112
115
  input_str = str(agent.input)
@@ -156,13 +159,13 @@ def _view_agent_details(agent: FlockAgent):
156
159
  )
157
160
 
158
161
  # Create a panel for each section
159
- basic_info = Table(show_header=False, box=None)
162
+ basic_info = Table(show_header=False, box=Box.ROUNDED, padding=(0, 2))
160
163
  basic_info.add_column("Property", style="cyan")
161
164
  basic_info.add_column("Value", style="green")
162
165
 
163
166
  basic_info.add_row("Name", agent.name)
164
167
  basic_info.add_row("Model", str(agent.model or "Default"))
165
- basic_info.add_row("Description", str(agent.description))
168
+ basic_info.add_row("Description", agent.resolved_description if agent.resolved_description else "N/A")
166
169
  basic_info.add_row("Input", str(agent.input))
167
170
  basic_info.add_row("Output", str(agent.output))
168
171
  basic_info.add_row("Write to File", str(agent.write_to_file))
@@ -329,6 +332,18 @@ def _edit_agent(flock: Flock):
329
332
 
330
333
  agent = flock._agents[agent_name]
331
334
 
335
+ if not agent:
336
+ console.print(f"[bold red]Agent '{agent_name}' not found.[/]")
337
+ return
338
+
339
+ console.print(f"\n[bold underline]Details for Agent: {agent.name}[/]")
340
+ basic_info = Table(show_header=False, box=Box.ROUNDED, padding=(0, 2))
341
+ basic_info.add_row("Name", agent.name)
342
+ description = agent.resolved_description
343
+ basic_info.add_row("Description", description if description else "N/A")
344
+ basic_info.add_row("Model", agent.model or "Flock Default")
345
+ basic_info.add_row("Input Signature", str(agent.input))
346
+
332
347
  # Choose edit method
333
348
  edit_choice = questionary.select(
334
349
  "How would you like to edit this agent?",
@@ -246,7 +246,7 @@ def create_api_router() -> APIRouter:
246
246
  """List all available agents in the currently loaded Flock."""
247
247
  logger.debug("API request: list agents")
248
248
  agents_list = [
249
- {"name": agent.name, "description": agent.description or agent.name}
249
+ {"name": agent.name, "description": agent.resolved_description or agent.name}
250
250
  for agent in flock_instance.agents.values()
251
251
  ]
252
252
  return {"agents": agents_list}
flock/core/flock_agent.py CHANGED
@@ -195,6 +195,37 @@ class FlockAgent(BaseModel, Serializable, DSPyIntegrationMixin, ABC):
195
195
  """Get a list of currently enabled modules attached to this agent."""
196
196
  return [m for m in self.modules.values() if m.config.enabled]
197
197
 
198
+ @property
199
+ def resolved_description(self) -> str | None:
200
+ """Returns the resolved agent description.
201
+ If the description is a callable, it attempts to call it.
202
+ Returns None if the description is None or a callable that fails.
203
+ """
204
+ if callable(self.description):
205
+ try:
206
+ # Attempt to call without context first.
207
+ # If callables consistently need context, this might need adjustment
208
+ # or the template-facing property might need to be simpler,
209
+ # relying on prior resolution via resolve_callables.
210
+ return self.description()
211
+ except TypeError:
212
+ # Log a warning that context might be needed?
213
+ # For now, treat as unresolvable in this simple property.
214
+ logger.warning(
215
+ f"Callable description for agent '{self.name}' could not be resolved "
216
+ f"without context via the simple 'resolved_description' property. "
217
+ f"Consider calling 'agent.resolve_callables(context)' beforehand if context is required."
218
+ )
219
+ return None # Or a placeholder like "[Callable Description]"
220
+ except Exception as e:
221
+ logger.error(
222
+ f"Error resolving callable description for agent '{self.name}': {e}"
223
+ )
224
+ return None
225
+ elif isinstance(self.description, str):
226
+ return self.description
227
+ return None
228
+
198
229
  # --- Lifecycle Hooks (Keep as they were) ---
199
230
  async def initialize(self, inputs: dict[str, Any]) -> None:
200
231
  """Initialize agent and run module initializers."""
@@ -23,12 +23,13 @@
23
23
  hx-indicator="#agent-detail-loading-indicator">
24
24
 
25
25
  <fieldset>
26
- <label for="agent_name_field">Name *</label>
27
- <input type="text" id="agent_name_field" name="agent_name" value="{{ agent.name if agent and not form_errors else (form_data.agent_name if form_data else '') }}" required placeholder="my_processing_agent">
26
+ <legend>Core Agent Configuration</legend>
27
+ <label for="agent_name_field">Agent Name *</label>
28
+ <input type="text" id="agent_name_field" name="agent_name" value="{{ agent.name if agent and not form_errors else (form_data.agent_name if form_data else '') }}" required placeholder="Unique name for the agent">
28
29
  {% if form_errors and form_errors.agent_name %}<small class="field-error">{{ form_errors.agent_name }}</small>{% endif %}
29
30
 
30
31
  <label for="agent_description_field">Description</label>
31
- <textarea id="agent_description_field" name="agent_description" placeholder="Briefly describe what this agent does.">{{ agent.description if agent and not form_errors else (form_data.agent_description if form_data else '') }}</textarea>
32
+ <textarea id="agent_description_field" name="agent_description" placeholder="Briefly describe what this agent does.">{{ agent.resolved_description if agent and not form_errors else (form_data.agent_description if form_data else '') }}</textarea>
32
33
 
33
34
  <label for="agent_model_field">Model Override (Optional)</label>
34
35
  <input type="text" id="agent_model_field" name="agent_model" value="{{ agent.model if agent and agent.model and not form_errors else (form_data.agent_model if form_data else '') }}" placeholder="e.g., openai/gpt-3.5-turbo (uses Flock default if blank)">
@@ -8,7 +8,7 @@
8
8
  {% for agent_name, agent in flock.agents.items() %}
9
9
  <li hx-get="/ui/api/flock/htmx/agents/{{ agent.name }}/details-form" hx-target="#agent-detail-panel" hx-swap="innerHTML" hx-indicator="#agent-detail-loading" onclick="this.closest('ul').querySelectorAll('li').forEach(li => li.classList.remove('selected-item')); this.classList.add('selected-item');">
10
10
  <strong>{{ agent.name }}</strong><br>
11
- <small>{{ agent.description|truncate(80) if agent.description else 'No description' }}</small>
11
+ <small>{{ agent.resolved_description|truncate(80) if agent.resolved_description else 'No description' }}</small>
12
12
  </li>
13
13
  {% endfor %}
14
14
  </ul>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flock-core
3
- Version: 0.4.0b44
3
+ Version: 0.4.0b45
4
4
  Summary: Declarative LLM Orchestration at Scale
5
5
  Author-email: Andre Ratzenberger <andre.ratzenberger@whiteduck.de>
6
6
  License-File: LICENSE
@@ -10,7 +10,7 @@ flock/cli/load_examples.py,sha256=DkeLUlrb7rGx3nZ04aADU9HXXu5mZTf_DBwT0xhzIv4,7
10
10
  flock/cli/load_flock.py,sha256=sfZ9B9aiyC5TCEbn1xR5Yd5SoaVji6MBNYzXlWOpoZ4,7111
11
11
  flock/cli/load_release_notes.py,sha256=bkMIjjQFfOngXkDCh2kB404lQYIToeR91LodzI2IUWM,555
12
12
  flock/cli/loaded_flock_cli.py,sha256=lGZ9Y2O16v4OEr0dxvPQA8HqreB_bP25C9teg4ViSsA,8202
13
- flock/cli/manage_agents.py,sha256=Psl014LCrJmBgwrjsp7O3WNlWvQmVd_IDud3rd0lnLI,12786
13
+ flock/cli/manage_agents.py,sha256=cWEHNPDaEAOYaxFhGbt1jmWvIhxmUNjZ24lMP8gH2y8,13506
14
14
  flock/cli/registry_management.py,sha256=mAHy3wT97YgODR0gVOkTXDqR5NIPzM-E-z9dEtw9-tw,29790
15
15
  flock/cli/runner.py,sha256=TgiuhRLkpa6dn3C-3eCmWx-bWUlTjaH0sD7Y-O7MrYM,1122
16
16
  flock/cli/settings.py,sha256=Z_TXBzCYlCmSaKrJ_CQCdYy-Cj29gpI4kbC_2KzoKqg,27025
@@ -20,7 +20,7 @@ flock/cli/yaml_editor.py,sha256=K3N0bh61G1TSDAZDnurqW9e_-hO6CtSQKXQqlDhCjVo,1252
20
20
  flock/cli/assets/release_notes.md,sha256=bqnk50jxM3w5uY44Dc7MkdT8XmRREFxrVBAG9XCOSSU,4896
21
21
  flock/core/__init__.py,sha256=p7lmQULRu9ejIAELfanZiyMhW0CougIPvyFHW2nqBFQ,847
22
22
  flock/core/flock.py,sha256=tr7O84Ykgnu7ZXQ54bOdnjEsZw-a7ue-pDp5UNyPkn4,33837
23
- flock/core/flock_agent.py,sha256=JTqaGD_OnZSd3bVU989WMsK1rAT6UGn-JYrPxFV15EE,39576
23
+ flock/core/flock_agent.py,sha256=-gEfBKWc569ynqNdy7Gc1iqBrCYPHmC8qvzXkxTi5m4,41115
24
24
  flock/core/flock_evaluator.py,sha256=dOXZeDOGZcAmJ9ahqq_2bdGUU1VOXY4skmwTVpAjiVw,1685
25
25
  flock/core/flock_factory.py,sha256=_4zsjkEmJnCR7IvJ3SUHnDbX6c7Tt3E4P5ohxwKvE6w,3173
26
26
  flock/core/flock_module.py,sha256=UCK6TFe4viXs596zeng0GD3gln4ZNGu_gCWkXIIMREg,3090
@@ -28,7 +28,7 @@ flock/core/flock_registry.py,sha256=aC-RK0js676DQkjXmNuYHuD5t6GmFhpQoCKaO3i7xFg,
28
28
  flock/core/flock_router.py,sha256=1OAXDsdaIIFApEfo6SRfFEDoTuGt3Si7n2MXiySEfis,2644
29
29
  flock/core/api/__init__.py,sha256=KdzUwBOwhxqqy7lAMLpysKL5GvpIiwOy6CxXELZVWaY,186
30
30
  flock/core/api/custom_endpoint.py,sha256=Mbk2owdcXVATaT5FtEWXFzllgursozcmqP8ouG5btc0,1305
31
- flock/core/api/endpoints.py,sha256=gxWA38viaGCI_Vq2YNuF0Rx_TVfa1ODcvXJu6Mjtdjg,12178
31
+ flock/core/api/endpoints.py,sha256=YoqnGscF02OxGXrvOxkn-9hnCwcZD9Vx6YkeHoC8pSk,12187
32
32
  flock/core/api/main.py,sha256=MMKTWRLZQXcdoeiN8NOX7s5_vBrzH5reE-W_5xJn8fM,8716
33
33
  flock/core/api/models.py,sha256=seqKuzhbN37nCNO7KrcJjI2mWuwiOKCLFcJcTPvTtag,3422
34
34
  flock/core/api/run_store.py,sha256=bFodJvVyWogzoezVy0cOoWWU3MdEBXf_6_5sBqCRWps,9227
@@ -469,8 +469,8 @@ flock/webapp/templates/chat_settings.html,sha256=nYz6ihYAUA9zN-Jru565QNl8_eJdoLM
469
469
  flock/webapp/templates/flock_editor.html,sha256=ysDExf9zMj4SMsSXZUpCtG9EjIv8VJ5xL4IJQOMlb7o,542
470
470
  flock/webapp/templates/index.html,sha256=eK7s5Cnh63unqPwq9NGZGEKyvYwkhudfmSn9su3Ctyg,412
471
471
  flock/webapp/templates/registry_viewer.html,sha256=suAiWDvBxJ8SsF9MhheuN6MMQUZuIhTlurmbFOcYJfI,3235
472
- flock/webapp/templates/partials/_agent_detail_form.html,sha256=wF1e4g_Jw1LZGAP8-_jgVJWqbseM1q8raB0eTCqQ-5c,5940
473
- flock/webapp/templates/partials/_agent_list.html,sha256=9NEakjaGH8JwUlLWTBMgT2uxGMh_uwhOvNukC4i26wo,1019
472
+ flock/webapp/templates/partials/_agent_detail_form.html,sha256=oLz17lmv8s-DI9lOxODLJpc57NRUPmnLlOqxyDFYTDE,6015
473
+ flock/webapp/templates/partials/_agent_list.html,sha256=comYjOeUxQvlJzS-3D4OruJKlhC3uhCgo-X-nqiOhkA,1037
474
474
  flock/webapp/templates/partials/_agent_manager_view.html,sha256=oUJ-t2Mk3o4xjQ_HtHz0glgaHM8eqZpPB4i24ToJiJ8,2565
475
475
  flock/webapp/templates/partials/_agent_tools_checklist.html,sha256=T60fb7OrJYHUw0hJLC_otskgvbH9dZXbv5klgWBkSWk,686
476
476
  flock/webapp/templates/partials/_chat_container.html,sha256=wNX_qTSJYy27k0KAZNksOt_73vTG4ki5n3ATZ2N9rDQ,484
@@ -506,8 +506,8 @@ flock/workflow/agent_execution_activity.py,sha256=Gy6FtuVAjf0NiUXmC3syS2eJpNQF4R
506
506
  flock/workflow/flock_workflow.py,sha256=iSUF_soFvWar0ffpkzE4irkDZRx0p4HnwmEBi_Ne2sY,9666
507
507
  flock/workflow/temporal_config.py,sha256=3_8O7SDEjMsSMXsWJBfnb6XTp0TFaz39uyzSlMTSF_I,3988
508
508
  flock/workflow/temporal_setup.py,sha256=YIHnSBntzOchHfMSh8hoLeNXrz3B1UbR14YrR6soM7A,1606
509
- flock_core-0.4.0b44.dist-info/METADATA,sha256=pwXwMx_hHg9Wnr0RlhRYVYUnW-BSUFh1QKYUNlXfG8U,17125
510
- flock_core-0.4.0b44.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
511
- flock_core-0.4.0b44.dist-info/entry_points.txt,sha256=rWaS5KSpkTmWySURGFZk6PhbJ87TmvcFQDi2uzjlagQ,37
512
- flock_core-0.4.0b44.dist-info/licenses/LICENSE,sha256=iYEqWy0wjULzM9GAERaybP4LBiPeu7Z1NEliLUdJKSc,1072
513
- flock_core-0.4.0b44.dist-info/RECORD,,
509
+ flock_core-0.4.0b45.dist-info/METADATA,sha256=QiS1hrIWr8i7cjemU4-Z3myIJWgjGHg7ecgb1w7upTE,17125
510
+ flock_core-0.4.0b45.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
511
+ flock_core-0.4.0b45.dist-info/entry_points.txt,sha256=rWaS5KSpkTmWySURGFZk6PhbJ87TmvcFQDi2uzjlagQ,37
512
+ flock_core-0.4.0b45.dist-info/licenses/LICENSE,sha256=iYEqWy0wjULzM9GAERaybP4LBiPeu7Z1NEliLUdJKSc,1072
513
+ flock_core-0.4.0b45.dist-info/RECORD,,