flock-core 0.2.10__py3-none-any.whl → 0.2.12__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/config.py CHANGED
@@ -30,7 +30,7 @@ OTEL_SQL_DATABASE_NAME = config("OTEL_SQL_DATABASE", "flock_events.db")
30
30
  OTEL_FILE_NAME = config("OTEL_FILE_NAME", "flock_events.jsonl")
31
31
  OTEL_ENABLE_SQL: bool = config("OTEL_ENABLE_SQL", True) == "True"
32
32
  OTEL_ENABLE_FILE: bool = config("OTEL_ENABLE_FILE", True) == "True"
33
- OTEL_ENABLE_JAEGER: bool = config("OTEL_ENABLE_JAEGER", True) == "True"
33
+ OTEL_ENABLE_JAEGER: bool = config("OTEL_ENABLE_JAEGER", False) == "True"
34
34
 
35
35
 
36
36
  TELEMETRY = TelemetryConfig(
flock/core/flock.py CHANGED
@@ -99,31 +99,34 @@ class Flock:
99
99
  Returns:
100
100
  FlockAgent: The registered agent instance.
101
101
  """
102
- if not agent.model:
103
- agent.model = self.model
104
- logger.debug(
105
- f"Using default model for agent {agent.name}", model=self.model
106
- )
102
+ with tracer.start_as_current_span("add_agent") as span:
103
+ span.set_attribute("agent_name", agent.name)
104
+ if not agent.model:
105
+ agent.model = self.model
106
+ logger.debug(
107
+ f"Using default model for agent {agent.name}",
108
+ model=self.model,
109
+ )
107
110
 
108
- if agent.name in self.agents:
109
- logger.warning(
110
- f"Agent {agent.name} already exists, returning existing instance"
111
+ if agent.name in self.agents:
112
+ logger.warning(
113
+ f"Agent {agent.name} already exists, returning existing instance"
114
+ )
115
+ return self.agents[agent.name]
116
+ logger.info("Adding new agent")
117
+
118
+ self.agents[agent.name] = agent
119
+ self.registry.register_agent(agent)
120
+ self.context.add_agent_definition(
121
+ type(agent), agent.name, agent.to_dict()
111
122
  )
112
- return self.agents[agent.name]
113
- logger.info("Adding new agent")
114
-
115
- self.agents[agent.name] = agent
116
- self.registry.register_agent(agent)
117
- self.context.add_agent_definition(
118
- type(agent), agent.name, agent.to_dict()
119
- )
120
-
121
- if hasattr(agent, "tools") and agent.tools:
122
- for tool in agent.tools:
123
- self.registry.register_tool(tool.__name__, tool)
124
- logger.debug("Registered tool", tool_name=tool.__name__)
125
- logger.success("Agent added successfully")
126
- return agent
123
+
124
+ if hasattr(agent, "tools") and agent.tools:
125
+ for tool in agent.tools:
126
+ self.registry.register_tool(tool.__name__, tool)
127
+ logger.debug("Registered tool", tool_name=tool.__name__)
128
+ logger.success("Agent added successfully")
129
+ return agent
127
130
 
128
131
  def add_tool(self, tool_name: str, tool: callable):
129
132
  """Register a tool with the Flock system.
@@ -132,9 +135,12 @@ class Flock:
132
135
  tool_name (str): The name under which the tool will be registered.
133
136
  tool (callable): The tool function to register.
134
137
  """
135
- logger.info("Registering tool", tool_name=tool_name)
136
- self.registry.register_tool(tool_name, tool)
137
- logger.debug("Tool registered successfully")
138
+ with tracer.start_as_current_span("add_tool") as span:
139
+ span.set_attribute("tool_name", tool_name)
140
+ span.set_attribute("tool", tool.__name__)
141
+ logger.info("Registering tool", tool_name=tool_name)
142
+ self.registry.register_tool(tool_name, tool)
143
+ logger.debug("Tool registered successfully")
138
144
 
139
145
  async def run_async(
140
146
  self,
flock/core/flock_agent.py CHANGED
@@ -14,6 +14,8 @@ from flock.core.mixin.dspy_integration import AgentType, DSPyIntegrationMixin
14
14
  from flock.core.mixin.prompt_parser import PromptParserMixin
15
15
 
16
16
  logger = get_logger("flock")
17
+
18
+
17
19
  from opentelemetry import trace
18
20
 
19
21
  tracer = trace.get_tracer(__name__)
@@ -157,7 +159,7 @@ class FlockAgent(BaseModel, ABC, PromptParserMixin, DSPyIntegrationMixin):
157
159
  )
158
160
 
159
161
  use_cache: bool = Field(
160
- default=False,
162
+ default=True,
161
163
  description="Set to True to enable caching of the agent's results.",
162
164
  )
163
165
 
@@ -61,6 +61,7 @@ class TelemetryConfig:
61
61
  self.enable_jaeger = enable_jaeger
62
62
  self.enable_file = enable_file
63
63
  self.enable_sql = enable_sql
64
+ self.global_tracer = None
64
65
 
65
66
  def setup_tracing(self):
66
67
  """Set up OpenTelemetry tracing with the specified exporters."""
@@ -117,7 +118,7 @@ class TelemetryConfig:
117
118
  provider.add_span_processor(
118
119
  BaggageAttributeSpanProcessor(baggage_keys=["session_id", "run_id"])
119
120
  )
120
-
121
+ self.global_tracer = trace.get_tracer("flock")
121
122
  sys.excepthook = self.log_exception_to_otel
122
123
 
123
124
  def log_exception_to_otel(self, exc_type, exc_value, exc_traceback):
@@ -79,20 +79,28 @@ class DSPyIntegrationMixin:
79
79
  try:
80
80
  field_type = eval(type_str, sys.modules[__name__].__dict__)
81
81
  except Exception as e:
82
- print("Failed to evaluate type_str in __name__" + e)
82
+ logger.warning(
83
+ "Failed to evaluate type_str in __name__" + str(e)
84
+ )
83
85
  field_type = eval(
84
86
  type_str, sys.modules["__main__"].__dict__
85
87
  )
86
88
 
87
- except Exception:
89
+ except Exception as ex:
88
90
  # AREPL fix - var
91
+ logger.warning(
92
+ "Failed to evaluate type_str in __main__" + str(ex)
93
+ )
89
94
  try:
90
95
  field_type = eval(
91
96
  f"exec_locals.get('{type_str}')",
92
97
  sys.modules["__main__"].__dict__,
93
98
  )
94
- except Exception as e:
95
- print(e)
99
+ except Exception as ex_arepl:
100
+ logger.warning(
101
+ "Failed to evaluate type_str in exec_locals"
102
+ + str(ex_arepl)
103
+ )
96
104
  field_type = str
97
105
 
98
106
  return name, field_type, desc
@@ -2,12 +2,12 @@
2
2
 
3
3
  from collections.abc import Callable
4
4
 
5
- from opentelemetry import trace
6
-
7
5
  from flock.core.flock_agent import FlockAgent
8
6
  from flock.core.logging.logging import get_logger
9
7
 
10
8
  logger = get_logger("registry")
9
+ from opentelemetry import trace
10
+
11
11
  tracer = trace.get_tracer(__name__)
12
12
 
13
13
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flock-core
3
- Version: 0.2.10
3
+ Version: 0.2.12
4
4
  Summary: Declarative LLM Orchestration at Scale
5
5
  Author-email: Andre Ratzenberger <andre.ratzenberger@whiteduck.de>
6
6
  License-File: LICENSE
@@ -39,16 +39,8 @@ Description-Content-Type: text/markdown
39
39
  <p align="center">
40
40
  <img src="docs/img/flock.png" width="600"><br>
41
41
  <img alt="Dynamic TOML Badge" src="https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fwhiteducksoftware%2Fflock%2Frefs%2Fheads%2Fmaster%2Fpyproject.toml&query=%24.project.version&style=for-the-badge&logo=pypi&label=pip%20version">
42
- <img alt="X (formerly Twitter) Follow" src="https://img.shields.io/twitter/follow/whiteduck_gmbh?style=for-the-badge&logo=X">
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
42
+ <a href="https://www.linkedin.com/company/whiteduck" target="_blank"><img alt="LinkedIn" src="https://img.shields.io/badge/linkedin-%230077B5.svg?style=for-the-badge&logo=linkedin&logoColor=white&label=whiteduck"></a>
43
+ <a href="https://bsky.app/profile/whiteduck-gmbh.bsky.social" target="_blank"><img alt="Bluesky" src="https://img.shields.io/badge/bluesky-Follow-blue?style=for-the-badge&logo=bluesky&logoColor=%23fff&color=%23333&labelColor=%230285FF&label=whiteduck-gmbh"></a>
52
44
 
53
45
  ## Overview
54
46
 
@@ -1,8 +1,8 @@
1
1
  flock/__init__.py,sha256=JeRpPR29wyqXe8El-Ug4v_Ibhf5GQm_i8yWMi0cUYz0,36
2
- flock/config.py,sha256=jmW1PQ2oiCUpERLhNFzvrcHlYS3KM_jJyMXrnoeA0gs,1547
2
+ flock/config.py,sha256=5WvDubaeM6eVyPrawybxvv3SwORArGeWi9rBZpCrAME,1548
3
3
  flock/core/__init__.py,sha256=0Xq_txurlxxjKGXjRn6GNJusGTiBcd7zw2eF0L7JyuU,183
4
- flock/core/flock.py,sha256=dyyLeCIUQ_tp-lUfbNphxwsIq8oWgEo8R2B6BhjeqTg,9826
5
- flock/core/flock_agent.py,sha256=prA2jslYuAABzIG6uw55f0XCNR-V4Ptaaju93ZuCc6E,27767
4
+ flock/core/flock.py,sha256=USuECIlmQBZUzBgaHkUwD53ltiuP7aqyK1rlNBfGPt0,10240
5
+ flock/core/flock_agent.py,sha256=Ud9MCBw67PLQc6ovnDmUP4saxF_UeM5W71MzmeWnh1o,27768
6
6
  flock/core/context/context.py,sha256=jH06w4C_O5CEL-YxjX_x_dmgLe9Rcllnn1Ebs0dvwaE,6171
7
7
  flock/core/context/context_manager.py,sha256=qMySVny_dbTNLh21RHK_YT0mNKIOrqJDZpi9ZVdBsxU,1103
8
8
  flock/core/context/context_vars.py,sha256=0Hn6fM2iNc0_jIIU0B7KX-K2o8qXqtZ5EYtwujETQ7U,272
@@ -10,7 +10,7 @@ flock/core/execution/local_executor.py,sha256=O_dgQ_HJPCp97ghdEoDSNDIiaYkogrUS0G
10
10
  flock/core/execution/temporal_executor.py,sha256=ai6ikr9rEiN2Kc-208OalxtfqL_FTt_UaH6a--oEkJM,2010
11
11
  flock/core/logging/__init__.py,sha256=Q8hp9-1ilPIUIV0jLgJ3_cP7COrea32cVwL7dicPnlM,82
12
12
  flock/core/logging/logging.py,sha256=dOo_McbAt9_dST9Hr8RTpAGU-MHR_QvskIdmXrSvZRc,4789
13
- flock/core/logging/telemetry.py,sha256=yEOfEZ3HBFeLCaHZA6QmsRdwZKtmUC6bQtEOTVeRR4o,5314
13
+ flock/core/logging/telemetry.py,sha256=On-ywmCUks7FNq7xwdhksfJhH-TlDwErGsNmE0LFTT0,5402
14
14
  flock/core/logging/trace_and_logged.py,sha256=5vNrK1kxuPMoPJ0-QjQg-EDJL1oiEzvU6UNi6X8FiMs,2117
15
15
  flock/core/logging/formatters/base_formatter.py,sha256=CyG-X2NWq8sqEhFEO2aG7Mey5tVkIzoWiihW301_VIo,1023
16
16
  flock/core/logging/formatters/formatter_factory.py,sha256=hmH-NpCESHkioX0GBQ5CuQR4axyIXnSRWwAZCHylx6Q,1283
@@ -22,9 +22,9 @@ flock/core/logging/span_middleware/baggage_span_processor.py,sha256=gJfRl8FeB6jd
22
22
  flock/core/logging/telemetry_exporter/base_exporter.py,sha256=rQJJzS6q9n2aojoSqwCnl7ZtHrh5LZZ-gkxUuI5WfrQ,1124
23
23
  flock/core/logging/telemetry_exporter/file_exporter.py,sha256=nKAjJSZtA7FqHSTuTiFtYYepaxOq7l1rDvs8U8rSBlA,3023
24
24
  flock/core/logging/telemetry_exporter/sqlite_exporter.py,sha256=CDsiMb9QcqeXelZ6ZqPSS56ovMPGqOu6whzBZRK__Vg,3498
25
- flock/core/mixin/dspy_integration.py,sha256=BV4ibXZPYAmioGD13cQc-1mS2lqH4zmZsUtqBF_5rb8,7852
25
+ flock/core/mixin/dspy_integration.py,sha256=eeY18D2ZFp_XhVFnhHISbjhkz386MEnSBzfiHRIU850,8185
26
26
  flock/core/mixin/prompt_parser.py,sha256=eOqI-FK3y17gVqpc_y5GF-WmK1Jv8mFlkZxTcgweoxI,5121
27
- flock/core/registry/agent_registry.py,sha256=QHdr3Cb-32PEdz8jFCIZSH9OlfpRwAJMtSRpHCWJDq4,4889
27
+ flock/core/registry/agent_registry.py,sha256=YkYIyvFNjm7gYKRAiQQdOvVYMtsYH5cijfrv_GP4ZHc,4889
28
28
  flock/core/tools/basic_tools.py,sha256=OwWaFu4NoVrc3Uijj56RY9XDDaP_mOnEa5B3wSWwwLE,4756
29
29
  flock/core/tools/dev_tools/github.py,sha256=a2OTPXS7kWOVA4zrZHynQDcsmEi4Pac5MfSjQOLePzA,5308
30
30
  flock/core/util/cli_helper.py,sha256=nlSnPrc1pnYEFQXcL_wCqPI6g1Jr7AzNtmGoOPs0zKw,936
@@ -374,8 +374,8 @@ flock/workflow/activities.py,sha256=YEg-Gr8kzVsxWsmsZguIVhX2XwMRvhZ2OlnsJoG5g_A,
374
374
  flock/workflow/agent_activities.py,sha256=NhBZscflEf2IMfSRa_pBM_TRP7uVEF_O0ROvWZ33eDc,963
375
375
  flock/workflow/temporal_setup.py,sha256=VWBgmBgfTBjwM5ruS_dVpA5AVxx6EZ7oFPGw4j3m0l0,1091
376
376
  flock/workflow/workflow.py,sha256=I9MryXW_bqYVTHx-nl2epbTqeRy27CAWHHA7ZZA0nAk,1696
377
- flock_core-0.2.10.dist-info/METADATA,sha256=3cccssoUbygJRWrQm572lR3mYMUHzxZ5IU8yu1Ponsg,11570
378
- flock_core-0.2.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
379
- flock_core-0.2.10.dist-info/entry_points.txt,sha256=rWaS5KSpkTmWySURGFZk6PhbJ87TmvcFQDi2uzjlagQ,37
380
- flock_core-0.2.10.dist-info/licenses/LICENSE,sha256=iYEqWy0wjULzM9GAERaybP4LBiPeu7Z1NEliLUdJKSc,1072
381
- flock_core-0.2.10.dist-info/RECORD,,
377
+ flock_core-0.2.12.dist-info/METADATA,sha256=Qq37i_zedAEstHgAe9dTucMfrZdPBlBFDdQhK0t1VgU,11915
378
+ flock_core-0.2.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
379
+ flock_core-0.2.12.dist-info/entry_points.txt,sha256=rWaS5KSpkTmWySURGFZk6PhbJ87TmvcFQDi2uzjlagQ,37
380
+ flock_core-0.2.12.dist-info/licenses/LICENSE,sha256=iYEqWy0wjULzM9GAERaybP4LBiPeu7Z1NEliLUdJKSc,1072
381
+ flock_core-0.2.12.dist-info/RECORD,,