flock-core 0.4.0b10__py3-none-any.whl → 0.4.0b12__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/__init__.py CHANGED
@@ -8,6 +8,7 @@ from flock.core.flock_factory import FlockFactory
8
8
  from flock.core.flock_module import FlockModule, FlockModuleConfig
9
9
  from flock.core.flock_registry import (
10
10
  FlockRegistry,
11
+ flock_callable,
11
12
  flock_component,
12
13
  flock_tool,
13
14
  flock_type,
@@ -24,6 +25,7 @@ __all__ = [
24
25
  "FlockModule",
25
26
  "FlockModuleConfig",
26
27
  "FlockRegistry",
28
+ "flock_callable",
27
29
  "flock_component",
28
30
  "flock_tool",
29
31
  "flock_type",
flock/core/flock_agent.py CHANGED
@@ -361,16 +361,30 @@ class FlockAgent(BaseModel, Serializable, DSPyIntegrationMixin, ABC):
361
361
  from flock.core.flock_registry import get_registry
362
362
 
363
363
  FlockRegistry = get_registry()
364
+
365
+ exclude = ["context", "evaluator", "modules", "handoff_router", "tools"]
366
+
367
+ is_descrition_callable = False
368
+ is_input_callable = False
369
+ is_output_callable = False
370
+
371
+ # if self.description is a callable, exclude it
372
+ if callable(self.description):
373
+ is_descrition_callable = True
374
+ exclude.append("description")
375
+ # if self.input is a callable, exclude it
376
+ if callable(self.input):
377
+ is_input_callable = True
378
+ exclude.append("input")
379
+ # if self.output is a callable, exclude it
380
+ if callable(self.output):
381
+ is_output_callable = True
382
+ exclude.append("output")
383
+
364
384
  logger.debug(f"Serializing agent '{self.name}' to dict.")
365
385
  # Use Pydantic's dump, exclude manually handled fields and runtime context
366
386
  data = self.model_dump(
367
- exclude={
368
- "context",
369
- "evaluator",
370
- "modules",
371
- "handoff_router",
372
- "tools",
373
- },
387
+ exclude=exclude,
374
388
  mode="json", # Use json mode for better handling of standard types by Pydantic
375
389
  exclude_none=True, # Exclude None values for cleaner output
376
390
  )
@@ -483,6 +497,45 @@ class FlockAgent(BaseModel, Serializable, DSPyIntegrationMixin, ABC):
483
497
  f"Added {len(serialized_tools)} tools to agent '{self.name}'"
484
498
  )
485
499
 
500
+ if is_descrition_callable:
501
+ path_str = FlockRegistry.get_callable_path_string(self.description)
502
+ if path_str:
503
+ func_name = path_str.split(".")[-1]
504
+ data["description_callable"] = func_name
505
+ logger.debug(
506
+ f"Added description '{func_name}' (from path '{path_str}') to agent '{self.name}'"
507
+ )
508
+ else:
509
+ logger.warning(
510
+ f"Could not get path string for description {self.description} in agent '{self.name}'. Skipping."
511
+ )
512
+
513
+ if is_input_callable:
514
+ path_str = FlockRegistry.get_callable_path_string(self.input)
515
+ if path_str:
516
+ func_name = path_str.split(".")[-1]
517
+ data["input_callable"] = func_name
518
+ logger.debug(
519
+ f"Added input '{func_name}' (from path '{path_str}') to agent '{self.name}'"
520
+ )
521
+ else:
522
+ logger.warning(
523
+ f"Could not get path string for input {self.input} in agent '{self.name}'. Skipping."
524
+ )
525
+
526
+ if is_output_callable:
527
+ path_str = FlockRegistry.get_callable_path_string(self.output)
528
+ if path_str:
529
+ func_name = path_str.split(".")[-1]
530
+ data["output_callable"] = func_name
531
+ logger.debug(
532
+ f"Added output '{func_name}' (from path '{path_str}') to agent '{self.name}'"
533
+ )
534
+ else:
535
+ logger.warning(
536
+ f"Could not get path string for output {self.output} in agent '{self.name}'. Skipping."
537
+ )
538
+
486
539
  # No need to call _filter_none_values here as model_dump(exclude_none=True) handles it
487
540
  logger.info(
488
541
  f"Serialization of agent '{self.name}' complete with {len(data)} fields"
@@ -508,6 +561,9 @@ class FlockAgent(BaseModel, Serializable, DSPyIntegrationMixin, ABC):
508
561
  router_data = data.pop("handoff_router", None)
509
562
  modules_data = data.pop("modules", {})
510
563
  tools_data = data.pop("tools", [])
564
+ description_callable = data.pop("description_callable", None)
565
+ input_callable = data.pop("input_callable", None)
566
+ output_callable = data.pop("output_callable", None)
511
567
 
512
568
  logger.debug(
513
569
  f"Agent '{agent_name}' has {len(modules_data)} modules and {len(tools_data)} tools"
@@ -663,6 +719,24 @@ class FlockAgent(BaseModel, Serializable, DSPyIntegrationMixin, ABC):
663
719
  exc_info=True,
664
720
  )
665
721
 
722
+ if description_callable:
723
+ logger.debug(
724
+ f"Deserializing description callable '{description_callable}' for agent '{agent_name}'"
725
+ )
726
+ agent.description = components[description_callable]
727
+
728
+ if input_callable:
729
+ logger.debug(
730
+ f"Deserializing input callable '{input_callable}' for agent '{agent_name}'"
731
+ )
732
+ agent.input = components[input_callable]
733
+
734
+ if output_callable:
735
+ logger.debug(
736
+ f"Deserializing output callable '{output_callable}' for agent '{agent_name}'"
737
+ )
738
+ agent.output = components[output_callable]
739
+
666
740
  logger.info(
667
741
  f"Successfully deserialized agent '{agent_name}' with {len(agent.modules)} modules and {len(agent.tools)} tools"
668
742
  )
@@ -480,7 +480,7 @@ def flock_tool(func: FuncType | None = None, *, name: str | None = None) -> Any:
480
480
 
481
481
 
482
482
  # Alias for clarity if desired
483
- # flock_callable = flock_tool
483
+ flock_callable = flock_tool
484
484
 
485
485
 
486
486
  @overload
@@ -145,6 +145,66 @@ class FlockSerializer:
145
145
  )
146
146
  )
