mirror of
https://github.com/microsoft/autogen.git
synced 2025-06-26 22:30:10 +00:00
Merge branch 'main' into users/merlinbot/1es-pt-auto-baselining-pr
This commit is contained in:
commit
44b5c3969b
1
.github/ISSUE_TEMPLATE/1-bug_report.yml
vendored
1
.github/ISSUE_TEMPLATE/1-bug_report.yml
vendored
@ -90,6 +90,7 @@ body:
|
||||
multiple: false
|
||||
options:
|
||||
- "Python dev (main branch)"
|
||||
- "Python 0.6.1"
|
||||
- "Python 0.6.0"
|
||||
- "Python 0.5.7"
|
||||
- "Python 0.5.6"
|
||||
|
4
.github/workflows/docs.yml
vendored
4
.github/workflows/docs.yml
vendored
@ -33,7 +33,7 @@ jobs:
|
||||
[
|
||||
# For main use the workflow target
|
||||
{ ref: "${{github.ref}}", dest-dir: dev, uv-version: "0.5.13", sphinx-release-override: "dev" },
|
||||
{ ref: "python-v0.6.0", dest-dir: stable, uv-version: "0.5.13", sphinx-release-override: "stable" },
|
||||
{ ref: "python-v0.6.1", dest-dir: stable, uv-version: "0.5.13", sphinx-release-override: "stable" },
|
||||
{ ref: "v0.4.0.post1", dest-dir: "0.4.0", uv-version: "0.5.13", sphinx-release-override: "" },
|
||||
{ ref: "v0.4.1", dest-dir: "0.4.1", uv-version: "0.5.13", sphinx-release-override: "" },
|
||||
{ ref: "v0.4.2", dest-dir: "0.4.2", uv-version: "0.5.13", sphinx-release-override: "" },
|
||||
@ -51,7 +51,7 @@ jobs:
|
||||
{ ref: "python-v0.5.5", dest-dir: "0.5.5", uv-version: "0.5.13", sphinx-release-override: "" },
|
||||
{ ref: "python-v0.5.6", dest-dir: "0.5.6", uv-version: "0.5.13", sphinx-release-override: "" },
|
||||
{ ref: "python-v0.5.7", dest-dir: "0.5.7", uv-version: "0.5.13", sphinx-release-override: "" },
|
||||
{ ref: "python-v0.6.0", dest-dir: "0.6.0", uv-version: "0.5.13", sphinx-release-override: "" },
|
||||
{ ref: "python-v0.6.1", dest-dir: "0.6.1", uv-version: "0.5.13", sphinx-release-override: "" },
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
@ -5,7 +5,7 @@
|
||||
"url": "/autogen/dev/"
|
||||
},
|
||||
{
|
||||
"name": "0.6.0 (stable)",
|
||||
"name": "0.6.1 (stable)",
|
||||
"version": "stable",
|
||||
"url": "/autogen/stable/",
|
||||
"preferred": true
|
||||
|
@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "autogen-agentchat"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
license = {file = "LICENSE-CODE"}
|
||||
description = "AutoGen agents and teams library"
|
||||
readme = "README.md"
|
||||
@ -15,7 +15,7 @@ classifiers = [
|
||||
"Operating System :: OS Independent",
|
||||
]
|
||||
dependencies = [
|
||||
"autogen-core==0.6.0",
|
||||
"autogen-core==0.6.1",
|
||||
]
|
||||
|
||||
[tool.ruff]
|
||||
|
@ -1289,6 +1289,8 @@ class AssistantAgent(BaseChatAgent, Component[AssistantAgentConfig]):
|
||||
chat_message=ToolCallSummaryMessage(
|
||||
content=tool_call_summary,
|
||||
source=agent_name,
|
||||
tool_calls=[call for call, _ in normal_tool_calls],
|
||||
results=[result for _, result in normal_tool_calls],
|
||||
),
|
||||
inner_messages=inner_messages,
|
||||
)
|
||||
|
@ -426,6 +426,12 @@ class ToolCallSummaryMessage(BaseTextChatMessage):
|
||||
|
||||
type: Literal["ToolCallSummaryMessage"] = "ToolCallSummaryMessage"
|
||||
|
||||
tool_calls: List[FunctionCall]
|
||||
"""The tool calls that were made."""
|
||||
|
||||
results: List[FunctionExecutionResult]
|
||||
"""The results of the tool calls."""
|
||||
|
||||
|
||||
class ToolCallRequestEvent(BaseAgentEvent):
|
||||
"""An event signaling a request to use tools."""
|
||||
|
@ -159,7 +159,7 @@ class DiGraph(BaseModel):
|
||||
cycle_edges: List[DiGraphEdge] = []
|
||||
for n in cycle_nodes:
|
||||
cycle_edges.extend(self.nodes[n].edges)
|
||||
if not any(edge.condition is not None for edge in cycle_edges):
|
||||
if all(edge.condition is None and edge.condition_function is None for edge in cycle_edges):
|
||||
raise ValueError(
|
||||
f"Cycle detected without exit condition: {' -> '.join(cycle_nodes + cycle_nodes[:1])}"
|
||||
)
|
||||
@ -198,8 +198,10 @@ class DiGraph(BaseModel):
|
||||
# Outgoing edge condition validation (per node)
|
||||
for node in self.nodes.values():
|
||||
# Check that if a node has an outgoing conditional edge, then all outgoing edges are conditional
|
||||
has_condition = any(edge.condition is not None for edge in node.edges)
|
||||
has_unconditioned = any(edge.condition is None for edge in node.edges)
|
||||
has_condition = any(
|
||||
edge.condition is not None or edge.condition_function is not None for edge in node.edges
|
||||
)
|
||||
has_unconditioned = any(edge.condition is None and edge.condition_function is None for edge in node.edges)
|
||||
if has_condition and has_unconditioned:
|
||||
raise ValueError(f"Node '{node.name}' has a mix of conditional and unconditional edges.")
|
||||
|
||||
|
@ -219,6 +219,18 @@ def test_cycle_detection_with_exit_condition() -> None:
|
||||
)
|
||||
assert graph.has_cycles_with_exit()
|
||||
|
||||
# Use a lambda condition
|
||||
graph_with_lambda = DiGraph(
|
||||
nodes={
|
||||
"A": DiGraphNode(name="A", edges=[DiGraphEdge(target="B")]),
|
||||
"B": DiGraphNode(name="B", edges=[DiGraphEdge(target="C")]),
|
||||
"C": DiGraphNode(
|
||||
name="C", edges=[DiGraphEdge(target="A", condition=lambda msg: "test" in msg.to_model_text())]
|
||||
), # Cycle with lambda
|
||||
}
|
||||
)
|
||||
assert graph_with_lambda.has_cycles_with_exit()
|
||||
|
||||
|
||||
def test_cycle_detection_without_exit_condition() -> None:
|
||||
"""Test that cycle without exit condition raises an error."""
|
||||
@ -247,6 +259,19 @@ def test_validate_graph_success() -> None:
|
||||
graph.graph_validate()
|
||||
assert not graph.get_has_cycles()
|
||||
|
||||
# Use a lambda condition
|
||||
graph_with_lambda = DiGraph(
|
||||
nodes={
|
||||
"A": DiGraphNode(
|
||||
name="A", edges=[DiGraphEdge(target="B", condition=lambda msg: "test" in msg.to_model_text())]
|
||||
),
|
||||
"B": DiGraphNode(name="B", edges=[]),
|
||||
}
|
||||
)
|
||||
# No error should be raised
|
||||
graph_with_lambda.graph_validate()
|
||||
assert not graph_with_lambda.get_has_cycles()
|
||||
|
||||
|
||||
def test_validate_graph_missing_start_node() -> None:
|
||||
"""Test validation failure when no start node exists."""
|
||||
@ -286,6 +311,23 @@ def test_validate_graph_mixed_conditions() -> None:
|
||||
with pytest.raises(ValueError, match="Node 'A' has a mix of conditional and unconditional edges"):
|
||||
graph.graph_validate()
|
||||
|
||||
# Use lambda for condition
|
||||
graph_with_lambda = DiGraph(
|
||||
nodes={
|
||||
"A": DiGraphNode(
|
||||
name="A",
|
||||
edges=[
|
||||
DiGraphEdge(target="B", condition=lambda msg: "test" in msg.to_model_text()),
|
||||
DiGraphEdge(target="C"),
|
||||
],
|
||||
),
|
||||
"B": DiGraphNode(name="B", edges=[]),
|
||||
"C": DiGraphNode(name="C", edges=[]),
|
||||
}
|
||||
)
|
||||
with pytest.raises(ValueError, match="Node 'A' has a mix of conditional and unconditional edges"):
|
||||
graph_with_lambda.graph_validate()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_digraph_manager_cycle_without_termination() -> None:
|
||||
@ -591,6 +633,29 @@ async def test_digraph_group_chat_conditional_branch(runtime: AgentRuntime | Non
|
||||
result = await team.run(task="Trigger yes")
|
||||
assert result.messages[2].source == "B"
|
||||
|
||||
# Use lambda conditions
|
||||
graph_with_lambda = DiGraph(
|
||||
nodes={
|
||||
"A": DiGraphNode(
|
||||
name="A",
|
||||
edges=[
|
||||
DiGraphEdge(target="B", condition=lambda msg: "yes" in msg.to_model_text()),
|
||||
DiGraphEdge(target="C", condition=lambda msg: "no" in msg.to_model_text()),
|
||||
],
|
||||
),
|
||||
"B": DiGraphNode(name="B", edges=[], activation="any"),
|
||||
"C": DiGraphNode(name="C", edges=[], activation="any"),
|
||||
}
|
||||
)
|
||||
team_with_lambda = GraphFlow(
|
||||
participants=[agent_a, agent_b, agent_c],
|
||||
graph=graph_with_lambda,
|
||||
runtime=runtime,
|
||||
termination_condition=MaxMessageTermination(5),
|
||||
)
|
||||
result_with_lambda = await team_with_lambda.run(task="Trigger no")
|
||||
assert result_with_lambda.messages[2].source == "C"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_digraph_group_chat_loop_with_exit_condition(runtime: AgentRuntime | None) -> None:
|
||||
@ -773,6 +838,31 @@ async def test_digraph_group_chat_multiple_conditional(runtime: AgentRuntime | N
|
||||
result = await team.run(task="banana")
|
||||
assert result.messages[2].source == "C"
|
||||
|
||||
# Use lambda conditions
|
||||
graph_with_lambda = DiGraph(
|
||||
nodes={
|
||||
"A": DiGraphNode(
|
||||
name="A",
|
||||
edges=[
|
||||
DiGraphEdge(target="B", condition=lambda msg: "apple" in msg.to_model_text()),
|
||||
DiGraphEdge(target="C", condition=lambda msg: "banana" in msg.to_model_text()),
|
||||
DiGraphEdge(target="D", condition=lambda msg: "cherry" in msg.to_model_text()),
|
||||
],
|
||||
),
|
||||
"B": DiGraphNode(name="B", edges=[]),
|
||||
"C": DiGraphNode(name="C", edges=[]),
|
||||
"D": DiGraphNode(name="D", edges=[]),
|
||||
}
|
||||
)
|
||||
team_with_lambda = GraphFlow(
|
||||
participants=[agent_a, agent_b, agent_c, agent_d],
|
||||
graph=graph_with_lambda,
|
||||
runtime=runtime,
|
||||
termination_condition=MaxMessageTermination(5),
|
||||
)
|
||||
result_with_lambda = await team_with_lambda.run(task="cherry")
|
||||
assert result_with_lambda.messages[2].source == "D"
|
||||
|
||||
|
||||
class _TestMessageFilterAgentConfig(BaseModel):
|
||||
name: str
|
||||
|
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "autogen-core"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
license = {file = "LICENSE-CODE"}
|
||||
description = "Foundational interfaces and agent runtime implementation for AutoGen"
|
||||
readme = "README.md"
|
||||
@ -69,7 +69,7 @@ dev = [
|
||||
"pygments",
|
||||
"sphinxext-rediraffe",
|
||||
|
||||
"autogen_ext==0.6.0",
|
||||
"autogen_ext==0.6.1",
|
||||
|
||||
# Documentation tooling
|
||||
"diskcache",
|
||||
|
@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "autogen-ext"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
license = {file = "LICENSE-CODE"}
|
||||
description = "AutoGen extensions library"
|
||||
readme = "README.md"
|
||||
@ -15,7 +15,7 @@ classifiers = [
|
||||
"Operating System :: OS Independent",
|
||||
]
|
||||
dependencies = [
|
||||
"autogen-core==0.6.0",
|
||||
"autogen-core==0.6.1",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
@ -32,7 +32,7 @@ docker = ["docker~=7.0", "asyncio_atexit>=1.0.1"]
|
||||
ollama = ["ollama>=0.4.7", "tiktoken>=0.8.0"]
|
||||
openai = ["openai>=1.66.5", "tiktoken>=0.8.0", "aiofiles"]
|
||||
file-surfer = [
|
||||
"autogen-agentchat==0.6.0",
|
||||
"autogen-agentchat==0.6.1",
|
||||
"magika>=0.6.1rc2",
|
||||
"markitdown[all]~=0.1.0a3",
|
||||
]
|
||||
@ -44,21 +44,21 @@ llama-cpp = [
|
||||
graphrag = ["graphrag>=1.0.1"]
|
||||
chromadb = ["chromadb>=1.0.0"]
|
||||
web-surfer = [
|
||||
"autogen-agentchat==0.6.0",
|
||||
"autogen-agentchat==0.6.1",
|
||||
"playwright>=1.48.0",
|
||||
"pillow>=11.0.0",
|
||||
"magika>=0.6.1rc2",
|
||||
"markitdown[all]~=0.1.0a3",
|
||||
]
|
||||
magentic-one = [
|
||||
"autogen-agentchat==0.6.0",
|
||||
"autogen-agentchat==0.6.1",
|
||||
"magika>=0.6.1rc2",
|
||||
"markitdown[all]~=0.1.0a3",
|
||||
"playwright>=1.48.0",
|
||||
"pillow>=11.0.0",
|
||||
]
|
||||
video-surfer = [
|
||||
"autogen-agentchat==0.6.0",
|
||||
"autogen-agentchat==0.6.1",
|
||||
"opencv-python>=4.5",
|
||||
"ffmpeg-python",
|
||||
"openai-whisper",
|
||||
|
6
python/uv.lock
generated
6
python/uv.lock
generated
@ -455,7 +455,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "autogen-agentchat"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
source = { editable = "packages/autogen-agentchat" }
|
||||
dependencies = [
|
||||
{ name = "autogen-core" },
|
||||
@ -466,7 +466,7 @@ requires-dist = [{ name = "autogen-core", editable = "packages/autogen-core" }]
|
||||
|
||||
[[package]]
|
||||
name = "autogen-core"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
source = { editable = "packages/autogen-core" }
|
||||
dependencies = [
|
||||
{ name = "jsonref" },
|
||||
@ -585,7 +585,7 @@ dev = [
|
||||
|
||||
[[package]]
|
||||
name = "autogen-ext"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
source = { editable = "packages/autogen-ext" }
|
||||
dependencies = [
|
||||
{ name = "autogen-core" },
|
||||
|
Loading…
x
Reference in New Issue
Block a user