Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions examples/studio_workflow_matrix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Studio workflow matrix

This local fixture exposes six applications for checking Studio rendering:

- `llm_agent`
- `sequential_agent`
- `parallel_agent`
- `loop_agent`
- `mixed_agent`
- `all_agent_types_agent`

Start Studio from the repository root with the agents directory set to
`examples/studio_workflow_matrix`, then send the same prompt to each app:

> 请分析团队是否应该采用每周四天工作制,并明确列出事实、风险和建议

The first five fixtures use stable markers so fragmented or duplicated cards are easy
to spot. `all_agent_types_agent` combines LLM, Sequential, Parallel, and Loop agents
while keeping all user-facing output natural and free of artificial test markers. Its
Parallel stage has four specialists so the wide-screen three-column viewport and
horizontal overflow can be exercised in one end-to-end run.
15 changes: 15 additions & 0 deletions examples/studio_workflow_matrix/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Local AgentKit Studio workflow test applications."""
17 changes: 17 additions & 0 deletions examples/studio_workflow_matrix/all_agent_types_agent/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from . import agent

__all__ = ["agent"]
124 changes: 124 additions & 0 deletions examples/studio_workflow_matrix/all_agent_types_agent/agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Natural-output Studio fixture containing every supported agent type."""

from veadk import Agent
from veadk.agents.loop_agent import LoopAgent
from veadk.agents.parallel_agent import ParallelAgent
from veadk.agents.sequential_agent import SequentialAgent


def analysis_agent(name: str, role: str, output_key: str) -> Agent:
"""Build a tool-free specialist that emits natural user-facing prose."""
return Agent(
name=name,
description=f"Handles the {role} stage of the combined workflow.",
instruction=(
f"Act as the {role} specialist. Answer in the user's language with "
"concise, self-contained prose. Do not use bracketed stage labels, "
"internal agent names, test markers, tools, or delegation."
),
output_key=output_key,
)


opening = analysis_agent(
"all_types_opening",
"problem framing",
"all_types_opening",
)

sequential_stage = SequentialAgent(
name="all_types_sequence",
description="Builds the evaluation criteria in two ordered steps.",
sub_agents=[
analysis_agent(
"all_types_context",
"context and assumptions",
"all_types_context",
),
analysis_agent(
"all_types_criteria",
"decision criteria",
"all_types_criteria",
),
],
)

parallel_stage = ParallelAgent(
name="all_types_parallel",
description="Analyzes evidence, risks, options, and rollout concurrently.",
sub_agents=[
analysis_agent(
"all_types_evidence",
"facts and evidence",
"all_types_evidence",
),
analysis_agent(
"all_types_risks",
"risks and mitigations",
"all_types_risks",
),
analysis_agent(
"all_types_options",
"alternative options",
"all_types_options",
),
analysis_agent(
"all_types_rollout",
"implementation planning",
"all_types_rollout",
),
],
)

loop_stage = LoopAgent(
name="all_types_review_loop",
description="Reviews the draft twice before the final recommendation.",
max_iterations=2,
sub_agents=[
analysis_agent(
"all_types_reviewer",
"quality review",
"all_types_review",
),
],
)

final_response = Agent(
name="all_types_final_response",
description="Produces the final recommendation for the user.",
instruction=(
"Give the user one coherent final answer in their language. Synthesize the "
"available facts, risks, decision criteria, and review feedback. Clearly "
"separate facts, risks, and recommendations using natural headings. Do not "
"print internal agent names, bracketed stage labels, or test markers."
),
output_key="all_types_final",
)

root_agent = SequentialAgent(
name="all_agent_types_agent",
description=(
"Combines LLM, sequential, parallel, and loop agents into one workflow."
),
sub_agents=[
opening,
sequential_stage,
parallel_stage,
loop_stage,
final_response,
],
)
37 changes: 37 additions & 0 deletions examples/studio_workflow_matrix/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Shared builders for the local Studio workflow test matrix."""

from veadk import Agent


def labelled_agent(
name: str,
purpose: str,
*,
output_key: str | None = None,
) -> Agent:
"""Build a tool-free LLM Agent with natural user-facing output."""
return Agent(
name=name,
description=f"Produces the {purpose} section for Studio rendering tests.",
instruction=(
f"You are the {purpose} specialist in a Studio rendering test. "
"Answer in the user's language with concise, self-contained prose. "
"Do not print internal agent names, bracketed stage labels, or test markers. "
"Never call tools, delegate work, or expose environment values."
),
output_key=output_key,
)
17 changes: 17 additions & 0 deletions examples/studio_workflow_matrix/llm_agent/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from . import agent

__all__ = ["agent"]
19 changes: 19 additions & 0 deletions examples/studio_workflow_matrix/llm_agent/agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Single LLM Agent Studio fixture."""

from common import labelled_agent

root_agent = labelled_agent("llm_agent", "single-agent analysis")
17 changes: 17 additions & 0 deletions examples/studio_workflow_matrix/loop_agent/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from . import agent

__all__ = ["agent"]
28 changes: 28 additions & 0 deletions examples/studio_workflow_matrix/loop_agent/agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Bounded Loop Agent Studio fixture."""

from common import labelled_agent

from veadk.agents.loop_agent import LoopAgent

root_agent = LoopAgent(
name="loop_agent",
description="Runs a labelled reviewer for three bounded iterations.",
max_iterations=3,
sub_agents=[
labelled_agent("loop_reviewer", "iterative review", output_key="loop_result"),
],
)
17 changes: 17 additions & 0 deletions examples/studio_workflow_matrix/mixed_agent/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from . import agent

__all__ = ["agent"]
59 changes: 59 additions & 0 deletions examples/studio_workflow_matrix/mixed_agent/agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Combined LLM, Sequential, Parallel, and Loop Agent Studio fixture."""

from common import labelled_agent

from veadk import Agent
from veadk.agents.loop_agent import LoopAgent
from veadk.agents.parallel_agent import ParallelAgent
from veadk.agents.sequential_agent import SequentialAgent

opening = labelled_agent("mixed_opening", "opening", output_key="mixed_opening")

parallel_stage = ParallelAgent(
name="mixed_parallel",
description="Runs two middle-stage specialists concurrently.",
sub_agents=[
labelled_agent("mixed_facts", "facts", output_key="mixed_facts"),
labelled_agent("mixed_risks", "risks", output_key="mixed_risks"),
],
)

loop_stage = LoopAgent(
name="mixed_loop",
description="Runs two bounded review iterations.",
max_iterations=2,
sub_agents=[
labelled_agent("mixed_reviewer", "review", output_key="mixed_review"),
],
)

closing = Agent(
name="mixed_closing",
description="Produces the final combined workflow summary.",
instruction=(
"Summarize the completed opening, parallel, and review stages in concise, "
"natural prose. Do not print internal agent names, bracketed stage labels, "
"or test markers. Never call tools or delegate work."
),
output_key="mixed_final",
)

root_agent = SequentialAgent(
name="mixed_agent",
description="Exercises LLM, Sequential, Parallel, and Loop agents together.",
sub_agents=[opening, parallel_stage, loop_stage, closing],
)
17 changes: 17 additions & 0 deletions examples/studio_workflow_matrix/parallel_agent/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from . import agent

__all__ = ["agent"]
Loading
Loading