adapt-agent 0.2.0__tar.gz → 0.3.0__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 (208) hide show
  1. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/CHANGELOG.md +282 -0
  2. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/PKG-INFO +1 -1
  3. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/__init__.py +1 -1
  4. adapt_agent-0.3.0/adapt_agent/adapters/_governed.py +579 -0
  5. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/adapters/crewai/__init__.py +1 -0
  6. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/adapters/langgraph/__init__.py +1 -0
  7. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/adapters/openai_agents/__init__.py +24 -1
  8. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/adapters/pydantic_ai/__init__.py +1 -0
  9. adapt_agent-0.3.0/adapt_agent/core/governance.py +350 -0
  10. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/evaluation/__init__.py +6 -0
  11. adapt_agent-0.3.0/adapt_agent/integrations/__init__.py +55 -0
  12. adapt_agent-0.3.0/adapt_agent/integrations/_common.py +162 -0
  13. adapt_agent-0.3.0/adapt_agent/integrations/agent_framework.py +137 -0
  14. adapt_agent-0.3.0/adapt_agent/integrations/claude_agent.py +126 -0
  15. adapt_agent-0.3.0/adapt_agent/integrations/crewai.py +114 -0
  16. adapt_agent-0.3.0/adapt_agent/integrations/google_adk.py +161 -0
  17. adapt_agent-0.3.0/adapt_agent/integrations/langgraph.py +124 -0
  18. adapt_agent-0.3.0/adapt_agent/integrations/openai_agents.py +239 -0
  19. adapt_agent-0.3.0/adapt_agent/integrations/pydantic_ai.py +171 -0
  20. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/__init__.py +10 -0
  21. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/evals.py +57 -9
  22. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/evaluation.py +264 -46
  23. adapt_agent-0.3.0/adapt_agent/optimization/extractors.py +643 -0
  24. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/metrics.py +148 -8
  25. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/optimizers.py +232 -0
  26. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/skills/adapt-agent/SKILL.md +75 -5
  27. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/skills/adapt-agent/references/evals.md +91 -3
  28. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/skills/adapt-agent/references/guardrails.md +115 -2
  29. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/skills/adapt-agent/references/optimization.md +41 -0
  30. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent.egg-info/PKG-INFO +1 -1
  31. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent.egg-info/SOURCES.txt +14 -0
  32. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/adapters.md +24 -0
  33. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/evals.md +86 -0
  34. adapt_agent-0.3.0/docs/integrations.md +190 -0
  35. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/optimization.md +36 -0
  36. adapt_agent-0.3.0/tests/test_async_governance.py +786 -0
  37. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_governed_adapters.py +12 -2
  38. adapt_agent-0.3.0/tests/test_integrations.py +1140 -0
  39. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_metrics.py +15 -0
  40. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_skills.py +125 -0
  41. adapt_agent-0.3.0/tests/test_structured_evals.py +944 -0
  42. adapt_agent-0.2.0/adapt_agent/adapters/_governed.py +0 -496
  43. adapt_agent-0.2.0/adapt_agent/optimization/extractors.py +0 -346
  44. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/CODE_OF_CONDUCT.md +0 -0
  45. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/CONTRIBUTING.md +0 -0
  46. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/LICENSE +0 -0
  47. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/MANIFEST.in +0 -0
  48. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/README.md +0 -0
  49. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/SECURITY.md +0 -0
  50. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/__main__.py +0 -0
  51. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/adapters/__init__.py +0 -0
  52. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/adapters/base.py +0 -0
  53. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/adapters/claude_agent/__init__.py +0 -0
  54. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/adapters/google_adk/__init__.py +0 -0
  55. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/adapters/microsoft_agent_framework/__init__.py +0 -0
  56. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/adversarial/__init__.py +0 -0
  57. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/cli/__init__.py +0 -0
  58. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/cli/__main__.py +0 -0
  59. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/core/__init__.py +0 -0
  60. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/core/memory.py +0 -0
  61. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/core/middleware.py +0 -0
  62. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/core/policy.py +0 -0
  63. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/core/trust.py +0 -0
  64. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/core/types.py +0 -0
  65. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/exceptions.py +0 -0
  66. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/observability/__init__.py +0 -0
  67. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/config.py +0 -0
  68. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/dataset.py +0 -0
  69. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/introspection/__init__.py +0 -0
  70. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/introspection/claude_agent.py +0 -0
  71. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/introspection/crewai.py +0 -0
  72. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/introspection/google_adk.py +0 -0
  73. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/introspection/langgraph.py +0 -0
  74. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/introspection/microsoft_agent_framework.py +0 -0
  75. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/introspection/openai_agents.py +0 -0
  76. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/introspection/pydantic_ai.py +0 -0
  77. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/judge.py +0 -0
  78. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/judges.py +0 -0
  79. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/parameters.py +0 -0
  80. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/performance.py +0 -0
  81. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/proposers.py +0 -0
  82. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/providers.py +0 -0
  83. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/runners.py +0 -0
  84. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/optimization/target.py +0 -0
  85. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/patches/__init__.py +0 -0
  86. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/py.typed +0 -0
  87. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/security/__init__.py +0 -0
  88. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/security/firewall.py +0 -0
  89. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/security/taint_tracker.py +0 -0
  90. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent/skills/__init__.py +0 -0
  91. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent.egg-info/dependency_links.txt +0 -0
  92. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent.egg-info/entry_points.txt +0 -0
  93. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent.egg-info/requires.txt +0 -0
  94. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/adapt_agent.egg-info/top_level.txt +0 -0
  95. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/api.md +0 -0
  96. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/cli.md +0 -0
  97. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/frameworks/claude_agent.md +0 -0
  98. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/frameworks/crewai.md +0 -0
  99. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/frameworks/google_adk.md +0 -0
  100. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/frameworks/index.md +0 -0
  101. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/frameworks/langgraph.md +0 -0
  102. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/frameworks/microsoft_agent_framework.md +0 -0
  103. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/frameworks/openai_agents.md +0 -0
  104. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/frameworks/pydantic_ai.md +0 -0
  105. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/index.md +0 -0
  106. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/observability.md +0 -0
  107. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/policy.md +0 -0
  108. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/quickstart.md +0 -0
  109. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/releasing.md +0 -0
  110. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/security.md +0 -0
  111. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/docs/skill.md +0 -0
  112. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/01_firewall_and_policy.py +0 -0
  113. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/02_adversarial_defense.py +0 -0
  114. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/03_langgraph_guarded_agent.py +0 -0
  115. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/04_observability.py +0 -0
  116. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/05_multi_framework_adapters.py +0 -0
  117. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/06_optimize_with_golden_dataset.py +0 -0
  118. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/07_train_from_yaml.py +0 -0
  119. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/08_agent_evals.py +0 -0
  120. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/README.md +0 -0
  121. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/claude_agent/01_basic_guarded.py +0 -0
  122. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/claude_agent/02_policy_observability_trust.py +0 -0
  123. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/claude_agent/03_evaluate_and_optimize.py +0 -0
  124. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/claude_agent/04_multi_agent_and_training.py +0 -0
  125. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/claude_agent/README.md +0 -0
  126. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/claude_agent/claude_agent.train.yaml +0 -0
  127. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/config.example.json +0 -0
  128. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/crewai/01_basic_guarded.py +0 -0
  129. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/crewai/02_policy_observability_trust.py +0 -0
  130. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/crewai/03_evaluate_and_optimize.py +0 -0
  131. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/crewai/04_multi_agent_and_training.py +0 -0
  132. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/crewai/README.md +0 -0
  133. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/crewai/crewai.train.yaml +0 -0
  134. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/google_adk/01_basic_guarded.py +0 -0
  135. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/google_adk/02_policy_observability_trust.py +0 -0
  136. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/google_adk/03_evaluate_and_optimize.py +0 -0
  137. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/google_adk/04_multi_agent_and_training.py +0 -0
  138. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/google_adk/README.md +0 -0
  139. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/google_adk/google_adk.train.yaml +0 -0
  140. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/langgraph/01_basic_guarded.py +0 -0
  141. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/langgraph/02_policy_observability_trust.py +0 -0
  142. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/langgraph/03_evaluate_and_optimize.py +0 -0
  143. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/langgraph/04_multi_agent_and_training.py +0 -0
  144. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/langgraph/README.md +0 -0
  145. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/langgraph/langgraph.train.yaml +0 -0
  146. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/microsoft_agent_framework/01_basic_guarded.py +0 -0
  147. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/microsoft_agent_framework/02_policy_observability_trust.py +0 -0
  148. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/microsoft_agent_framework/03_evaluate_and_optimize.py +0 -0
  149. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/microsoft_agent_framework/04_magentic_team_and_training.py +0 -0
  150. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/microsoft_agent_framework/README.md +0 -0
  151. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/microsoft_agent_framework/magentic.train.yaml +0 -0
  152. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/openai_agents/01_basic_guarded.py +0 -0
  153. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/openai_agents/02_policy_observability_trust.py +0 -0
  154. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/openai_agents/03_evaluate_and_optimize.py +0 -0
  155. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/openai_agents/04_multi_agent_and_training.py +0 -0
  156. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/openai_agents/README.md +0 -0
  157. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/openai_agents/openai_agents.train.yaml +0 -0
  158. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/pydantic_ai/01_basic_guarded.py +0 -0
  159. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/pydantic_ai/02_policy_observability_trust.py +0 -0
  160. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/pydantic_ai/03_evaluate_and_optimize.py +0 -0
  161. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/pydantic_ai/04_multi_agent_and_training.py +0 -0
  162. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/pydantic_ai/README.md +0 -0
  163. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/pydantic_ai/pydantic_ai.train.yaml +0 -0
  164. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/examples/train.example.yaml +0 -0
  165. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/pyproject.toml +0 -0
  166. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/setup.cfg +0 -0
  167. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/__init__.py +0 -0
  168. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_action_refs.py +0 -0
  169. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_adapters.py +0 -0
  170. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_adversarial.py +0 -0
  171. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_adversarial_extra.py +0 -0
  172. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_cli.py +0 -0
  173. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_cli_optimize.py +0 -0
  174. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_cli_skills.py +0 -0
  175. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_core.py +0 -0
  176. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_evaluation.py +0 -0
  177. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_firewall_extra.py +0 -0
  178. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_memory.py +0 -0
  179. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_middleware.py +0 -0
  180. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_observability.py +0 -0
  181. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_observability_extra.py +0 -0
  182. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimization.py +0 -0
  183. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_config.py +0 -0
  184. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_dataset.py +0 -0
  185. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_evals.py +0 -0
  186. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_evaluation.py +0 -0
  187. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_extractors.py +0 -0
  188. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_introspect_claude_agent.py +0 -0
  189. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_introspect_crewai.py +0 -0
  190. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_introspect_google_adk.py +0 -0
  191. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_introspect_langgraph.py +0 -0
  192. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_introspect_microsoft_agent_framework.py +0 -0
  193. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_introspect_openai_agents.py +0 -0
  194. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_introspect_pydantic_ai.py +0 -0
  195. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_introspection.py +0 -0
  196. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_judge.py +0 -0
  197. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_judges.py +0 -0
  198. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_optimizers.py +0 -0
  199. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_parameters.py +0 -0
  200. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_proposers.py +0 -0
  201. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_providers.py +0 -0
  202. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_runners.py +0 -0
  203. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_optimize_target.py +0 -0
  204. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_patches.py +0 -0
  205. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_policy.py +0 -0
  206. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_security.py +0 -0
  207. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_taint_tracker.py +0 -0
  208. {adapt_agent-0.2.0 → adapt_agent-0.3.0}/tests/test_trust.py +0 -0
@@ -7,6 +7,288 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.0] - 2026-08-21
11
+
12
+ ### Added
13
+
14
+ - **Async is now a first-class path, not a leaf-node rescue.** Every governed
15
+ agent gained `aexecute`, the awaitable twin of `execute` with identical
16
+ governance. It awaits the framework in the *caller's* event loop, so
17
+ concurrent requests stay concurrent and `contextvars` -- how OpenTelemetry
18
+ propagates the active span -- survive. Previously an async-native framework
19
+ (Pydantic AI, the Claude Agent SDK, Microsoft Agent Framework) could only be
20
+ governed from a synchronous caller, and the advice to use a worker thread cost
21
+ both concurrency and trace parentage. `aresolve_runner` and
22
+ `EvaluationHarness.aevaluate` mirror it upward; the governance stages are
23
+ shared, so the two call styles cannot drift.
24
+ - **Native governance hooks for every supported framework**
25
+ (`adapt_agent.integrations`). An adapter wraps an agent from the outside, which
26
+ governs only a graph's boundary; these plug into the framework's own
27
+ interception point so rules nest *per agent* inside a multi-agent graph,
28
+ compose with middleware the app already stacks, and don't fight the workflow
29
+ runtime. Each factory was written against the installed SDK's own source:
30
+ Microsoft Agent Framework (`Agent(middleware=[...])`), Google ADK
31
+ (before/after model callbacks, with an `on_block="refuse"` mode that
32
+ short-circuits the model instead of aborting the tree), OpenAI Agents SDK
33
+ (input/output guardrails), Claude Agent SDK (`UserPromptSubmit` and
34
+ `PreToolUse` hooks -- the latter reaching tool inputs no outer wrapper can
35
+ see), LangGraph (`pre_model_hook`/`post_model_hook`), CrewAI (kickoff
36
+ callbacks plus a task guardrail), and Pydantic AI (output validator only --
37
+ it has no native pre-run hook, and the docs say so rather than inventing one).
38
+ - `GovernanceGate` (`adapt_agent.core.governance`): the single, framework-free
39
+ implementation of screen -> policy -> screen, now shared by both the adapters
40
+ and the native hooks so a fix reaches every framework at once.
41
+ - **Concurrency for evals.** `EvaluationHarness.evaluate(..., concurrency=N)`
42
+ runs examples in a thread pool for synchronous agents; `aevaluate(...,
43
+ concurrency=N)` uses a bounded async worker pool for async ones.
44
+ `evaluate_agent` takes the same knob. A serial harness made optimization
45
+ impractical -- a 60-eval sweep over a 113-case split is 6,780 LLM round-trips.
46
+ Both paths preserve index ordering, non-fatal per-example errors, and the
47
+ `max_results` memory bound.
48
+ - `extract_output_payload`: unwraps the framework envelope but **keeps the
49
+ structure** -- a mapping passes through, a declared structured output (Pydantic
50
+ model or dataclass) becomes a dict, and a JSON string (including a
51
+ ```` ```json ```` fenced one) is parsed back into an object. Previously a
52
+ structured answer was either flattened to `.text` by `extract_output_text` or
53
+ left as a `repr()` by `output_extractor=None`. Three shapes that would each
54
+ have scored 0.0 across every column are handled by name: a LangGraph
55
+ `response_format=` **state** (the answer is under `structured_response`,
56
+ beside `messages`; the state is identified by what LangGraph guarantees --
57
+ `add_messages` coerces every entry to a `BaseMessage` -- so an answer that
58
+ merely has fields of those names is not peeled); a **single-field answer** like
59
+ `{"result": "granted"}` or `{"answer": {"city": "Paris"}}`, which is the
60
+ answer rather than an envelope around one. Shape alone cannot decide that --
61
+ both readings occur for `{"result": [...]}` -- so `execute` now marks its own
62
+ wrapper (`GovernedEnvelope`, a plain `dict` in every respect that matters but
63
+ identifiable), and extraction stops guessing; and a declared output
64
+ whose field happens to be *called* `answer` or
65
+ `result`, which the generic attribute peel would have reduced to its own
66
+ value. `extract_output_text` likewise leaves a declared output unchanged, so a
67
+ per-row `field_match` dispatched by `checks` still sees its fields. A **list of
68
+ records** is the answer rather than a message stream, so a list of dataclasses
69
+ or models comes back whole instead of collapsing to its last element.
70
+ - `field_match(field, ...)` and `field_metrics([...])`: score a structured
71
+ output per field, reported under the field's own name, so a report aggregates
72
+ as a per-column table (`{"lane": 0.94, ..., "pack": 0.0}`) rather than one
73
+ blended number that hides which column moved. `evaluate_agent` switches to
74
+ payload extraction automatically when every metric is structural.
75
+ - `OptimizationResult.to_config(path)` reserves the `_provenance` namespace.
76
+ `load_tuned_config` skips that key on the way in, so a tuned parameter named
77
+ for it could be exported but never reloaded -- and in JSON the real provenance
78
+ block overwrote it first. It is described rather than written, so the loss is
79
+ visible instead of silent.
80
+ - `OptimizationResult.to_config(path)` handles a bare parameter name that is
81
+ also a component prefix (`{"agent": 1, "agent.temperature": 0.2}`): the two
82
+ cannot share the top level, and which one survived depended only on dict
83
+ ordering -- one order raised `TypeError`, the other silently dropped the
84
+ component's knobs. The qualified knobs are exported and the bare name is
85
+ described.
86
+ - `OptimizationResult.to_config(path)` and `load_tuned_config(path)`: export the
87
+ winning configuration as reviewable `{component: {parameter: value}}` YAML and
88
+ load it back. The optimizer applied its result in place, to live objects, so
89
+ it died with the process; now the loop is optimize -> diff -> review -> commit
90
+ and a machine-rewritten prompt cannot reach production unread.
91
+
92
+ ### Security
93
+
94
+ - **A tool result carrying a prompt injection reached the model unscreened.**
95
+ Google ADK returns a tool's output under `Part.function_response.response`, a
96
+ mapping, never `Part.text` -- and `extract_texts` neither walked that
97
+ attribute nor reached it within its recursion bound, so the firewall was blind
98
+ on exactly the path that carries untrusted content back from the open web. The
99
+ identical string as a plain text part was blocked. Tool-response attributes
100
+ are now walked explicitly, and the bound is sized from the deepest real
101
+ payload (a governed ADK tool result is eight hops) rather than a guess,
102
+ because a security scan that stops early fails open.
103
+
104
+ ### Fixed
105
+
106
+ - **A Claude tool *result* was never screened.** Only `UserPromptSubmit` and
107
+ `PreToolUse` were governed by default, so whatever a tool fetched from the
108
+ open web reached the model unscreened unless it happened to be copied into a
109
+ *subsequent* tool call. `PostToolUse` joins the defaults -- the same gap
110
+ closed on the ADK side.
111
+ - **A tool matcher silently disabled prompt screening.** `matcher=` is a tool
112
+ name, and it was attached to every governed event including
113
+ `UserPromptSubmit`, describing a prompt event that can never match. It now
114
+ applies to tool-scoped events only, which is what the parameter's own
115
+ documentation already said.
116
+ - **A coroutine returning a stream was not drained.** Both `execute` and
117
+ `aexecute` awaited once and handed the still-live async generator on, so
118
+ output screening found no text -- a firewall bypass for streamed content --
119
+ and the caller received a generator where the envelope documents a list. The
120
+ awaited value is resolved recursively, and the sync path now routes through
121
+ the same resolver as the async one rather than keeping a parallel copy that
122
+ could drift.
123
+ - **A handoff target's input governance never ran.** The OpenAI Agents SDK runs
124
+ input guardrails for the *starting* agent of a run only (`run.py` gates them
125
+ on `current_turn == 0`), so a specialist reached by a handoff had its
126
+ firewall, defense and policy rules configured, documented and silently
127
+ skipped for transferred content. Confirmed by driving a real handoff against
128
+ the installed SDK. New `openai_agents.governance_agent_hooks()` binds to
129
+ `AgentHooks.on_llm_start`, which fires per agent and per model call -- so it
130
+ also screens tool results on their way back to the model -- and `inner=`
131
+ keeps the app's own lifecycle hooks running. `on_end` screens the
132
+ specialist's answer, so a handoff target is governed in both directions.
133
+ - **`aexecute` blocked the event loop on a synchronous framework.** The
134
+ resolver falls back to the sync runner so an async app can use one entry
135
+ point uniformly, but calling it did the work before the first await: a
136
+ heartbeat task got zero ticks and three concurrent calls serialised (0.45s
137
+ for 3 x 150ms). The sync fallback runs in a worker thread now --
138
+ `asyncio.to_thread`, so `contextvars` and the active span still reach the
139
+ framework -- and the same three calls take 0.15s.
140
+ - **A shared gate's label did not reach every message.** The Claude refusal
141
+ reason and the OpenAI tripwire's `output_info` interpolated the factory
142
+ parameter rather than the resolved gate id, so a binding using a shared gate
143
+ reported the default while applying that gate's controls. Both use
144
+ `resolved.agent_id` now, matching the MAF span.
145
+ - **An ADK refusal did not say which agent refused.** `on_block="refuse"`
146
+ returns an ordinary `LlmResponse`, so unlike the raising path it carried
147
+ nothing for the surrounding graph to inspect -- two specialists produced
148
+ byte-identical objects, though the factory documented `agent_id` as
149
+ identifying which one refused. The id and the threats now travel in
150
+ `custom_metadata["adapt_agent"]`, leaving `refusal_text` as the caller's copy
151
+ for the end user.
152
+ - **One problem was reported several times.** A payload yields many texts -- a
153
+ request's parts, a message list, a model's fields -- so a single blocked
154
+ request raised `["firewall", "firewall", "firewall"]`. Threat labels are
155
+ de-duplicated, keeping first-seen order; the multiplicity counted texts
156
+ scanned, not distinct problems.
157
+ - **A shared gate was labelled by the wrong agent.** Passing
158
+ `gate=` alongside `agent_id=` -- the advertised multi-agent setup -- returned
159
+ the gate unchanged, so a violation raised an error naming the *shared* gate
160
+ while the hook traced the same invocation under the binding's id. The binding's
161
+ id now wins where it is given, the gate's own label applies where it is not,
162
+ and the span carries whichever the error does.
163
+ - **A blocked output was traced as a successful run.** The observer span closed
164
+ as `completed` before post-middleware and output screening ran, so a caller
165
+ received `SecurityBlockedError` while telemetry recorded success -- hiding the
166
+ output-policy failures monitoring exists to surface. The span now closes last,
167
+ and as an error when either stage raises, on `execute`, `aexecute`, and the
168
+ Microsoft Agent Framework middleware (the only native hook that opens a span).
169
+ - **A bare parameter name did not survive the config round trip.** `to_config`
170
+ filed a name with no `component.` prefix under a synthetic `agent` section,
171
+ renaming it on the way out; `load_tuned_config` could not recover the original,
172
+ so `apply()` silently skipped it and the export/reload round trip did not
173
+ restore the winner. Bare names now stay at the top level, under their own name.
174
+ - **A per-row `field_match` scored a false 0.0 on a model result.** A row's
175
+ `{"check": {"name": "field_match", ...}}` is dispatched by `checks`, which
176
+ cannot be marked structural (the row decides at run time), so extraction leaves
177
+ a Pydantic AI result as a model object. Mapping coercion now accepts models and
178
+ dataclasses, matching what payload extraction already did.
179
+ - **A tuple parameter was exported as a list.** Both encoders read a sequence
180
+ back as a `list`, so reloading changed the winning value's type and a setter
181
+ expecting a tuple would receive a list. Tuples are now described rather than
182
+ exported, keeping the invariant that the config body is exactly what applies
183
+ cleanly.
184
+ - **A drained event stream defeated structural scoring.** An async framework's
185
+ result is materialised into a list, and `extract_output_payload` returned that
186
+ list as the payload -- so a Claude Agent SDK `ResultMessage` carrying
187
+ `{"lane": "NOS"}` left every `field_match` scoring a false 0.0. Recognised
188
+ streams are now scanned from the end for their final payload, while a genuine
189
+ structured list (containing nothing a registered extractor recognises) is
190
+ returned unchanged.
191
+ - **OpenAI guardrail policy never saw the runtime context.** Authorization data
192
+ passed as `Runner.run(..., context=...)` arrives on `RunContextWrapper.context`
193
+ and was not merged into the policy state, so a rule gating on
194
+ `state['trust_score']` found the key absent and failed open.
195
+ - **`defense` was silently inert on the Pydantic AI validator**, for the same
196
+ reason as `policy_enforcer`: `scan_output` runs the firewall only, deliberately,
197
+ since adversarial-*input* detection over an answer flags an agent legitimately
198
+ quoting an instruction. It is now refused alongside policy rather than accepted
199
+ and ignored.
200
+ - **A `policy_enforcer` given to the Pydantic AI validator was silently
201
+ ignored.** That seam sees only the output, so a state-gating rule could never
202
+ fire; it now raises with a pointer to the adapter rather than accepting a
203
+ control it cannot honour.
204
+ - **ADK policy never saw session state.** The callback synthesised policy state
205
+ from the model request alone, so a rule reading `state['trust_score']` found
206
+ the key absent and a fail-open enforcer read that as "no violation". The
207
+ callback context's state is now merged in.
208
+ - **A cancelled native hook left its observer span open**, the same
209
+ `except Exception` gap as the adapter path.
210
+ - **The threaded eval pool stalled behind a slow example.** Refilling waited on
211
+ the *oldest* future, idling the other workers until it finished; with variable
212
+ LLM latency that collapses the achieved concurrency (measured: 0.96s against
213
+ an 0.65s ideal). It now refills from whichever future completes first, with
214
+ index ordering restored by the accumulator.
215
+ - **`aexecute` still blocked on a directly-wrapped OpenAI SDK `Agent`.** Such an
216
+ agent exposes neither `run` nor `run_sync`, so the async preference list could
217
+ not match and the adapter fell back to its synchronous `Runner.run_sync`
218
+ lambda. It now has an async SDK runner using `Runner.run`.
219
+ - **`aexecute` called the framework's *synchronous* entry point.** The runner
220
+ was resolved once from the sync-first `run_method_names`, so on LangGraph,
221
+ CrewAI, Pydantic AI and the OpenAI Agents SDK the async path invoked
222
+ `invoke`/`kickoff`/`run_sync` and blocked the very event loop it exists to
223
+ cooperate with -- while `ainvoke`/`kickoff_async`/`run` went unused. Adapters
224
+ now declare `async_run_method_names` and `aexecute` resolves against it,
225
+ falling back to the sync runner for a framework that has no async twin.
226
+ - **A cancelled `aexecute` left its observer span open forever.**
227
+ `asyncio.CancelledError` derives from `BaseException`, so `except Exception`
228
+ never saw it and neither the error nor the completion path ran.
229
+ - **Renaming a structural metric stripped its `structural` flag.**
230
+ `metrics={"lane_acc": field_match("lane")}` fell back to text extraction, so a
231
+ model-returning agent scored 0.0. The flag now survives both rename paths --
232
+ the harness's and `evaluate_agent`'s, the latter of which had been missed.
233
+ - **Report-only mode silently disabled policy auditing.** With
234
+ `block_on_violation=False` the adapter skipped `policy_violations()` entirely,
235
+ and since `PolicyEnforcer.check_state` is what records violations and fires
236
+ warn/log handlers, the documented rollout mode recorded nothing at all rather
237
+ than recording without refusing. Policy is now evaluated whatever the blocking
238
+ mode; only the refusal is conditional.
239
+ - **`to_config` crashed on tool and skill parameters.** Those hold live
240
+ callables, which no YAML or JSON encoder can represent, so exporting a run
241
+ from the default optimizer's tool stage raised. They are now listed by
242
+ `module:qualname` for the review diff and kept out of the config body, so the
243
+ file stays reloadable and `apply()` can never write a stand-in string over a
244
+ real tool list.
245
+ - **A `policy_enforcer` passed to the Microsoft Agent Framework or Google ADK
246
+ hooks was silently inert.** Both called `review_input` without a `state`, and
247
+ the gate only evaluates policy when given one -- so the control was accepted,
248
+ documented, and did nothing, while `call_next()` ran on. Every hook now passes
249
+ a state, and a test drives all four input-screening hooks against a recording
250
+ enforcer so one binding cannot forget again.
251
+ - **A structured output nested under a wrapper attribute went unscreened.** Text
252
+ extraction recursed only into `dict`/`list`/`tuple`, so a Pydantic AI
253
+ `AgentRunResult.output` holding a `BaseModel` -- the ordinary shape -- had its
254
+ wrapper walked and the answer inside it skipped. Any non-primitive is now
255
+ followed.
256
+ - **A governed adapter's envelope defeated structural metrics.** `execute`
257
+ returns `{"result": <payload>}`, which `extract_output_payload` treated as the
258
+ payload, so every `field_match` scored 0.0 against the real fields. A single
259
+ conventional key is now peeled; a multi-key mapping is still treated as the
260
+ answer, so a structured result that happens to contain `result` is unharmed.
261
+ - **The threaded eval path was not memory-bounded.** `evaluate(concurrency>1)`
262
+ materialised the whole dataset and handed it to `ThreadPoolExecutor.map`,
263
+ which itself submits every example up front. Replaced with bounded submission
264
+ that keeps at most `concurrency` runs in flight and pulls lazily, matching
265
+ what `aevaluate` already did.
266
+ - **Structured outputs were almost entirely unscreened.** Text extraction only
267
+ probed a handful of conventional attribute names (`text`, `content`,
268
+ `output`, ...), so a Pydantic model or dataclass with fields like `lane` or
269
+ `note` -- exactly what a Pydantic AI `output_type` produces -- passed through
270
+ the firewall untouched, and an injection smuggled into one field was never
271
+ seen. Pydantic (v1 and v2) model and dataclass fields are now walked.
272
+ - `execute` raising inside a running event loop abandoned the framework's
273
+ coroutine un-awaited, emitting a `RuntimeWarning` that pointed at the
274
+ framework instead of the real problem. The coroutine is now closed, and the
275
+ error message points at `aexecute`.
276
+ - `get_metric` surfaced a raw `TypeError` for a built-in needing arguments; it
277
+ now explains that `field_match` is reachable through a mapping check spec.
278
+
279
+ ### Documentation
280
+
281
+ - `references/guardrails.md` carried no async warning at all, while the evals
282
+ gotchas did -- the one page omitting it described the code path that raises.
283
+ It now documents `aexecute`, why a worker thread is the wrong fix, and the
284
+ native-hook matrix.
285
+ - New `docs/integrations.md`, plus async/concurrency/structured-scoring and
286
+ config-export sections across the skill and the docs site.
287
+ - Two more tests that *execute the documentation verbatim* rather than
288
+ inspecting it: the structured-scoring recipe is run, and every integration
289
+ factory named in the matrix is resolved.
290
+
291
+
10
292
  ### Added
11
293
 
12
294
  - **Bundled agent skill** (`adapt_agent/skills/adapt-agent/`): the wheel now
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: adapt-agent
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: ADAPT-Agent: Adversarial Defense & Policy Training for LLM Agents - A comprehensive library for LLM agent optimization and security
5
5
  Author-email: Daniel Halwell <danielhalwell@gmail.com>
6
6
  Maintainer-email: Daniel Halwell <danielhalwell@gmail.com>
@@ -4,7 +4,7 @@ ADAPT-Agent: Adversarial Defense & Policy Training for LLM Agents
4
4
  A comprehensive library for LLM agent optimization and security.
5
5
  """
6
6
 
7
- __version__ = "0.2.0"
7
+ __version__ = "0.3.0"
8
8
 
9
9
  # Core exports
10
10
  # Framework adapters