autobots-devtools-shared-lib 0.2.3a2__tar.gz → 0.3.2__tar.gz

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.
Files changed (66) hide show
  1. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/PKG-INFO +1 -1
  2. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/pyproject.toml +1 -1
  3. autobots_devtools_shared_lib-0.3.2/src/autobots_devtools_shared_lib/common/config/__init__.py +1 -0
  4. autobots_devtools_shared_lib-0.2.3a2/src/autobots_devtools_shared_lib/common/jenkins/loader.py → autobots_devtools_shared_lib-0.3.2/src/autobots_devtools_shared_lib/common/config/jenkins_loader.py +1 -1
  5. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/services/__init__.py +0 -5
  6. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/services/context/cache_backed.py +1 -1
  7. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/services/context/in_memory.py +1 -2
  8. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/services/context/redis_store.py +1 -1
  9. autobots_devtools_shared_lib-0.3.2/src/autobots_devtools_shared_lib/common/tools/context_tools.py +62 -0
  10. autobots_devtools_shared_lib-0.2.3a2/src/autobots_devtools_shared_lib/common/jenkins/builtin_tools.py → autobots_devtools_shared_lib-0.3.2/src/autobots_devtools_shared_lib/common/tools/jenkins_builtin_tools.py +3 -3
  11. autobots_devtools_shared_lib-0.2.3a2/src/autobots_devtools_shared_lib/common/jenkins/tools.py → autobots_devtools_shared_lib-0.3.2/src/autobots_devtools_shared_lib/common/tools/jenkins_pipeline_tools.py +5 -5
  12. autobots_devtools_shared_lib-0.2.3a2/src/autobots_devtools_shared_lib/common/jenkins/http_utils.py → autobots_devtools_shared_lib-0.3.2/src/autobots_devtools_shared_lib/common/utils/jenkins_http_utils.py +13 -6
  13. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/__init__.py +2 -7
  14. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/agents/invocation_utils.py +9 -4
  15. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/tools/tool_registry.py +13 -14
  16. autobots_devtools_shared_lib-0.2.3a2/src/autobots_devtools_shared_lib/common/jenkins/__init__.py +0 -26
  17. autobots_devtools_shared_lib-0.2.3a2/src/autobots_devtools_shared_lib/common/tools/context_tools.py +0 -47
  18. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/README.md +0 -0
  19. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/__init__.py +0 -0
  20. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/__init__.py +0 -0
  21. /autobots_devtools_shared_lib-0.2.3a2/src/autobots_devtools_shared_lib/common/jenkins/config.py → /autobots_devtools_shared_lib-0.3.2/src/autobots_devtools_shared_lib/common/config/jenkins_config.py +0 -0
  22. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/observability/__init__.py +0 -0
  23. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/observability/logging_utils.py +0 -0
  24. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/observability/otel_fastapi.py +0 -0
  25. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/observability/trace_metadata.py +0 -0
  26. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/observability/trace_propagation.py +0 -0
  27. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/observability/tracing.py +0 -0
  28. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/servers/__init__.py +0 -0
  29. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/servers/fileserver/README.md +0 -0
  30. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/servers/fileserver/__init__.py +0 -0
  31. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/servers/fileserver/app.py +0 -0
  32. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/servers/fileserver/config.py +0 -0
  33. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/servers/fileserver/models.py +0 -0
  34. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/services/context/README.md +0 -0
  35. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/services/context/__init__.py +0 -0
  36. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/services/context/db_repository.py +0 -0
  37. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/services/context/factory.py +0 -0
  38. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/services/context/store.py +0 -0
  39. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/tools/__init__.py +0 -0
  40. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/tools/format_tools.py +0 -0
  41. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/tools/fserver_client_tools.py +0 -0
  42. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/utils/__init__.py +0 -0
  43. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/utils/context_utils.py +0 -0
  44. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/utils/format_utils.py +0 -0
  45. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/common/utils/fserver_client_utils.py +0 -0
  46. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/agents/__init__.py +0 -0
  47. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/agents/agent_config_utils.py +0 -0
  48. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/agents/agent_meta.py +0 -0
  49. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/agents/base_agent.py +0 -0
  50. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/agents/batch.py +0 -0
  51. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/agents/middleware.py +0 -0
  52. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/config/__init__.py +0 -0
  53. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/config/dynagent_settings.py +0 -0
  54. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/llm/__init__.py +0 -0
  55. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/llm/llm.py +0 -0
  56. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/models/__init__.py +0 -0
  57. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/models/state.py +0 -0
  58. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/services/__init__.py +0 -0
  59. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/services/structured_converter.py +0 -0
  60. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/tools/__init__.py +0 -0
  61. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/tools/state_tools.py +0 -0
  62. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/ui/__init__.py +0 -0
  63. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/ui/default_ui.py +0 -0
  64. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/ui/ui_utils.py +0 -0
  65. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/dynagent/utils/__init__.py +0 -0
  66. {autobots_devtools_shared_lib-0.2.3a2 → autobots_devtools_shared_lib-0.3.2}/src/autobots_devtools_shared_lib/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: autobots-devtools-shared-lib
