Merge branch 'main' into adk-python-processing

This commit is contained in:
Twisha Bansal
2026-02-11 13:26:28 +05:30
committed by GitHub
42 changed files with 2005 additions and 259 deletions

View File

@@ -1,14 +1,14 @@
---
title: "(Python) Pre and post processing"
title: "Python"
type: docs
weight: 4
weight: 1
description: >
How to add pre and post processing to your Python toolbox applications.
How to add pre- and post- processing to your Agents using Python.
---
## Prerequisites
This tutorial assumes that you have set up a basic toolbox application as described in the [local quickstart](../../getting-started/local_quickstart).
This tutorial assumes that you have set up Toolbox with a basic agent as described in the [local quickstart](../../getting-started/local_quickstart.md).
This guide demonstrates how to implement these patterns in your Toolbox applications.
@@ -32,7 +32,16 @@ The following example demonstrates how to use `ToolboxClient` with LangChain's m
{{< include "python/langchain/agent.py" >}}
```
For more information, see the [LangChain Middleware documentation](https://docs.langchain.com/oss/python/langchain/middleware/custom#wrap-style-hooks).
You can also add model-level (`wrap_model`) and agent-level (`before_agent`, `after_agent`) hooks to intercept messages at different stages of the execution loop. See the [LangChain Middleware documentation](https://docs.langchain.com/oss/python/langchain/middleware/custom#wrap-style-hooks) for details on these additional hook types.
{{% /tab %}}
{{< /tabpane >}}
## Results
The output should look similar to the following. Note that exact responses may vary due to the non-deterministic nature of LLMs and differences between orchestration frameworks.
```
AI: Booking Confirmed! You earned 500 Loyalty Points with this stay.
AI: Error: Maximum stay duration is 14 days.
```