147
147
 
148
+ # Description (Callables)
149
+ if agent_data.get("description_callable"):
150
+ logger.debug(
151
+ f"Adding description callable '{agent_data['description_callable']}' from agent '{name}'"
152
+ )
153
+ description_callable_name = agent_data[
154
+ "description_callable"
155
+ ]
156
+ description_callable = agent_instance.description
157
+ path_str = FlockRegistry.get_callable_path_string(
158
+ description_callable
159
+ )
160
+ if path_str:
161
+ logger.debug(
162
+ f"Adding description callable '{description_callable_name}' (from path '{path_str}') to components"
163
+ )
164
+ components[description_callable_name] = (
165
+ FlockSerializer._get_callable_definition(
166
+ path_str, description_callable_name, path_type
167
+ )
168
+ )
169
+
170
+ if agent_data.get("input_callable"):
171
+ logger.debug(
172
+ f"Adding input callable '{agent_data['input_callable']}' from agent '{name}'"
173
+ )
174
+ input_callable_name = agent_data["input_callable"]
175
+ input_callable = agent_instance.input
176
+ path_str = FlockRegistry.get_callable_path_string(
177
+ input_callable
178
+ )
179
+ if path_str:
180
+ logger.debug(
181
+ f"Adding input callable '{input_callable_name}' (from path '{path_str}') to components"
182
+ )
183
+ components[input_callable_name] = (
184
+ FlockSerializer._get_callable_definition(
185
+ path_str, input_callable_name, path_type
186
+ )
187
+ )
188
+
189
+ if agent_data.get("output_callable"):
190
+ logger.debug(
191
+ f"Adding output callable '{agent_data['output_callable']}' from agent '{name}'"
192
+ )
193
+ output_callable_name = agent_data["output_callable"]
194
+ output_callable = agent_instance.output
195
+ path_str = FlockRegistry.get_callable_path_string(
196
+ output_callable
197
+ )
198
+ if path_str:
199
+ logger.debug(
200
+ f"Adding output callable '{output_callable_name}' (from path '{path_str}') to components"
201
+ )
202
+ components[output_callable_name] = (
203
+ FlockSerializer._get_callable_definition(
204
+ path_str, output_callable_name, path_type
205
+ )
206
+ )
207
+
148
208
  # Tools (Callables)
149
209
  if agent_data.get("tools"):
150
210
  logger.debug(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flock-core
3
- Version: 0.4.0b10
3
+ Version: 0.4.0b12
4
4
  Summary: Declarative LLM Orchestration at Scale
5
5
  Author-email: Andre Ratzenberger <andre.ratzenberger@whiteduck.de>
6
6
  License-File: LICENSE
@@ -17,13 +17,13 @@ flock/cli/settings.py,sha256=Z_TXBzCYlCmSaKrJ_CQCdYy-Cj29gpI4kbC_2KzoKqg,27025
17
17
  flock/cli/view_results.py,sha256=dOzK0O1FHSIDERnx48y-2Xke9BkOHS7pcOhs64AyIg0,781
18
18
  flock/cli/yaml_editor.py,sha256=K3N0bh61G1TSDAZDnurqW9e_-hO6CtSQKXQqlDhCjVo,12527
19
19
  flock/cli/assets/release_notes.md,sha256=bqnk50jxM3w5uY44Dc7MkdT8XmRREFxrVBAG9XCOSSU,4896
20
- flock/core/__init__.py,sha256=R64A7zi51Uz6jzzCFWGol9SZQnMFz3ynEse5ivhSkEA,805
20
+ flock/core/__init__.py,sha256=p7lmQULRu9ejIAELfanZiyMhW0CougIPvyFHW2nqBFQ,847
21
21
  flock/core/flock.py,sha256=zQUpITLx_CMhJRnft4AWQDfYj85FhUlT-Ank5c-fSko,25146
22
- flock/core/flock_agent.py,sha256=L5sZ6weY4pNFbk8CEUrRD1506ojq_tx1jjQy02qEdC8,29126
22
+ flock/core/flock_agent.py,sha256=uFVr8eVWZ4uowH659fdOvVuBD4fx695Zm9UB9pOQKDU,32223
23
23
  flock/core/flock_evaluator.py,sha256=dOXZeDOGZcAmJ9ahqq_2bdGUU1VOXY4skmwTVpAjiVw,1685
24
24
  flock/core/flock_factory.py,sha256=MGTkJCP1WGpV614f87r1vwe0tqAvBCoH9PlqtqDyJDk,2828
25
25
  flock/core/flock_module.py,sha256=96aFVYAgwpKN53xGbivQDUpikOYGFCxK5mqhclOcxY0,3003
26
- flock/core/flock_registry.py,sha256=ax2pIxv6hVqRw3eJCPQ9jAul_ocYWfl9BZttmu054d0,20830
26
+ flock/core/flock_registry.py,sha256=ekYpQgSkZVnbyPbl8gA7nf54brt94rYZZBe2RwEGtUc,20828
27
27
  flock/core/flock_router.py,sha256=A5GaxcGvtiFlRLHBTW7okh5RDm3BdKam2uXvRHRaj7k,2187
28
28
  flock/core/api/__init__.py,sha256=OKlhzDWZJfA6ddBwxQUmATY0TSzESsH032u00iVGvdA,228
29
29
  flock/core/api/endpoints.py,sha256=qQnJmtcYGkjdKtLllVpyJVjc-iZrvu5EEeVIryyt4tc,12987
@@ -59,7 +59,7 @@ flock/core/mixin/dspy_integration.py,sha256=vlf6rJnR9EsfZi5KyFLEXIbUvhpBhodctn-m
59
59
  flock/core/mixin/prompt_parser.py,sha256=eOqI-FK3y17gVqpc_y5GF-WmK1Jv8mFlkZxTcgweoxI,5121
60
60
  flock/core/serialization/__init__.py,sha256=CML7fPgG6p4c0CDBlJ_uwV1aZZhJKK9uy3IoIHfO87w,431
61
61
  flock/core/serialization/callable_registry.py,sha256=sUZECTZWsM3fJ8FDRQ-FgLNW9hF26nY17AD6fJKADMc,1419
62
- flock/core/serialization/flock_serializer.py,sha256=EcDpw-OdkDied80UMXnWYOU0A8PrTQlZ7JRNK2YQ9Tg,30041
62
+ flock/core/serialization/flock_serializer.py,sha256=TEePKaJqU-_XWHTMWyMHloDNwmkKyOUSfXoJ7ZVki8k,33048
63
63
  flock/core/serialization/json_encoder.py,sha256=gAKj2zU_8wQiNvdkby2hksSA4fbPNwTjup_yz1Le1Vw,1229
64
64
  flock/core/serialization/secure_serializer.py,sha256=n5-zRvvXddgJv1FFHsaQ2wuYdL3WUSGPvG_LGaffEJo,6144
65
65
  flock/core/serialization/serializable.py,sha256=qlv8TsTqRuklXiNuCMrvro5VKz764xC2i3FlgLJSkdk,12129
@@ -439,8 +439,8 @@ flock/workflow/activities.py,sha256=eVZDnxGJl_quNO-UTV3YgvTV8LrRaHN3QDAA1ANKzac,
439
439
  flock/workflow/agent_activities.py,sha256=NhBZscflEf2IMfSRa_pBM_TRP7uVEF_O0ROvWZ33eDc,963
440
440
  flock/workflow/temporal_setup.py,sha256=VWBgmBgfTBjwM5ruS_dVpA5AVxx6EZ7oFPGw4j3m0l0,1091
441
441
  flock/workflow/workflow.py,sha256=I9MryXW_bqYVTHx-nl2epbTqeRy27CAWHHA7ZZA0nAk,1696
442
- flock_core-0.4.0b10.dist-info/METADATA,sha256=ahnhPkvyNeFFs6vE37iTywwPJ3ak9kMEEgk7NpjHLjQ,21101
443
- flock_core-0.4.0b10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
444
- flock_core-0.4.0b10.dist-info/entry_points.txt,sha256=rWaS5KSpkTmWySURGFZk6PhbJ87TmvcFQDi2uzjlagQ,37
445
- flock_core-0.4.0b10.dist-info/licenses/LICENSE,sha256=iYEqWy0wjULzM9GAERaybP4LBiPeu7Z1NEliLUdJKSc,1072
446
- flock_core-0.4.0b10.dist-info/RECORD,,
442
+ flock_core-0.4.0b12.dist-info/METADATA,sha256=obK1R3a6NGzJAof5joz30ccvBDQl1HDA4Sqrgl3EcWc,21101
443
+ flock_core-0.4.0b12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
444
+ flock_core-0.4.0b12.dist-info/entry_points.txt,sha256=rWaS5KSpkTmWySURGFZk6PhbJ87TmvcFQDi2uzjlagQ,37
445
+ flock_core-0.4.0b12.dist-info/licenses/LICENSE,sha256=iYEqWy0wjULzM9GAERaybP4LBiPeu7Z1NEliLUdJKSc,1072
446
+ flock_core-0.4.0b12.dist-info/RECORD,,