Skip to content

[api][python] Introduce YAML API for declaring agents#670

Open
wenjin272 wants to merge 2 commits into
apache:mainfrom
wenjin272:yaml-api
Open

[api][python] Introduce YAML API for declaring agents#670
wenjin272 wants to merge 2 commits into
apache:mainfrom
wenjin272:yaml-api

Conversation

@wenjin272
Copy link
Copy Markdown
Collaborator

@wenjin272 wenjin272 commented May 14, 2026

Linked issue: #625

Purpose of change

  1. Add data structure to represent a java function in python
  2. Support execute java function tool in python.
  3. Introduce YAML api in python.

Tests

ut & e2e

API

Yes, add yaml api.

Documentation

  • doc-needed
  • doc-not-needed
  • doc-included

@github-actions github-actions Bot added doc-needed Your PR changes impact docs. fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue. and removed doc-needed Your PR changes impact docs. labels May 14, 2026
wenjin272 and others added 2 commits May 14, 2026 17:44
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

name: str
description: str | None = None
namespace: str | None = None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name namespace is confusing. Maybe something like default_func_path. Anyway, the semantic of this needs well description in documents.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need separate defaults for python and java?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this default needs more careful design, otherwise it may introduce more confusion than convenience. I'd suggest to make this a follow-up and exclude from this PR.

name: str
function: str | None = None
type: Language | None = None
parameter_types: List[str] | None = None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a more detailed description. What are the required formats/values of the parameter type strings.

"""SafeLoader that recognizes only ``true``/``false`` as booleans.

PyYAML follows YAML 1.1 by default, where ``on``/``off``/``yes``/``no``
also coerce to booleans. ``on:`` is the natural way to declare an
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change to another keyword?

Comment on lines +118 to +119
if "." in function:
qualified = function
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if namespace is foo and the function is foo.bar.Func?

return agents, shared_resources, shared_actions, agent_specs, doc


def _assert_has_python_implementation(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? What if I implemented an agent in yaml + java, but need to use it in a pyflink job?


def test_load_yaml_string_ref_to_missing_shared_action_errors() -> None:
env = AgentsExecutionEnvironment.get_execution_environment()
bad = _FIXTURES / "bad_missing_shared_action.yaml"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not write temporal contents in the source directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-needed Your PR changes impact docs. fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants