flock-core 0.4.0b27__py3-none-any.whl → 0.4.0b29__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.

flock/core/flock_agent.py CHANGED
@@ -208,7 +208,7 @@ class FlockAgent(BaseModel, Serializable, DSPyIntegrationMixin, ABC):
208
208
  )
209
209
  try:
210
210
  for module in self.get_enabled_modules():
211
- await module.initialize(self, inputs, self.context)
211
+ await module.on_initialize(self, inputs, self.context)
212
212
  except Exception as module_error:
213
213
  logger.error(
214
214
  "Error during initialize",
@@ -232,7 +232,9 @@ class FlockAgent(BaseModel, Serializable, DSPyIntegrationMixin, ABC):
232
232
  )
233
233
  try:
234
234
  for module in self.get_enabled_modules():
235
- await module.terminate(self, inputs, result, self.context)
235
+ await module.on_terminate(
236
+ self, inputs, self.context, result
237
+ )
236
238
 
237
239
  if self.write_to_file:
238
240
  self._save_output(self.name, result)
@@ -253,7 +255,7 @@ class FlockAgent(BaseModel, Serializable, DSPyIntegrationMixin, ABC):
253
255
  span.set_attribute("inputs", str(inputs))
254
256
  try:
255
257
  for module in self.get_enabled_modules():
256
- await module.on_error(self, error, inputs, self.context)
258
+ await module.on_error(self, inputs, self.context, error)
257
259
  except Exception as module_error:
258
260
  logger.error(
259
261
  "Error during on_error",
@@ -281,7 +283,7 @@ class FlockAgent(BaseModel, Serializable, DSPyIntegrationMixin, ABC):
281
283
 
282
284
  # Pre-evaluate hooks
283
285
  for module in self.get_enabled_modules():
284
- current_inputs = await module.pre_evaluate(
286
+ current_inputs = await module.on_pre_evaluate(
285
287
  self, current_inputs, self.context
286
288
  )
287
289
 
@@ -312,8 +314,11 @@ class FlockAgent(BaseModel, Serializable, DSPyIntegrationMixin, ABC):
312
314
  # Post-evaluate hooks
313
315
  current_result = result
314
316
  for module in self.get_enabled_modules():
315
- current_result = await module.post_evaluate(
316
- self, current_inputs, current_result, self.context
317
+ current_result = await module.on_post_evaluate(
318
+ self,
319
+ current_inputs,
320
+ self.context,
321
+ current_result,
317
322
  )
318
323
 
319
324
  logger.debug(f"Evaluation completed for agent '{self.name}'")
@@ -52,7 +52,7 @@ class FlockModule(BaseModel, ABC):
52
52
  default_factory=FlockModuleConfig, description="Module configuration"
53
53
  )
54
54
 
55
- async def initialize(
55
+ async def on_initialize(
56
56
  self,
57
57
  agent: Any,
58
58
  inputs: dict[str, Any],
@@ -61,7 +61,7 @@ class FlockModule(BaseModel, ABC):
61
61
  """Called when the agent starts running."""
62
62
  pass
63
63
 
64
- async def pre_evaluate(
64
+ async def on_pre_evaluate(
65
65
  self,
66
66
  agent: Any,
67
67
  inputs: dict[str, Any],
@@ -70,22 +70,22 @@ class FlockModule(BaseModel, ABC):
70
70
  """Called before agent evaluation, can modify inputs."""
71
71
  return inputs
72
72
 
73
- async def post_evaluate(
73
+ async def on_post_evaluate(
74
74
  self,
75
75
  agent: Any,
76
76
  inputs: dict[str, Any],
77
- result: dict[str, Any],
78
77
  context: FlockContext | None = None,
78
+ result: dict[str, Any] | None = None,
79
79
  ) -> dict[str, Any]:
80
80
  """Called after agent evaluation, can modify results."""
81
81
  return result
82
82
 
83
- async def terminate(
83
+ async def on_terminate(
84
84
  self,
85
85
  agent: Any,
86
86
  inputs: dict[str, Any],
87
- result: dict[str, Any],
88
87
  context: FlockContext | None = None,
88
+ result: dict[str, Any] | None = None,
89
89
  ) -> None:
90
90
  """Called when the agent finishes running."""
91
91
  pass
@@ -93,9 +93,9 @@ class FlockModule(BaseModel, ABC):
93
93
  async def on_error(
94
94
  self,
95
95
  agent: Any,
96
- error: Exception,
97
96
  inputs: dict[str, Any],
98
97
  context: FlockContext | None = None,
98
+ error: Exception | None = None,
99
99
  ) -> None:
100
100
  """Called when an error occurs during agent execution."""
101
101
  pass
@@ -110,7 +110,7 @@ class AssertionCheckerModule(FlockModule):
110
110
  # Proceed without judge LM for other rule types
111
111
  return self._judge_lm
112
112
 
113
- async def post_evaluate(
113
+ async def on_post_evaluate(
114
114
  self,
115
115
  agent: FlockAgent,
116
116
  inputs: dict[str, Any],
@@ -57,7 +57,7 @@ class CallbackModule(FlockModule):
57
57
  if self.config.initialize_callback:
58
58
  await self.config.initialize_callback(agent, inputs)
59
59
 
60
- async def pre_evaluate(
60
+ async def on_pre_evaluate(
61
61
  self,
62
62
  agent: Any,
63
63
  inputs: dict[str, Any],
@@ -83,7 +83,7 @@ class MemoryModule(FlockModule):
83
83
  else [{"type": "semantic"}]
84
84
  )
85
85
 
86
- async def initialize(
86
+ async def on_initialize(
87
87
  self,
88
88
  agent: FlockAgent,
89
89
  inputs: dict[str, Any],
@@ -101,7 +101,7 @@ class MemoryModule(FlockModule):
101
101
  )
102
102
  logger.debug(f"Initialized memory module for agent {agent.name}")
103
103
 
104
- async def pre_evaluate(
104
+ async def on_pre_evaluate(
105
105
  self,
106
106
  agent: FlockAgent,
107
107
  inputs: dict[str, Any],
@@ -226,7 +226,7 @@ class MemoryModule(FlockModule):
226
226
  except Exception as e:
227
227
  logger.warning(f"Memory storage failed: {e}", agent=agent.name)
228
228
 
229
- async def post_evaluate(
229
+ async def on_post_evaluate(
230
230
  self,
231
231
  agent: FlockAgent,
232
232
  inputs: dict[str, Any],
@@ -245,7 +245,7 @@ class MemoryModule(FlockModule):
245
245
 
246
246
  return result
247
247
 
248
- async def terminate(
248
+ async def on_terminate(
249
249
  self,
250
250
  agent: Any,
251
251
  inputs: dict[str, Any],
@@ -131,7 +131,7 @@ class OutputModule(FlockModule):
131
131
  )
132
132
  return text
133
133
 
134
- async def post_evaluate(
134
+ async def on_post_evaluate(
135
135
  self,
136
136
  agent: "FlockAgent",
137
137
  inputs: dict[str, Any],
@@ -227,7 +227,7 @@ class MetricsModule(FlockModule):
227
227
 
228
228
  return stats
229
229
 
230
- async def terminate(
230
+ async def on_terminate(
231
231
  self,
232
232
  agent: FlockAgent,
233
233
  inputs: dict[str, Any],
@@ -340,7 +340,7 @@ class MetricsModule(FlockModule):
340
340
  return value * 1000 > self.config.latency_threshold_ms
341
341
  return False
342
342
 
343
- async def initialize(
343
+ async def on_initialize(
344
344
  self,
345
345
  agent: FlockAgent,
346
346
  inputs: dict[str, Any],
@@ -382,7 +382,7 @@ class MetricsModule(FlockModule):
382
382
  total_cost = 0.0
383
383
  return token_count, total_cost
384
384
 
385
- async def pre_evaluate(
385
+ async def on_pre_evaluate(
386
386
  self,
387
387
  agent: FlockAgent,
388
388
  inputs: dict[str, Any],
@@ -423,7 +423,7 @@ class MetricsModule(FlockModule):
423
423
 
424
424
  return inputs
425
425
 
426
- async def post_evaluate(
426
+ async def on_post_evaluate(
427
427
  self,
428
428
  agent: FlockAgent,
429
429
  inputs: dict[str, Any],
@@ -141,7 +141,7 @@ class ZepModule(FlockModule):
141
141
  return []
142
142
  return response.results
143
143
 
144
- async def post_evaluate(
144
+ async def on_post_evaluate(
145
145
  self,
146
146
  agent: FlockAgent,
147
147
  inputs: dict[str, Any],
@@ -158,7 +158,7 @@ class ZepModule(FlockModule):
158
158
  self.add_to_memory(str(result), zep_client)
159
159
  return result
160
160
 
161
- async def pre_evaluate(
161
+ async def on_pre_evaluate(
162
162
  self,
163
163
  agent: FlockAgent,
164
164
  inputs: dict[str, Any],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flock-core
3
- Version: 0.4.0b27
3
+ Version: 0.4.0b29
4
4
  Summary: Declarative LLM Orchestration at Scale
5
5
  Author-email: Andre Ratzenberger <andre.ratzenberger@whiteduck.de>
6
6
  License-File: LICENSE
@@ -126,7 +126,7 @@ Flock's power comes from a few key ideas (Learn more in the [Full Documentation]
126
126
  6. **Tool Integration:** Equip agents with standard or custom Python functions (`@flock_tool`) registered via the `FlockRegistry`.
127
127
  7. **Registry:** A central place (`@flock_component`, `@flock_type`, `@flock_tool`) to register your custom classes, types, and functions, enabling robust serialization and dynamic loading.
128
128
 
129
- ## 💾 Installation
129
+ ## 💾 Installation - Use Flock in your project
130
130
 
131
131
  Get started with the core Flock library:
132
132
 
@@ -148,7 +148,27 @@ uv pip install flock-core[tools]
148
148
  uv pip install flock-core[all]
149
149
  ```
150
150
 
151
- Environment Setup:
151
+ ## 🔑 Installation - Develop Flock
152
+
153
+ ```bash
154
+ git clone https://github.com/whiteducksoftware/flock.git
155
+ cd flock
156
+
157
+ # One-liner dev setup after cloning
158
+ pip install poethepoet && poe install
159
+ ```
160
+
161
+ Additional provided `poe` tasks and commands:
162
+
163
+ ```bash
164
+ poe install # Install the project
165
+ poe build # Build the project
166
+ poe docs # Serve the docs
167
+ poe format # Format the code
168
+ poe lint # Lint the code
169
+ ```
170
+
171
+ ## 🔑 Environment Setup
152
172
 
153
173
  Flock uses environment variables (typically in a .env file) for configuration, especially API keys. Create a .env file in your project root:
154
174
 
@@ -173,7 +193,7 @@ DEFAULT_MODEL="openai/gpt-4o" # Default LLM if agent doesn't specify
173
193
  # VARS_PER_PAGE="20"
174
194
  ```
175
195
 
176
- Remember to add .env to your .gitignore!
196
+ Be sure that the .env file is added to your .gitignore!
177
197
 
178
198
  ## ⚡ Quick Start Syntax
179
199
 
@@ -223,18 +243,32 @@ Version 0.4.0 brings significant enhancements focused on usability, deployment,
223
243
 
224
244
  Easily deploy your Flock agents as scalable REST API endpoints. Interact with your agent workflows via standard HTTP requests.
225
245
 
246
+ --------------------------------
247
+
226
248
  ### 🖥️ Web UI - Test Flock Agents in the Browser
227
249
 
228
250
  Test and interact with your Flock agents directly in your browser through an integrated web interface.
229
251
 
252
+ --------------------------------
253
+
230
254
  ### ⌨️ CLI Tool - Manage Flock Agents via the Command Line
231
255
 
232
256
  Manage Flock configurations, run agents, and inspect results directly from your command line.
233
257
 
258
+ --------------------------------
259
+
234
260
  ### 💾 Enhanced Serialization - Share, Deploy, and Run Flock Agents by human readable yaml files
235
261
 
236
262
  Define and share entire Flock configurations, including agents and components, using human-readable YAML files. Load flocks directly from these files for easy deployment and versioning.
237
263
 
264
+ --------------------------------
265
+
266
+ ### 💾 New execution flows
267
+
268
+ Run Flock in batch mode to process multiple inputs at once or in evaluation mode to test agents with different inputs.
269
+
270
+ --------------------------------
271
+
238
272
  ### ⏱️ Robust Temporal Integration
239
273
 
240
274
  Flock 0.4.0 introduces first-class support for Temporal.io, enabling you to build truly production-grade, reliable, and scalable agent workflows. Move beyond simple local execution and leverage Temporal's power for:
@@ -249,6 +283,51 @@ Flock makes this easy with:
249
283
  * **Declarative Configuration:** Define Temporal timeouts, retry policies, and task queues directly within your `Flock` and `FlockAgent` configurations (YAML or Python).
250
284
  * **Correct Patterns:** Uses Temporal's recommended granular activity execution for better control and visibility.
251
285
  * **Clear Worker Separation:** Provides guidance and flags for running dedicated Temporal workers, separating development convenience from production best practices.
286
+
287
+ Visit the [Temporal Documentation](https://learn.temporal.io/python/workflows/) for more information on how to use Temporal.
288
+
289
+ Or check out the [Flock Showcase](https://github.com/whiteducksoftware/flock-showcase) for a complete example of a Flock that uses Temporal or our [docs](https://whiteducksoftware.github.io/flock/guides/temporal-configuration/) for more information.
290
+
291
+ Here's an example of how to configure a Flock to use Temporal:
292
+
293
+ ```python
294
+ from flock.core import Flock, FlockFactory
295
+
296
+ from flock.workflow.temporal_config import (
297
+ TemporalActivityConfig,
298
+ TemporalRetryPolicyConfig,
299
+ TemporalWorkflowConfig,
300
+ )
301
+
302
+ # Flock-scoped temporal config
303
+ flock = Flock(
304
+ enable_temporal=True,
305
+ temporal_config=TemporalWorkflowConfig(
306
+ task_queue="flock-test-queue",
307
+ workflow_execution_timeout=timedelta(minutes=10),
308
+ default_activity_retry_policy=TemporalRetryPolicyConfig(
309
+ maximum_attempts=2
310
+ ),
311
+ ),
312
+ )
313
+
314
+ # Agent-scoped temporal config
315
+ content_agent = FlockFactory.create_default_agent(
316
+ name="content_agent",
317
+ input="funny_title, funny_slide_headers",
318
+ output="funny_slide_content",
319
+ temporal_activity_config=TemporalActivityConfig(
320
+ start_to_close_timeout=timedelta(minutes=1),
321
+ retry_policy=TemporalRetryPolicyConfig(
322
+ maximum_attempts=4,
323
+ initial_interval=timedelta(seconds=2),
324
+ non_retryable_error_types=["ValueError"],
325
+ ),
326
+ ),
327
+ )
328
+ ```
329
+
330
+ --------------------------------
252
331
 
253
332
  ### ✨ Utility: @flockclass Hydrator
254
333
 
@@ -281,6 +360,8 @@ async def create_character():
281
360
  # asyncio.run(create_character())
282
361
  ```
283
362
 
363
+ --------------------------------
364
+
284
365
  ## 📚 Examples & Tutorials
285
366
 
286
367
  For a comprehensive set of examples, ranging from basic usage to complex projects and advanced features, please visit our dedicated showcase repository:
@@ -20,10 +20,10 @@ 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=_T_KAFePtEGDzfiFGV1HCdz7VHzj_U0cCquhAQ4xMAM,28199
23
- flock/core/flock_agent.py,sha256=oOMPw9fmZCAdqJXZsLTbjc4tdIq6gn5_nX3GvPgm61Q,38969
23
+ flock/core/flock_agent.py,sha256=lx_UO-yRiw5F0-pvPD-xCUEaPufk7K1GcaGlBwoQWT8,39088
24
24
  flock/core/flock_evaluator.py,sha256=dOXZeDOGZcAmJ9ahqq_2bdGUU1VOXY4skmwTVpAjiVw,1685
25
25
  flock/core/flock_factory.py,sha256=_4zsjkEmJnCR7IvJ3SUHnDbX6c7Tt3E4P5ohxwKvE6w,3173
26
- flock/core/flock_module.py,sha256=96aFVYAgwpKN53xGbivQDUpikOYGFCxK5mqhclOcxY0,3003
26
+ flock/core/flock_module.py,sha256=2MdAh-n0o4uw7jogvW9iHjVPUawUNN1oGor5ego3RLI,3057
27
27
  flock/core/flock_registry.py,sha256=Qcu9juUFNyDAOEsqVxauwVlWdfgKZrSzc8yT8JMiK-c,24246
28
28
  flock/core/flock_router.py,sha256=1OAXDsdaIIFApEfo6SRfFEDoTuGt3Si7n2MXiySEfis,2644
29
29
  flock/core/api/__init__.py,sha256=OKlhzDWZJfA6ddBwxQUmATY0TSzESsH032u00iVGvdA,228
@@ -80,14 +80,14 @@ flock/evaluators/declarative/declarative_evaluator.py,sha256=q3qKHuKrj17mhaoOZuK
80
80
  flock/evaluators/memory/memory_evaluator.py,sha256=ySwz7kcc8suXMJ7gKNSWThW8iOMlE8lUcUzEAHvv8rw,3559
81
81
  flock/evaluators/test/test_case_evaluator.py,sha256=3Emcoty0LOLLBIuPGxSpKphuZC9Fu1DTr1vbGg-hd0Q,1233
82
82
  flock/evaluators/zep/zep_evaluator.py,sha256=6_5vTdU0yJAH8I8w3-MPXiAZx6iUPhAVCsHjrHzkPLM,2058
83
- flock/modules/assertion/assertion_module.py,sha256=vzv38E8mvVBQXON_YJ8GFF4kB-sWNychQrMVFmugEjU,12860
84
- flock/modules/callback/callback_module.py,sha256=q2z-KX7QHlbfDncEP9c_W_DxhYyD6fe9MQfISO9OgrU,2939
85
- flock/modules/memory/memory_module.py,sha256=MBsUCpnMWY184PlZUKw91b8Yf0jCg9ixsxiqx2tK8LM,15020
83
+ flock/modules/assertion/assertion_module.py,sha256=gnHwWe3TCFEtbQrQ_Dvd1m62GvD71h-lsPlQbOJFKQ0,12863
84
+ flock/modules/callback/callback_module.py,sha256=k5995AaIqZ-aAbFOyFbq57ObpBEFM-BghE2KwnXdmII,2942
85
+ flock/modules/memory/memory_module.py,sha256=fXkR0JZTZbtUHk3e93-JLHe7_OCjPoa8qZbkHiX4qHI,15032
86
86
  flock/modules/memory/memory_parser.py,sha256=FLH7GL8XThvHiCMfX3eQH7Sz-f62fzhAUmO6_gaDI7U,4372
87
87
  flock/modules/memory/memory_storage.py,sha256=CNcLDMmvv0x7Z3YMKr6VveS_VCa7rKPw8l2d-XgqokA,27246
88
- flock/modules/output/output_module.py,sha256=V2g7UF538dwCe4J2QsemADMOnorGfK5Z995Q2ZIV7K4,7385
89
- flock/modules/performance/metrics_module.py,sha256=SptJzBmtVyVloi8-QtJ1jF0pBak1kelsMiZQfoeHr-4,16953
90
- flock/modules/zep/zep_module.py,sha256=uWhSXma4EIMt70L1_588FLnoLNmU8l7Vhhy1viRK1dk,6115
88
+ flock/modules/output/output_module.py,sha256=2QDW0voU9TZWlL2225k1W3xhWWTfjnfBheC4xIMyBDQ,7388
89
+ flock/modules/performance/metrics_module.py,sha256=G_2CFmPKM36wokrYKhWuGFM_CTOW2IdKfBDK7KYnUBk,16965
90
+ flock/modules/zep/zep_module.py,sha256=biR8oDBAMpyKWO4qTCD6yyRgPPqHwNr23CZ8JSFF3bY,6121
91
91
  flock/platform/docker_tools.py,sha256=fpA7-6rJBjPOUBLdQP4ny2QPgJ_042nmqRn5GtKnoYw,1445
92
92
  flock/platform/jaeger_install.py,sha256=MyOMJQx4TQSMYvdUJxfiGSo3YCtsfkbNXcAcQ9bjETA,2898
93
93
  flock/routers/__init__.py,sha256=w9uL34Auuo26-q_EGlE8Z9iHsw6S8qutTAH_ZI7pn7M,39
@@ -444,8 +444,8 @@ flock/workflow/agent_execution_activity.py,sha256=Gy6FtuVAjf0NiUXmC3syS2eJpNQF4R
444
444
  flock/workflow/flock_workflow.py,sha256=iSUF_soFvWar0ffpkzE4irkDZRx0p4HnwmEBi_Ne2sY,9666
445
445
  flock/workflow/temporal_config.py,sha256=3_8O7SDEjMsSMXsWJBfnb6XTp0TFaz39uyzSlMTSF_I,3988
446
446
  flock/workflow/temporal_setup.py,sha256=YIHnSBntzOchHfMSh8hoLeNXrz3B1UbR14YrR6soM7A,1606
447
- flock_core-0.4.0b27.dist-info/METADATA,sha256=N3xUdEq5nlLB7BVjw8gnEaGMsRKJDX5K7w5ogfS5RCw,14825
448
- flock_core-0.4.0b27.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
449
- flock_core-0.4.0b27.dist-info/entry_points.txt,sha256=rWaS5KSpkTmWySURGFZk6PhbJ87TmvcFQDi2uzjlagQ,37
450
- flock_core-0.4.0b27.dist-info/licenses/LICENSE,sha256=iYEqWy0wjULzM9GAERaybP4LBiPeu7Z1NEliLUdJKSc,1072
451
- flock_core-0.4.0b27.dist-info/RECORD,,
447
+ flock_core-0.4.0b29.dist-info/METADATA,sha256=6KbUHrEYTRfkKY1SoGtH3LfFiIMtaYsVkgsGXPLjkTk,17125
448
+ flock_core-0.4.0b29.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
449
+ flock_core-0.4.0b29.dist-info/entry_points.txt,sha256=rWaS5KSpkTmWySURGFZk6PhbJ87TmvcFQDi2uzjlagQ,37
450
+ flock_core-0.4.0b29.dist-info/licenses/LICENSE,sha256=iYEqWy0wjULzM9GAERaybP4LBiPeu7Z1NEliLUdJKSc,1072
451
+ flock_core-0.4.0b29.dist-info/RECORD,,