Python: HarnessAgent: Disable compaction when max tokens not provided (#6410)

* HarnessAgent: Disable compaction when max tokens not provided

* Fix regression.

* Address PR comments

* Require max_output_tokens to be positive

Reject max_output_tokens=0 (must be positive), mirroring
max_context_window_tokens. Addresses PR review feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
westey
2026-06-10 14:57:23 +01:00
committed by GitHub
Unverified
parent 93cbf6b3f0
commit 8dde9ef627
3 changed files with 136 additions and 34 deletions
+12 -2
View File
@@ -45,13 +45,23 @@ python samples/02-agents/harness/harness_research.py
### Minimal Setup
`create_harness_agent` requires only a chat client and token budget parameters:
`create_harness_agent` requires only a chat client:
```python
from agent_framework import create_harness_agent
from agent_framework.foundry import FoundryChatClient
from azure.identity import AzureCliCredential
agent = create_harness_agent(
client=FoundryChatClient(credential=AzureCliCredential()),
)
```
### With Compaction
Provide token budget parameters to enable automatic context-window compaction:
```python
agent = create_harness_agent(
client=FoundryChatClient(credential=AzureCliCredential()),
max_context_window_tokens=128_000,
@@ -59,7 +69,7 @@ agent = create_harness_agent(
)
```
### Customization
### Further Customization
Disable or customize any feature: