ag2 0.9.1.post0__py3-none-any.whl → 0.9.3__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 ag2 might be problematic. Click here for more details.

Files changed (37) hide show
  1. {ag2-0.9.1.post0.dist-info → ag2-0.9.3.dist-info}/METADATA +22 -12
  2. {ag2-0.9.1.post0.dist-info → ag2-0.9.3.dist-info}/RECORD +37 -23
  3. autogen/agentchat/contrib/capabilities/transforms.py +22 -9
  4. autogen/agentchat/conversable_agent.py +37 -34
  5. autogen/agentchat/group/group_utils.py +65 -20
  6. autogen/agentchat/group/handoffs.py +81 -5
  7. autogen/agentchat/group/on_context_condition.py +2 -2
  8. autogen/agentchat/group/patterns/pattern.py +7 -1
  9. autogen/agentchat/groupchat.py +2 -2
  10. autogen/agentchat/realtime/experimental/realtime_swarm.py +12 -4
  11. autogen/agents/experimental/document_agent/document_agent.py +232 -40
  12. autogen/events/agent_events.py +7 -4
  13. autogen/interop/litellm/litellm_config_factory.py +68 -2
  14. autogen/llm_config.py +4 -1
  15. autogen/mcp/__main__.py +78 -0
  16. autogen/mcp/mcp_proxy/__init__.py +19 -0
  17. autogen/mcp/mcp_proxy/fastapi_code_generator_helpers.py +63 -0
  18. autogen/mcp/mcp_proxy/mcp_proxy.py +581 -0
  19. autogen/mcp/mcp_proxy/operation_grouping.py +158 -0
  20. autogen/mcp/mcp_proxy/operation_renaming.py +114 -0
  21. autogen/mcp/mcp_proxy/patch_fastapi_code_generator.py +98 -0
  22. autogen/mcp/mcp_proxy/security.py +400 -0
  23. autogen/mcp/mcp_proxy/security_schema_visitor.py +37 -0
  24. autogen/oai/client.py +11 -2
  25. autogen/oai/gemini.py +20 -3
  26. autogen/oai/gemini_types.py +27 -0
  27. autogen/oai/oai_models/chat_completion.py +1 -1
  28. autogen/tools/experimental/__init__.py +5 -0
  29. autogen/tools/experimental/reliable/__init__.py +10 -0
  30. autogen/tools/experimental/reliable/reliable.py +1316 -0
  31. autogen/version.py +1 -1
  32. templates/client_template/main.jinja2 +69 -0
  33. templates/config_template/config.jinja2 +7 -0
  34. templates/main.jinja2 +61 -0
  35. {ag2-0.9.1.post0.dist-info → ag2-0.9.3.dist-info}/WHEEL +0 -0
  36. {ag2-0.9.1.post0.dist-info → ag2-0.9.3.dist-info}/licenses/LICENSE +0 -0
  37. {ag2-0.9.1.post0.dist-info → ag2-0.9.3.dist-info}/licenses/NOTICE.md +0 -0
autogen/version.py CHANGED
@@ -4,4 +4,4 @@
4
4
 
5
5
  __all__ = ["__version__"]
6
6
 
7
- __version__ = "0.9.1post0"
7
+ __version__ = "0.9.3"
@@ -0,0 +1,69 @@
1
+ {{imports}}
2
+
3
+ import argparse
4
+ import os
5
+ from typing import *
6
+
7
+ from autogen.mcp.mcp_proxy import MCPProxy
8
+ from autogen.mcp.mcp_proxy.security import BaseSecurity
9
+ from autogen.mcp.mcp_proxy.security import {% for i in security_classes %}{{i}}{% if not loop.last %}, {% endif %}{% endfor %}
10
+
11
+ app = MCPProxy(
12
+ {% if info %}
13
+ {% for key,value in info.items() %}
14
+ {% set info_value= value.__repr__() %}
15
+ {% if not key.startswith('x-') %}
16
+ {{ key }} = {{info_value}},
17
+ {% endif %}
18
+ {% endfor %}
19
+ {% endif %}
20
+ )
21
+
22
+
23
+ {% for operation in operations %}
24
+ @app.{{operation.type}}('{{operation.path}}'
25
+ {% if operation.description %}
26
+ , description=""" {{operation.description}} """
27
+ {% endif %}
28
+ {% if operation.tags %}
29
+ , tags={{operation.tags}}
30
+ {% endif %}
31
+ {% if operation.security %}
32
+ , security=[{% for security in operation.security %}
33
+ {% for key, value in security.items() %}
34
+ {{security_parameters[key]}},
35
+ {% endfor %}
36
+ {% endfor %}]
37
+ {% endif %}
38
+ )
39
+ def {{operation.function_name}}({{operation.snake_case_arguments}}
40
+ ):
41
+ {%- if operation.summary %}
42
+ """
43
+ {{ operation.summary }}
44
+ """
45
+ {%- endif %}
46
+ raise RuntimeError("Should be patched by MCPProxy and never executed")
47
+ {% endfor %}
48
+
49
+ if __name__ == "__main__":
50
+ parser = argparse.ArgumentParser(description="Math Server")
51
+ parser.add_argument("transport", choices=["stdio", "sse"], help="Transport mode (stdio or sse)")
52
+ args = parser.parse_args()
53
+
54
+ if "CONFIG_PATH" in os.environ:
55
+ config_path = os.environ["CONFIG_PATH"]
56
+ app.load_configuration(config_path)
57
+
58
+ if "CONFIG" in os.environ:
59
+ config = os.environ["CONFIG"]
60
+ app.load_configuration_from_string(config)
61
+
62
+ if "SECURITY" in os.environ:
63
+ security_params = BaseSecurity.parse_security_parameters_from_env(
64
+ os.environ,
65
+ )
66
+
67
+ app.set_security_params(security_params)
68
+
69
+ app.mcp.run(transport=args.transport)
@@ -0,0 +1,7 @@
1
+ {
2
+ "server": {
3
+ "url": "{{ server_url }}"
4
+ },
5
+ "authentication": {{ authentications | tojson(indent=2) }},
6
+ "operations": {{ operations | tojson(indent=2) }}
7
+ }
templates/main.jinja2 ADDED
@@ -0,0 +1,61 @@
1
+ {{imports}}
2
+
3
+ import argparse
4
+ import os
5
+ from typing import *
6
+
7
+ from autogen.mcp.mcp_proxy import MCPProxy
8
+ from autogen.mcp.mcp_proxy.security import BaseSecurity
9
+ from autogen.mcp.mcp_proxy.security import {% for i in security_classes %}{{i}}{% if not loop.last %}, {% endif %}{% endfor %}
10
+
11
+ app = MCPProxy(
12
+ {% if info %}
13
+ {% for key,value in info.items() %}
14
+ {% set info_value= value.__repr__() %}
15
+ {% if not key.startswith('x-') %}
16
+ {{ key }} = {{info_value}},
17
+ {% endif %}
18
+ {% endfor %}
19
+ {% endif %}
20
+ )
21
+
22
+
23
+ {% for operation in operations %}
24
+ @app.{{operation.type}}('{{operation.path}}'
25
+ {% if operation.description %}
26
+ , description=""" {{operation.description}} """
27
+ {% endif %}
28
+ {% if operation.tags %}
29
+ , tags={{operation.tags}}
30
+ {% endif %}
31
+ {% if operation.security %}
32
+ , security=[{% for security in operation.security %}
33
+ {% for key, value in security.items() %}
34
+ {{security_parameters[key]}},
35
+ {% endfor %}
36
+ {% endfor %}]
37
+ {% endif %}
38
+ )
39
+ def {{operation.function_name}}({{operation.snake_case_arguments}}
40
+ ):
41
+ {%- if operation.summary %}
42
+ """
43
+ {{ operation.summary }}
44
+ """
45
+ {%- endif %}
46
+ raise RuntimeError("Should be patched by MCPProxy and never executed")
47
+ {% endfor %}
48
+
49
+ if __name__ == "__main__":
50
+ parser = argparse.ArgumentParser(description="Math Server")
51
+ parser.add_argument("transport", choices=["stdio", "sse"], help="Transport mode (stdio or sse)")
52
+ args = parser.parse_args()
53
+
54
+ if "SECURITY" in os.environ:
55
+ security_params = BaseSecurity.parse_security_parameters_from_env(
56
+ os.environ,
57
+ )
58
+
59
+ app.set_security_params(security_params)
60
+
61
+ app._mcp.run(transport=args.transport)
File without changes