3
- Version: 0.2.3a2
3
+ Version: 0.3.2
4
4
  Summary: Shared library functions to be used for all autobots projects
5
5
  License: MIT
6
6
  Author: Pralhad
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "autobots-devtools-shared-lib"
3
- version = "0.2.3-alpha.2"
3
+ version = "0.3.2"
4
4
  description = "Shared library functions to be used for all autobots projects"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -0,0 +1 @@
1
+ # ABOUTME: Common configuration models and loaders shared across the framework.
@@ -5,7 +5,7 @@ from __future__ import annotations
5
5
 
6
6
  import yaml
7
7
 
8
- from autobots_devtools_shared_lib.common.jenkins.config import JenkinsConfig
8
+ from autobots_devtools_shared_lib.common.config.jenkins_config import JenkinsConfig
9
9
  from autobots_devtools_shared_lib.common.observability.logging_utils import get_logger
10
10
 
11
11
  logger = get_logger(__name__)
@@ -3,7 +3,6 @@
3
3
  Provides converters, processors, and other utilities used by tools and agents,
4
4
  including:
5
5
 
6
- * StructuredOutputConverter - convert conversation history to structured output.
7
6
  * ContextStore - pluggable session-level context persistence.
8
7
  """
9
8
 
@@ -17,9 +16,6 @@ from autobots_devtools_shared_lib.common.services.context import (
17
16
  get_context_store,
18
17
  set_context_store,
19
18
  )
20
- from autobots_devtools_shared_lib.dynagent.services.structured_converter import (
21
- StructuredOutputConverter,
22
- )
23
19
 
24
20
  __all__ = [
25
21
  "CacheBackedContextStore",
@@ -28,7 +24,6 @@ __all__ = [
28
24
  "DbRepository",
29
25
  "InMemoryContextStore",
30
26
  "RedisContextStore",
31
- "StructuredOutputConverter",
32
27
  "get_context_store",
33
28
  "set_context_store",
34
29
  ]
@@ -54,7 +54,7 @@ class CacheBackedContextStore:
54
54
  key = self._key(context_key)
55
55
  # Read from DB (not cache) to avoid acting on stale cache data
56
56
  current = self._db.get(key) or {}
57
- updated = {**current, **dict(patch)}
57
+ updated = {**current, **{k: v for k, v in patch.items() if v is not None}}
58
58
  self._db.set(key, updated)
59
59
  self._cache.set(key, updated)
60
60
  return updated
@@ -20,8 +20,7 @@ class InMemoryContextStore:
20
20
 
21
21
  def update(self, context_key: str, patch: Mapping[str, Any]) -> dict[str, Any]:
22
22
  current = self._store.get(context_key, {})
23
- # Create a shallow copy to avoid mutating the original dict outside this store
24
- updated = {**current, **dict(patch)}
23
+ updated = {**current, **{k: v for k, v in patch.items() if v is not None}}
25
24
  self._store[context_key] = updated
26
25
  return updated
27
26
 
@@ -57,7 +57,7 @@ class RedisContextStore:
57
57
 
58
58
  def update(self, context_key: str, patch: Mapping[str, Any]) -> dict[str, Any]:
59
59
  current = self.get(context_key) or {}
60
- updated = {**current, **dict(patch)}
60
+ updated = {**current, **{k: v for k, v in patch.items() if v is not None}}
61
61
  self.set(context_key, updated)
62
62
  return updated
63
63
 
@@ -0,0 +1,62 @@
1
+ from typing import Any
2
+
3
+ from langchain.tools import ToolRuntime, tool
4
+
5
+ from autobots_devtools_shared_lib.common.utils.context_utils import (
6
+ clear_context,
7
+ get_context,
8
+ resolve_context_key,
9
+ set_context,
10
+ update_context,
11
+ )
12
+ from autobots_devtools_shared_lib.dynagent.models.state import Dynagent
13
+
14
+
15
+ def make_context_tools(context_cls: type, state_cls: type = Dynagent) -> list[Any]:
16
+ """Return context tools (get/set/update/clear) typed to the given context and state schemas.
17
+
18
+ Args:
19
+ context_cls: Pydantic-compatible model (e.g. MerContextData) whose fields and
20
+ Field(description=...) appear in the tool's JSON schema shown to the LLM.
21
+ state_cls: Agent state TypedDict used to type the injected runtime parameter.
22
+ Defaults to Dynagent. Invisible to the LLM.
23
+ """
24
+
25
+ def get_context_tool(runtime: ToolRuntime[None, Any]) -> dict[str, Any]:
26
+ """Return the current session context as a JSON-serializable dict."""
27
+ context_key = resolve_context_key(runtime.state)
28
+ return get_context(context_key)
29
+
30
+ get_context_tool.__annotations__["runtime"] = ToolRuntime[None, state_cls]
31
+
32
+ def set_context_tool(runtime: ToolRuntime[None, Any], data: dict[str, Any]) -> str:
33
+ """Replace the current session context with the provided data."""
34
+ context_key = resolve_context_key(runtime.state)
35
+ return set_context(context_key, dict(data))
36
+
37
+ set_context_tool.__annotations__["runtime"] = ToolRuntime[None, state_cls]
38
+ set_context_tool.__annotations__["data"] = context_cls
39
+
40
+ def update_context_tool(
41
+ runtime: ToolRuntime[None, Any], patch: dict[str, Any]
42
+ ) -> dict[str, Any]:
43
+ """Apply a partial update to the session context and return the new context."""
44
+ context_key = resolve_context_key(runtime.state)
45
+ return update_context(context_key, dict(patch))
46
+
47
+ update_context_tool.__annotations__["runtime"] = ToolRuntime[None, state_cls]
48
+ update_context_tool.__annotations__["patch"] = context_cls
49
+
50
+ def clear_context_tool(runtime: ToolRuntime[None, Any]) -> str:
51
+ """Clear any stored context for the current session."""
52
+ context_key = resolve_context_key(runtime.state)
53
+ return clear_context(context_key)
54
+
55
+ clear_context_tool.__annotations__["runtime"] = ToolRuntime[None, state_cls]
56
+
57
+ return [
58
+ tool(get_context_tool),
59
+ tool(set_context_tool),
60
+ tool(update_context_tool),
61
+ tool(clear_context_tool),
62
+ ]
@@ -1,4 +1,4 @@
1
- # ABOUTME: Built-in generic Jenkins observability tools.
1
+ # ABOUTME: Built-in generic Jenkins observability tools (LangChain @tool wrappers).
2
2
  # ABOUTME: Provides get_jenkins_build_status and get_jenkins_console_log.
3
3
  # ABOUTME: Call set_jenkins_config() once at startup before these tools are invoked.
4
4
 
@@ -9,11 +9,11 @@ from typing import TYPE_CHECKING
9
9
  import requests
10
10
  from langchain.tools import tool
11
11
 
12
- from autobots_devtools_shared_lib.common.jenkins.http_utils import get_auth
13
12
  from autobots_devtools_shared_lib.common.observability.logging_utils import get_logger
13
+ from autobots_devtools_shared_lib.common.utils.jenkins_http_utils import get_auth
14
14
 
15
15
  if TYPE_CHECKING:
16
- from autobots_devtools_shared_lib.common.jenkins.config import JenkinsConfig
16
+ from autobots_devtools_shared_lib.common.config.jenkins_config import JenkinsConfig
17
17
 
18
18
  logger = get_logger(__name__)
19
19
 
@@ -10,21 +10,21 @@ import requests
10
10
  from langchain_core.tools import StructuredTool
11
11
  from pydantic import BaseModel, Field, create_model
12
12
 
13
- from autobots_devtools_shared_lib.common.jenkins.builtin_tools import (
13
+ from autobots_devtools_shared_lib.common.observability.logging_utils import get_logger
14
+ from autobots_devtools_shared_lib.common.tools.jenkins_builtin_tools import (
14
15
  get_jenkins_build_status,
15
16
  get_jenkins_console_log,
16
17
  set_jenkins_config,
17
18
  )
18
- from autobots_devtools_shared_lib.common.jenkins.http_utils import (
19
+ from autobots_devtools_shared_lib.common.utils.jenkins_http_utils import (
19
20
  extract_job_name_from_url,
20
21
  get_auth,
21
22
  poll_queue_for_build_number,
22
23
  wait_for_build,
23
24
  )
24
- from autobots_devtools_shared_lib.common.observability.logging_utils import get_logger
25
25
 
26
26
  if TYPE_CHECKING:
27
- from autobots_devtools_shared_lib.common.jenkins.config import (
27
+ from autobots_devtools_shared_lib.common.config.jenkins_config import (
28
28
  JenkinsConfig,
29
29
  JenkinsPipelineConfig,
30
30
  )
@@ -147,7 +147,7 @@ def register_pipeline_tools() -> list[Any]:
147
147
  reads from disk on each invocation.
148
148
  """
149
149
  try:
150
- from autobots_devtools_shared_lib.common.jenkins.loader import load_jenkins_config
150
+ from autobots_devtools_shared_lib.common.config.jenkins_loader import load_jenkins_config
151
151
 
152
152
  logger.info("Loading Jenkins pipeline tools")
153
153
  config = load_jenkins_config()
@@ -12,7 +12,7 @@ import requests
12
12
  from autobots_devtools_shared_lib.common.observability.logging_utils import get_logger
13
13
 
14
14
  if TYPE_CHECKING:
15
- from autobots_devtools_shared_lib.common.jenkins.config import (
15
+ from autobots_devtools_shared_lib.common.config.jenkins_config import (
16
16
  JenkinsConfig,
17
17
  JenkinsPollingConfig,
18
18
  )
@@ -106,8 +106,8 @@ def wait_for_build(
106
106
  ) -> str:
107
107
  """Poll the build API until the result is non-null or the timeout is reached."""
108
108
  elapsed = 0
109
+ api_url = f"{base_url}/job/{job_name}/{build_number}/api/json"
109
110
  while elapsed < polling.max_wait_seconds:
110
- api_url = f"{base_url}/job/{job_name}/{build_number}/api/json"
111
111
  try:
112
112
  resp = requests.get(api_url, auth=auth, timeout=30)
113
113
  resp.raise_for_status()
@@ -122,12 +122,19 @@ def wait_for_build(
122
122
  f"Build #{build_number} in progress; "
123
123
  f"waiting {polling.poll_interval_seconds}s (elapsed={elapsed}s)"
124
124
  )
125
- time.sleep(polling.poll_interval_seconds)
126
- elapsed += polling.poll_interval_seconds
125
+ except (requests.ConnectionError, requests.Timeout) as exc:
126
+ logger.warning(
127
+ f"Transient poll error for {job_name}#{build_number}: {exc}; retrying in "
128
+ f"{polling.poll_interval_seconds}s (elapsed={elapsed}s)"
129
+ )
130
+ except requests.HTTPError as exc:
131
+ logger.exception(f"HTTP error polling {job_name}#{build_number}")
132
+ return f"Error polling build status: {exc}"
127
133
  except requests.RequestException as exc:
128
- logger.exception(f"Build poll error for {job_name}#{build_number}")
134
+ logger.exception(f"Unexpected poll error for {job_name}#{build_number}")
129
135
  return f"Error polling build status: {exc}"
130
-
136
+ time.sleep(polling.poll_interval_seconds)
137
+ elapsed += polling.poll_interval_seconds
131
138
  return (
132
139
  f"Timeout: build #{build_number} for job '{job_name}' "
133
140
  f"did not complete within {polling.max_wait_seconds}s"
@@ -5,9 +5,7 @@
5
5
  # UI streaming helpers live in dynagent.ui to avoid pulling Chainlit for
6
6
  # batch/invoke-only use.
7
7
 
8
- from autobots_devtools_shared_lib.common.jenkins.config import JenkinsConfig, JenkinsPipelineConfig
9
- from autobots_devtools_shared_lib.common.jenkins.loader import load_jenkins_config
10
- from autobots_devtools_shared_lib.common.jenkins.tools import create_jenkins_tools
8
+ from autobots_devtools_shared_lib.common.tools.context_tools import make_context_tools
11
9
  from autobots_devtools_shared_lib.common.utils.format_utils import output_format_converter
12
10
  from autobots_devtools_shared_lib.dynagent.agents.agent_config_utils import get_batch_enabled_agents
13
11
  from autobots_devtools_shared_lib.dynagent.agents.agent_meta import AgentMeta
@@ -36,19 +34,16 @@ __all__ = [
36
34
  "BatchResult",
37
35
  "Dynagent",
38
36
  "DynagentSettings",
39
- "JenkinsConfig",
40
- "JenkinsPipelineConfig",
41
37
  "LLMProvider",
42
38
  "RecordResult",
43
39
  "ainvoke_agent",
44
40
  "batch_invoker",
45
41
  "create_base_agent",
46
- "create_jenkins_tools",
47
42
  "get_batch_enabled_agents",
48
43
  "get_dynagent_settings",
49
44
  "invoke_agent",
50
45
  "lm",
51
- "load_jenkins_config",
46
+ "make_context_tools",
52
47
  "output_format_converter",
53
48
  "register_usecase_tools",
54
49
  "set_dynagent_settings",
@@ -37,8 +37,8 @@ def inject_langfuse_handler_into_config(
37
37
 
38
38
  def invoke_agent(
39
39
  agent_name: str,
40
- input_state: dict[str, Any],
41
- checkpointer: Any = None,
40
+ input_state: dict[str, Any] | None = None,
41
+ checkpointer: Any | None = None,
42
42
  config: RunnableConfig | None = None,
43
43
  enable_tracing: bool = True,
44
44
  trace_metadata: TraceMetadata | None = None,
@@ -81,6 +81,9 @@ def invoke_agent(
81
81
  valid_agents = get_agent_list()
82
82
  if agent_name not in valid_agents:
83
83
  raise ValueError(f"Unknown agent: {agent_name}. Valid agents: {', '.join(valid_agents)}")
84
+
85
+ if input_state is None:
86
+ input_state = {}
84
87
  # Use provided metadata or create default
85
88
  if trace_metadata is None:
86
89
  trace_metadata = TraceMetadata.create(
@@ -166,8 +169,8 @@ def invoke_agent(
166
169
 
167
170
  async def ainvoke_agent(
168
171
  agent_name: str,
169
- input_state: dict[str, Any],
170
- checkpointer: Any = None,
172
+ input_state: dict[str, Any] | None = None,
173
+ checkpointer: Any | None = None,
171
174
  config: RunnableConfig | None = None,
172
175
  enable_tracing: bool = True,
173
176
  trace_metadata: TraceMetadata | None = None,
@@ -211,6 +214,8 @@ async def ainvoke_agent(
211
214
  valid_agents = get_agent_list()
212
215
  if agent_name not in valid_agents:
213
216
  raise ValueError(f"Unknown agent: {agent_name}. Valid agents: {', '.join(valid_agents)}")
217
+ if input_state is None:
218
+ input_state = {}
214
219
  # Use provided metadata or create default
215
220
  if trace_metadata is None:
216
221
  trace_metadata = TraceMetadata.create(
@@ -5,12 +5,7 @@ import threading
5
5
  from typing import Any
6
6
 
7
7
  from autobots_devtools_shared_lib.common.observability.logging_utils import get_logger
8
- from autobots_devtools_shared_lib.common.tools.context_tools import (
9
- clear_context_tool,
10
- get_context_tool,
11
- set_context_tool,
12
- update_context_tool,
13
- )
8
+ from autobots_devtools_shared_lib.common.tools.context_tools import make_context_tools
14
9
  from autobots_devtools_shared_lib.common.tools.format_tools import output_format_converter_tool
15
10
  from autobots_devtools_shared_lib.common.tools.fserver_client_tools import (
16
11
  create_download_link_tool,
@@ -20,6 +15,7 @@ from autobots_devtools_shared_lib.common.tools.fserver_client_tools import (
20
15
  read_file_tool,
21
16
  write_file_tool,
22
17
  )
18
+ from autobots_devtools_shared_lib.dynagent.models.state import Dynagent
23
19
  from autobots_devtools_shared_lib.dynagent.tools.state_tools import get_agent_list, handoff
24
20
 
25
21
  logger = get_logger(__name__)
@@ -47,10 +43,7 @@ def get_default_tools() -> list[Any]:
47
43
  handoff,
48
44
  get_agent_list,
49
45
  output_format_converter_tool,
50
- get_context_tool,
51
- set_context_tool,
52
- update_context_tool,
53
- clear_context_tool,
46
+ *make_context_tools(Dynagent),
54
47
  get_disk_usage_tool,
55
48
  read_file_tool,
56
49
  move_file_tool,
@@ -74,7 +67,7 @@ def get_jenkins_usecase_tools() -> list[Any]:
74
67
  if _jenkins_tools_cache is None: # 1st check — no lock (fast path)
75
68
  with _jenkins_tools_lock: # acquire lock
76
69
  if _jenkins_tools_cache is None: # 2nd check — inside lock (safe)
77
- from autobots_devtools_shared_lib.common.jenkins.tools import (
70
+ from autobots_devtools_shared_lib.common.tools.jenkins_pipeline_tools import (
78
71
  register_pipeline_tools,
79
72
  )
80
73
 
@@ -99,9 +92,15 @@ def get_usecase_tools() -> list[Any]:
99
92
 
100
93
 
101
94
  def get_all_tools() -> list[Any]:
102
- """Return default + jenkins pipeline + usecase tools. Pure reader."""
103
- logger.info("Getting all tools")
104
- return get_default_tools() + get_jenkins_usecase_tools() + get_usecase_tools()
95
+ """Return default + usecase tools; usecase tools override defaults by name."""
96
+ seen: dict[str, Any] = {}
97
+ for t in get_default_tools():
98
+ seen[t.name] = t
99
+ for t in get_jenkins_usecase_tools():
100
+ seen[t.name] = t
101
+ for t in get_usecase_tools():
102
+ seen[t.name] = t # usecase wins on collision
103
+ return list(seen.values())
105
104
 
106
105
 
107
106
  # --- Test-isolation helpers (private; used only by fixtures) ---
@@ -1,26 +0,0 @@
1
- # ABOUTME: Jenkins pipeline trigger package — config, loader, and tool generation.
2
- # ABOUTME: Part of the common layer; usable by any dynagent-based application.
3
-
4
- from autobots_devtools_shared_lib.common.jenkins.config import (
5
- JenkinsAuthConfig,
6
- JenkinsConfig,
7
- JenkinsParameterConfig,
8
- JenkinsPipelineConfig,
9
- JenkinsPollingConfig,
10
- )
11
- from autobots_devtools_shared_lib.common.jenkins.loader import load_jenkins_config
12
- from autobots_devtools_shared_lib.common.jenkins.tools import (
13
- create_jenkins_tools,
14
- register_pipeline_tools,
15
- )
16
-
17
- __all__ = [
18
- "JenkinsAuthConfig",
19
- "JenkinsConfig",
20
- "JenkinsParameterConfig",
21
- "JenkinsPipelineConfig",
22
- "JenkinsPollingConfig",
23
- "create_jenkins_tools",
24
- "load_jenkins_config",
25
- "register_pipeline_tools",
26
- ]
@@ -1,47 +0,0 @@
1
- from typing import Any
2
-
3
- from langchain.tools import ToolRuntime, tool
4
-
5
- from autobots_devtools_shared_lib.common.utils.context_utils import (
6
- clear_context,
7
- get_context,
8
- resolve_context_key,
9
- set_context,
10
- update_context,
11
- )
12
- from autobots_devtools_shared_lib.dynagent.models.state import Dynagent
13
-
14
-
15
- @tool
16
- def get_context_tool(runtime: ToolRuntime[None, Dynagent]) -> dict[str, Any]:
17
- """Return the current session context as a JSON-serializable dict.
18
-
19
- The context is loaded from the configured ContextStore backend using the
20
- context_key found in the agent state. If no context exists yet, an empty
21
- dict is returned.
22
- """
23
- context_key = resolve_context_key(runtime.state)
24
- return get_context(context_key)
25
-
26
-
27
- @tool
28
- def set_context_tool(runtime: ToolRuntime[None, Dynagent], data: dict[str, Any]) -> str:
29
- """Replace the current session context with the provided data."""
30
- context_key = resolve_context_key(runtime.state)
31
- return set_context(context_key, data)
32
-
33
-
34
- @tool
35
- def update_context_tool(
36
- runtime: ToolRuntime[None, Dynagent], patch: dict[str, Any]
37
- ) -> dict[str, Any]:
38
- """Apply a partial update to the session context and return the new context."""
39
- context_key = resolve_context_key(runtime.state)
40
- return update_context(context_key, patch)
41
-
42
-
43
- @tool
44
- def clear_context_tool(runtime: ToolRuntime[None, Dynagent]) -> str:
45
- """Clear any stored context for the current session."""
46
- context_key = resolve_context_key(runtime.state)
47
- return clear_context(context_key)