Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check warning on line 1 in tutorials/ai-core-prior-labs-langgraph/ai-core-prior-labs-langgraph.md

View workflow job for this annotation

GitHub Actions / checks / checks

content/body-no-steps

No step headings found (expected at least one '## ' heading that is not 'You will learn' or 'Prerequisites')
parser: v2
auto_validation: true
time: 60
Expand Down Expand Up @@ -27,7 +27,7 @@
retrieve such a service key, and store the credentials in your .env file. Instructions will follow below.

The keys are available in a GitHub repo, and are rotated (old ones expired, new
ones minted) on a regular basis. They can be found in the
ones minted) on a regular basis. Always chose the latest one and ask a Developer Advocate for the password. They can be found in the
[keys/](https://github.com/SAP-samples/teched2026-sk-gen/tree/main/keys)
directory of the `SAP-samples/teched2026-sk-gen` repo on GitHub, stored in
password-protected ZIP files, which are suffixed with a timestamp
Expand Down Expand Up @@ -68,6 +68,8 @@

Before writing any code you need a running deployment of TabPFN-3.5 Plus in your SAP AI Core instance.

> 🚨 As part of the Developer Garage at TechEd 2026 use this deployment ID: `d845a8b8465ba1e6` and move on to the next step.

Use the following values when creating the deployment:

| Field | Value |
Expand All @@ -82,9 +84,17 @@

---

### Create your project folder

Create a new empty folder on your machine for this project — for example `prior-labs-agent`. Open it in VS Code using **File > Open Folder**.

All files you create in this tutorial (`.env`, `payload_data.py`, and `agent-prior-labs.py`) go in this folder.

---

### Configure environment variables

Create a file named `.env` in your project folder and add the following variables. Use the [.env.example](https://github.com/sap-tutorials/Tutorials/blob/master/tutorials/ai-core-prior-labs-langgraph/.env.example) Never commit this file! Add `.env` to your `.gitignore`. When deploying to Cloud Foundry you can simply bind those variables using [environmental variables](https://docs.cloudfoundry.org/devguide/deploy-apps/environment-variable.html).
Create a file named `.env` in your project folder and add the following variables. Use the [.env.example](https://github.com/sap-tutorials/Tutorials/blob/master/tutorials/ai-core-prior-labs-langgraph/.env.example) as a reference. Never commit this file! Add `.env` to your `.gitignore`. When deploying to Cloud Foundry you can simply bind those variables using [environmental variables](https://docs.cloudfoundry.org/devguide/deploy-apps/environment-variable.html).

```
AICORE_AUTH_URL=https://<your-subdomain>.authentication.<region>.hana.ondemand.com/oauth/token
Expand All @@ -100,15 +110,13 @@

> Note: `LLM_MODEL` is optional. This agent defaults to `sap/amazon--nova-lite` if the variable is not set.

> 🚨 You can find the deployment ID for the TabPFN model deployed as part of the Developer Garage in the [.env.example](https://github.com/sap-tutorials/Tutorials/blob/master/tutorials/ai-core-prior-labs-langgraph/.env.example) file.

---

### Install Python dependencies

In your terminal/IDE of choice: Create and activate a virtual environment, then install the required packages:

> 🚨 For the Developer Garage at TechEd 2026 in Berlin open VS Code (Visual Studio Code) on your machine and open the integrated terminal (**Terminal > New Terminal**). Create and activate a virtual environment using the commands for your OS, then run the install command.
> 🚨 For the Developer Garage at TechEd 2026 in Berlin, open the integrated terminal in VS Code (**Terminal > New Terminal**). Create and activate a virtual environment using the commands for your OS, then run the install command.
>
> **macOS/Linux:**
> ```
Expand Down Expand Up @@ -405,35 +413,6 @@
)
```

**Main**

Invoke the agent with a user message and print the results:

```python
def main():
result = forecast_agent.invoke(
{"messages": [{"role": "user", "content": "Run the TabPFN predictions and write a concise logistics operations summary."}]}
)

print("\n" + "=" * 50)
print("E-commerce Logistics Report:")
print("=" * 50)
print(result["messages"][-1].content)

for msg in result["messages"]:
if hasattr(msg, "content") and isinstance(msg.content, str):
try:
data = json.loads(msg.content)
if "predictions" in data:
evaluate_predictions(msg.content)
break
except (json.JSONDecodeError, KeyError):
pass

if __name__ == "__main__":
main()
```

---

### Add the evaluation function
Expand Down Expand Up @@ -476,6 +455,37 @@

---

### Add the main function

Finally, add `main()` to invoke the agent and print the results, followed by the entry-point guard:

```python
def main():
result = forecast_agent.invoke(
{"messages": [{"role": "user", "content": "Run the TabPFN predictions and write a concise logistics operations summary."}]}
)

print("\n" + "=" * 50)
print("E-commerce Logistics Report:")
print("=" * 50)
print(result["messages"][-1].content)

for msg in result["messages"]:
if hasattr(msg, "content") and isinstance(msg.content, str):
try:
data = json.loads(msg.content)
if "predictions" in data:
evaluate_predictions(msg.content)
break
except (json.JSONDecodeError, KeyError):
pass

if __name__ == "__main__":
main()
```

---

### Run the agent

Run the script from your project folder:
Expand Down Expand Up @@ -517,4 +527,4 @@

The complete agent script is available at [agent-prior-labs.py](https://github.com/sap-tutorials/Tutorials/blob/master/tutorials/ai-core-prior-labs-langgraph/agent-prior-labs.py).

A template for all required environment variables is provided in [env.example](https://github.com/sap-tutorials/Tutorials/blob/master/tutorials/ai-core-prior-labs-langgraph/env.example). Copy it to `.env` and fill in your values before running the agent.
A template for all required environment variables is provided in [.env.example](https://github.com/sap-tutorials/Tutorials/blob/master/tutorials/ai-core-prior-labs-langgraph/.env.example). Copy it to `.env` and fill in your values before running the agent.
Loading