Skip to content

Build, deploy and invoke Python components with the CLI - #4529

Draft
noise64 wants to merge 6 commits into
python-sdk-wheelfrom
python-cli
Draft

noise64 wants to merge 6 commits into
python-sdk-wheelfrom
python-cli

Conversation

@noise64

@noise64 noise64 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Part of GOL-1853. Stacked on #4519 (PY-04), which is stacked on #4518 (PY-03) and #4516 (PY-02).

This PR lets the Golem CLI create, build, deploy and invoke Python components. The CLI links golem-python-assembler and builds a component from the application's modules and the golem-py-sdk wheel. It runs no Python, uv or C compiler on the host.

  • python (alias py) is a new guest language. It has no tool requirements. Bridges are not generated for Python, so BridgeSdkTargetKind::supports is false for it, and manifest validation rejects a Python component that declares agent or tool dependencies. A Python component would otherwise fail later in bridge generation, with an error that does not name the cause.
  • The new assemblePython build step names the source directory, the entry modules, the pyproject.toml and the output. The step reads the wheel that GOLEM_PYTHON_SDK_WHEEL names. The wheel is not published, so the step fails with a repair hint when the variable is not set or names a missing file. A relative path in .golem-sdk-overrides resolves against the file's directory. The test layer of the SDK overrides points it at the workspace wheel, which cargo make python-sdk-wheel builds.
  • project.dependencies may list only the exact golem-py-sdk==<version> of the CLI, compared with PEP 503 names. Third-party packages are not assembled into components yet, so the step fails instead of building a component that cannot import them.
  • The step writes the component to a .partial file and renames it after the build succeeds, so a failed build keeps the last valid component. The up-to-date check covers the source file times, the list of source files, the pyproject.toml, the step, the SHA-256 of the wheel and PREPARED_IDENTITY. The file times alone do not show a removed or renamed module, so the task marker hashes the list of files. The marker id is the build directory and the output path, not the full step, because builds with other entry modules or wheels write the same output; with an id from the full step, switching from configuration A to B and back to A found A's old marker and kept B's component. This follows the existing external-command marker.
  • The step also rejects package sources in pyproject.toml (tool.uv.sources entries and uv index or find-links settings) before any application code runs. The error names each setting but not its value, because a source URL can contain credentials. A rejected requirement with a direct reference shows name @ <URL omitted> for the same reason. The SDK always comes from the wheel of the CLI, so a project source would otherwise be ignored silently. GOLEM_PYTHON_SDK_WHEEL stays the way to build with a local wheel.
  • The python template has one component with a CounterAgent. The schema, the template layout upgrade, the template AGENTS.md guide, sdks/python/README.md (getting started), the learn app-manifest reference, the golem-build and golem-edit-manifest skills and the CLI output schema name the new language and step. The template AGENTS.md also says that package sources fail the build.
  • tests/app/python_agents.rs scaffolds the template with the real CLI. One test deploys it, checks unequal updates on two agents, kills and restarts the server, and checks the recovered state. It then checks that an unchanged build skips the assembly and keeps the bytes, and that a changed module rebuilds and redeploys. The other test checks that an unsupported type hint, an import error, a third-party dependency and path or Git sources for the SDK each fail with their cause and keep the last component. Two more tests check that removing an imported module fails the next build and keeps the last component, and that switching the entry modules from A to B and back to A assembles A again.

CI: no CI job builds the wheel or the prepared assets. The Python tests therefore have their own python tag and are in no it-cli shard. cargo make cli-integration-tests-python builds the wheel first and runs them locally. cargo make cli-integration-tests skips the python tag, because it does not build the wheel. This does not satisfy the behavioral CI gate; where the SDK CI belongs is not decided yet.

Limits: the wheel is not published. Methods are synchronous and support only the scalar types of #4518. Python guest bridges and third-party packages are not supported.

Verification

This head, ce6ef54, merges the new #4519 head into the previous head 77ffd27. This layer has no other change. Checks on this head:

  • The python_agents CLI integration tests (the integration binary with the filter python_agents, as cargo make cli-integration-tests-python runs them), with the wheel and prepared assets of componentize-py cad25ee: pass.
  • The built-in tool and plugin WASMs are the ones from the previous head; this change does not touch them.
  • cargo fmt --all -- --check and cargo clippy -p golem-python-assembler -p golem-cli --all-targets -- -D warnings: pass.
  • cargo make check-cli-output-schema and cargo make check-docs-skills: pass.
  • cargo test -p golem-cli --lib: fails only in model::agent::oplog::tests::oplog_typed_values_show_safe_secret_metadata, which expects +00:00 and gets Z. The same test fails on main 55898c2 without this stack.
  • The assembler checks and ruff at this head give the same results as Package the Python SDK as a wheel #4519.
  • Not run: the it-cli shards and cargo make cli-integration-tests.

CI: pull requests run no Golem tests. A missing result is not a pass.

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

📖 Docs preview: https://docs-q4llmmeb6-golem-cloud.vercel.app

Built from commit ce6ef54fbd6a506d8e8dd9d9086a85945dfcac56 by docs.yaml.

- A rejected requirement with a direct reference shows
  `name @ <URL omitted>`, because the URL can contain credentials.
- The CLI output schema and its generator include `assemblePython`.
- GOLEM_PYTHON_SDK_WHEEL in .golem-sdk-overrides resolves against the
  file's directory.
- A missing SDK wheel error tells how to build it.
- `cargo make cli-integration-tests` skips the python tag, which needs
  a built wheel.
- The golem-build skill lists `assemblePython:`, and the Python
  template AGENTS.md says that package sources fail the build.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant