Skip to content

add analytics guide#184

Merged
k8s-ci-robot merged 5 commits into
kubernetes-sigs:mainfrom
drogovozDP:docs_site_guides_analytics
Apr 2, 2026
Merged

add analytics guide#184
k8s-ci-robot merged 5 commits into
kubernetes-sigs:mainfrom
drogovozDP:docs_site_guides_analytics

Conversation

@drogovozDP

@drogovozDP drogovozDP commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

This example shows how to use agent-sandbox as a remote code execution backend for an LLM analytics agent. The agent runs in JupyterLab, defines a tool that sends Python code to a sandbox pod for execution, and renders the output (including charts) back in the notebook. The motivation is to give users a concrete end-to-end example of delegating unsafe code execution to an isolated sandbox.

@netlify

netlify Bot commented Nov 25, 2025

Copy link
Copy Markdown

Deploy Preview for agent-sandbox ready!

Name Link
🔨 Latest commit 26630a6
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/69bd44f612759900084f351c
😎 Deploy Preview https://deploy-preview-184--agent-sandbox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 25, 2025
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Hi @drogovozDP. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 25, 2025
@janetkuo

Copy link
Copy Markdown
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 25, 2025
fsGroup: 2000
containers:
- name: python-sandbox
image: us-docker.pkg.dev/<PROJECT_ID>/analytics/analytics-tool:1.0.0

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.

Use the bash format please.

us-docker.pkg.dev/$PROJECT_ID/analytics/analytics-tool:1.0.0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread examples/analytics-tool/README.md Outdated
--description="Analytics Repo"
```

And now we can create our analytics agent-sandbox tool:

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.

Prevent using the words: And now, our. Instead structure it as bullet points.

  1. Create a repository in Artifact Registry.
  2. Create analytics agent-sandbox.
  3. Deploy the changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Paraphrased all "we", "our", and "you" moments

Comment thread examples/analytics-tool/README.md Outdated
print(f"<IMG>{img_str}</IMG>")
```

As you can see, in the end the code prints an encoded image. Inside the tool definition we use the regex expression to extract this string, decode, and plot it.

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 add a sample output of how it will look like?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added

"""
try:
# Split the command string into a list to safely pass to subprocess
args = shlex.split(request.command)

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.

Validation to check malformed commands?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added

args,
capture_output=True,
text=True,
cwd="/app"

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.

Consider adding a timeout.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added

Comment thread examples/analytics-tool/README.md Outdated

## Deploy analytics tools

This section describes how to build Docker image that defines analytics tool for an ADK agent, and push the Docker image to a Artifact Registry repository and deploy from it.

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.

Nit:

This section describes how to build Docker image that defines analytics tool for an ADK agent, push the Docker image to a Artifact Registry repository and deploy the pushed image.

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.

Updated in commit: 26630a6

Comment thread examples/analytics-tool/README.md Outdated
kubectl port-forward "pod/jupyterlab-sandbox" 8888:8888
```

Follow the `welcome.ipynb` notebook.

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 you reference this from the yaml file?

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.

Added file ref in commit: 26630a6

@SHRUTI6991

Copy link
Copy Markdown
Contributor

Can we add a PR description which explains the motivation for this? I am working on a tangent PR that allows stateful execution via jupyter client: #296.

@aleks-stefanovic

Copy link
Copy Markdown
Contributor

Can we add a PR description which explains the motivation for this? I am working on a tangent PR that allows stateful execution via jupyter client: #296.

Description updated.

@@ -0,0 +1,110 @@
# AI Analytics with agent-sandbox

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Add a small overview of what this example does before going into the implementation details.


## Deploy analytics tools

This section describes how to build Docker image that defines analytics tool for an ADK agent, push the Docker image to a Artifact Registry repository and deploy the pushed image.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There is no ADK agent in this example ??

@barney-s

barney-s commented Apr 2, 2026

Copy link
Copy Markdown
Collaborator

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 2, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: barney-s, drogovozDP

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 2, 2026
@k8s-ci-robot k8s-ci-robot merged commit 5496a52 into kubernetes-sigs:main Apr 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

7 participants