Skip to content

Introduce agentscope-harness module#1353

Merged
chickenlj merged 32 commits into
mainfrom
harness
May 8, 2026
Merged

Introduce agentscope-harness module#1353
chickenlj merged 32 commits into
mainfrom
harness

Conversation

@chickenlj

Copy link
Copy Markdown
Collaborator

This pull request introduces a new agentscope-harness module built with the Harness Engineering practices.

Purpose

agentscope-harness builds on agentscope-core with a higher-level agent runtime for production-style assistants: workspace-first workflows, pluggable execution environments, and richer memory/session tooling.

Entry point

HarnessAgent wraps ReActAgent with opinionated defaults: hooks, toolkit wiring, and configuration for workspace, skills, subagents, and persistence.

Key design ideas

  • Workspace-centric context — Loads and injects workspace material (e.g. AGENTS.md, MEMORY.md, knowledge) into the agent’s unified system message via hooks such as WorkspaceContextHook.
  • Pluggable filesystem — Abstracts file operations behind a filesystem layer (local, sandbox-backed, remote/composite) so tools and agents share one API regardless of where files actually live.
  • Sandbox & isolation — Optional sandbox execution with lifecycle management, state stores, and options for distributed deployments when session/sandbox state must be shared across replicas.
  • Session & persistence — WorkspaceSession, session trees, and hooks (e.g. session persistence, traces) tie long-running work to durable session state where configured.
  • Memory operations — Memory flush/consolidation, compaction, and eviction policies help keep context bounded; dedicated tools (e.g. memory search/get) support retrieval over workspace memory files.
  • Subagents — Declarative subagent specs, spawn/send/list tooling, and background tasks for delegated or async work (SubagentsHook, task repository).
  • Relationship to core. Harness does not replace ReActAgent; it composes it with extra hooks, tools, and backends so applications can adopt “harness” behavior incrementally while staying aligned with core APIs (Model, Toolkit, Session, hooks).

This pull request also includes significant enhancements to the ReActAgent class, focusing on improved runtime context handling, per-call system message management, and better integration of hook-supplied tools.

  • Runtime Context and System Message Handling
  • Hook and Toolkit Integration
  • General Refactoring and Minor Improvements

chickenlj and others added 30 commits April 21, 2026 19:56
…-java into harness

# Conflicts:
#	agentscope-examples/harness-examples/harness-example-common/pom.xml
#	agentscope-examples/harness-examples/harness-example-common/src/main/java/io/agentscope/examples/harness/common/model/FixedReplyModel.java
#	agentscope-examples/harness-examples/harness-quickstart/.env.example
#	agentscope-examples/harness-examples/harness-quickstart/README.md
#	agentscope-examples/harness-examples/harness-quickstart/src/main/java/io/agentscope/harness/example/QuickstartExample.java
#	agentscope-examples/harness-examples/harness-quickstart/src/main/java/io/agentscope/harness/example/SqliteTool.java
#	agentscope-examples/harness-examples/harness-quickstart/src/main/java/io/agentscope/harness/example/TextToSqlExample.java
#	agentscope-examples/harness-examples/harness-quickstart/src/main/java/io/agentscope/harness/example/WorkspaceInitializer.java
#	agentscope-examples/harness-examples/harness-quickstart/src/main/resources/agentscope.json.example
#	agentscope-examples/harness-examples/harness-quickstart/src/main/resources/io/agentscope/harness/example/chinook-default.sqlite
#	agentscope-examples/harness-examples/harness-quickstart/src/main/resources/log4j2.component.properties
#	agentscope-examples/harness-examples/harness-quickstart/src/main/resources/log4j2.xml
#	agentscope-examples/harness-examples/harness-quickstart/src/main/resources/workspace/knowledge/KNOWLEDGE.md
#	agentscope-examples/harness-examples/harness-quickstart/src/main/resources/workspace/skills/query-writing/SKILL.md
#	agentscope-examples/harness-examples/harness-quickstart/src/main/resources/workspace/skills/schema-exploration/SKILL.md
#	agentscope-examples/harness-examples/harness-quickstart/src/main/resources/workspace/subagents/query-optimizer.md
#	agentscope-examples/harness-examples/harness-quickstart/src/main/resources/workspace/subagents/schema-analyst.md
#	agentscope-examples/harness-examples/harness-sandbox/pom.xml
#	agentscope-examples/harness-examples/harness-sandbox/src/main/java/io/agentscope/examples/harness/sandbox/HarnessSandboxExampleApp.java
#	agentscope-examples/harness-examples/harness-sandbox/src/main/java/io/agentscope/examples/harness/sandbox/LocalFilesystemPersonalAssistantExample.java
#	agentscope-examples/harness-examples/harness-sandbox/src/main/java/io/agentscope/examples/harness/sandbox/RemoteFilesystemIsolationScopeExample.java
#	agentscope-examples/harness-examples/harness-sandbox/src/main/java/io/agentscope/examples/harness/sandbox/SandboxFilesystemIsolationScopeExample.java
#	agentscope-examples/harness-examples/harness-sandbox/src/main/java/io/agentscope/examples/harness/sandbox/support/InMemorySandbox.java
#	agentscope-examples/harness-examples/harness-sandbox/src/main/java/io/agentscope/examples/harness/sandbox/support/InMemorySandboxClient.java
#	agentscope-examples/harness-examples/harness-sandbox/src/main/java/io/agentscope/examples/harness/sandbox/support/InMemorySandboxFilesystemSpec.java
#	agentscope-examples/harness-examples/harness-sandbox/src/main/java/io/agentscope/examples/harness/sandbox/support/InMemorySandboxState.java
#	agentscope-examples/pom.xml
# Conflicts:
#	agentscope-core/src/main/java/io/agentscope/core/hook/PreCallEvent.java
#	agentscope-core/src/main/java/io/agentscope/core/memory/StaticLongTermMemoryHook.java
#	agentscope-core/src/test/java/io/agentscope/core/memory/StaticLongTermMemoryHookTest.java
#	agentscope-dependencies-bom/pom.xml
#	agentscope-distribution/agentscope-bom/pom.xml
#	pom.xml
@chickenlj chickenlj requested review from a team and Copilot May 7, 2026 23:59

Copilot AI left a comment

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@chickenlj chickenlj changed the title Introduce harness agent Introduce agentscope-harness module May 8, 2026
@chickenlj chickenlj merged commit 5c8e9e1 into main May 8, 2026
9 of 10 checks passed
liangxingguang pushed a commit to liangxingguang/agentscope-java that referenced this pull request May 21, 2026
This pull request introduces a new `agentscope-harness` module built
with the `Harness Engineering` practices.

## Purpose
agentscope-harness builds on agentscope-core with a higher-level agent
runtime for production-style assistants: workspace-first workflows,
pluggable execution environments, and richer memory/session tooling.

## Entry point
HarnessAgent wraps ReActAgent with opinionated defaults: hooks, toolkit
wiring, and configuration for workspace, skills, subagents, and
persistence.

## Key design ideas

* Workspace-centric context — Loads and injects workspace material (e.g.
AGENTS.md, MEMORY.md, knowledge) into the agent’s unified system message
via hooks such as WorkspaceContextHook.
* Pluggable filesystem — Abstracts file operations behind a filesystem
layer (local, sandbox-backed, remote/composite) so tools and agents
share one API regardless of where files actually live.
* Sandbox & isolation — Optional sandbox execution with lifecycle
management, state stores, and options for distributed deployments when
session/sandbox state must be shared across replicas.
* Session & persistence — WorkspaceSession, session trees, and hooks
(e.g. session persistence, traces) tie long-running work to durable
session state where configured.
* Memory operations — Memory flush/consolidation, compaction, and
eviction policies help keep context bounded; dedicated tools (e.g.
memory search/get) support retrieval over workspace memory files.
* Subagents — Declarative subagent specs, spawn/send/list tooling, and
background tasks for delegated or async work (SubagentsHook, task
repository).
* Relationship to core. Harness does not replace ReActAgent; it composes
it with extra hooks, tools, and backends so applications can adopt
“harness” behavior incrementally while staying aligned with core APIs
(Model, Toolkit, Session, hooks).

This pull request also includes significant enhancements to the
`ReActAgent` class, focusing on improved runtime context handling,
per-call system message management, and better integration of
hook-supplied tools.

* Runtime Context and System Message Handling
* Hook and Toolkit Integration
* General Refactoring and Minor Improvements

---------

Co-authored-by: fang-tech <tianyufang978@gmail.com>
Co-authored-by: Copilot <copilot@github.com>
@chickenlj chickenlj deleted the harness branch May 26, 2026 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants