> For the complete documentation index, see [llms.txt](https://docs.pipekit.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pipekit.io/python-sdk/jupyter-notebooks.md).

# Jupyter Notebooks

## Get a token

Use the [Pipekit CLI](/cli.md) to generate a token using `pipekit hera` (ensure you are logged in first).

You can then pass this token to a `PipekitService`:

```py
from pipekit_sdk.service import PipekitService

# Create a Pipekit service that is used to talk to the Pipekit API
pipekit = PipekitService(token="<token>")
```

## Submission

Create a Workflow to submit:

```py

from hera.workflows import DAG, Workflow, script

@script(image="python:3.12")
def echo(message):
    print(message)

with Workflow(
    generate_name="dag-diamond-",
    entrypoint="diamond",
    namespace="argo",
    service_account_name="argo-workflow",
) as w:
    with DAG(name="diamond"):
        A = echo(name="A", arguments={"message": "A"})
        B = echo(name="B", arguments={"message": "B"})
        C = echo(name="C", arguments={"message": "C"})
        D = echo(name="D", arguments={"message": "D"})
        A >> [B, C] >> D
```

Then use `submit` to run the Workflow on Pipekit, remember to pass in your cluster name.

```py
# Submit the Workflow to Pipekit
pipe_run = pipekit.submit(w, "<cluster-name>")
print("pipe_run", pipe_run, "\n")
```

## Log Streaming

After you have submitted a Workflow as above, you will be holding a "pipe\_run" - you can stream the logs to your Notebook using `print_logs` on the `uuid`:

```py
pipekit.print_logs(pipe_run["uuid"])
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pipekit.io/python-sdk/jupyter-notebooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
