[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"article-how-to-set-up-agentscope-java-harness-en":3,"article-related-how-to-set-up-agentscope-java-harness-en":31,"series-ai-agent-3277d511-db37-4457-845d-dc0cacb94585":83},{"id":4,"slug":5,"title":6,"content":7,"summary":8,"source":9,"source_url":10,"author":11,"image_url":12,"cover_image":12,"category":13,"language":14,"translated_content":11,"related_article_id":15,"keywords":16,"key_takeaways":23,"views":27,"created_at":28,"published_at":29,"topic_cluster_id":30},"3277d511-db37-4457-845d-dc0cacb94585","how-to-set-up-agentscope-java-harness-en","How to Set Up AgentScope Java Harness","\u003Cp data-speakable=\"summary\">This guide shows how to set up AgentScope Java Harness for workspace-driven agents.\u003C\u002Fp>\u003Cp>If you are building a Java \u003Ca href=\"\u002Ftag\u002Fagent\">agent\u003C\u002Fa> that must keep memory, isolate tools, and run across local or distributed environments, this guide is for you.\u003C\u002Fp>\u003Cp>By the end, you will have a working AgentScope Java Harness project with a structured workspace, persistent sessions, memory compaction, and a clear path to sub-agent orchestration.\u003C\u002Fp>\u003Ch2>Before you start\u003C\u002Fh2>\u003Cul>\u003Cli>Java 17+\u003C\u002Fli>\u003Cli>Maven 3.9+ or Gradle 8+\u003C\u002Fli>\u003Cli>AgentScope Java 1.1.0+\u003C\u002Fli>\u003Cli>Access to the AgentScope docs and GitHub repo: [docs](https:\u002F\u002Fagentscope.io\u002Fdocs) and [GitHub](https:\u002F\u002Fgithub.com\u002Fagentscope-ai\u002Fagentscope-java)\u003C\u002Fli>\u003Cli>An LLM API key for the model provider you plan to use\u003C\u002Fli>\u003Cli>A writable local directory for the workspace\u003C\u002Fli>\u003Cli>If you plan to test distributed storage, access to Redis, OSS, or another shared backend\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>Step 1: Create the project skeleton\u003C\u002Fh2>\u003Cp>Your first outcome is a clean Java project that can host the Harness runtime and example code.\u003C\u002Fp>\n\u003Cfigure class=\"my-6\">\u003Cimg src=\"https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1780877895888-vldr.png\" alt=\"How to Set Up AgentScope Java Harness\" class=\"rounded-xl w-full\" loading=\"lazy\" \u002F>\u003C\u002Ffigure>\n\u003Cpre>\u003Ccode>mkdir agentscope-harness-demo\ncd agentscope-harness-demo\nmvn -q archetype:generate \\\n  -DgroupId=dev.oracore \\\n  -DartifactId=agentscope-harness-demo \\\n  -DarchetypeArtifactId=maven-archetype-quickstart \\\n  -DinteractiveMode=false\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Then add the AgentScope Java dependency in your build file and confirm your project compiles.\u003C\u002Fp>\u003Cp>You should see a successful build with no missing-package errors, which means the Harness classes are available to your app.\u003C\u002Fp>\u003Ch2>Step 2: Define the workspace layout\u003C\u002Fh2>\u003Cp>Your next outcome is a structured workspace that stores persona, memory, knowledge, \u003Ca href=\"\u002Ftag\u002Fskills\">skills\u003C\u002Fa>, and sub-agent specs in one place.\u003C\u002Fp>\n\u003Cfigure class=\"my-6\">\u003Cimg src=\"https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1780877893185-rdp9.png\" alt=\"How to Set Up AgentScope Java Harness\" class=\"rounded-xl w-full\" loading=\"lazy\" \u002F>\u003C\u002Ffigure>\n\u003Cp>Create a workspace directory and seed the core files and folders that Harness expects.\u003C\u002Fp>\u003Cpre>\u003Ccode>mkdir -p .agentscope\u002Fworkspace\u002F{knowledge,skills,subagents,agents}\ntouch .agentscope\u002Fworkspace\u002FAGENTS.md\nprintf '# Agent persona\\n- Be concise\\n- Keep state in workspace\\n' &gt; .agentscope\u002Fworkspace\u002FAGENTS.md\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Write a few stable rules into \u003Ccode>AGENTS.md\u003C\u002Fcode>, because this file becomes the source of truth for the agent’s behavior.\u003C\u002Fp>\u003Cp>You should see the workspace folders on disk, and \u003Ccode>AGENTS.md\u003C\u002Fcode> should contain readable instructions that your agent can load on startup.\u003C\u002Fp>\u003Ch2>Step 3: Build the HarnessAgent\u003C\u002Fh2>\u003Cp>Your next outcome is a runnable agent entrypoint that loads workspace context and can persist state between calls.\u003C\u002Fp>\u003Cpre>\u003Ccode>HarnessAgent agent = HarnessAgent.builder()\n    .name(\"my-agent\")\n    .model(model)\n    .workspace(Paths.get(\".agentscope\u002Fworkspace\"))\n    .compaction(CompactionConfig.builder()\n        .triggerMessages(50)\n        .keepMessages(20)\n        .build())\n    .build();\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Pair the agent with a runtime context that includes a stable session ID and, for multi-user systems, a user ID.\u003C\u002Fp>\u003Cpre>\u003Ccode>RuntimeContext ctx = RuntimeContext.builder()\n    .sessionId(\"user-session-001\")\n    .userId(\"alice\")\n    .build();\n\nMsg reply = agent.call(userMessage, ctx).block();\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>You should see the first reply return normally, and the workspace should begin filling with session and memory artifacts.\u003C\u002Fp>\u003Ch2>Step 4: Persist sessions and memory\u003C\u002Fh2>\u003Cp>Your next outcome is durable continuity, so the agent can resume the same conversation after a restart or a new request.\u003C\u002Fp>\u003Cp>Run two calls with the same \u003Ccode>sessionId\u003C\u002Fcode>, then inspect the workspace for session history and memory files.\u003C\u002Fp>\u003Cpre>\u003Ccode># after running the app twice with the same sessionId\nfind .agentscope\u002Fworkspace -maxdepth 4 | sort\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Look for session state under \u003Ccode>agents\u002F...\u002Fcontext\u002F\u003C\u002Fcode>, conversation logs under \u003Ccode>sessions\u002F\u003C\u002Fcode>, and memory files under \u003Ccode>memory\u002F\u003C\u002Fcode>.\u003C\u002Fp>\u003Cp>You should see that the second call continues the earlier conversation instead of starting from scratch, which proves state recovery is working.\u003C\u002Fp>\u003Ch2>Step 5: Add sandbox or filesystem backends\u003C\u002Fh2>\u003Cp>Your next outcome is a storage and execution layer that can switch from local disk to shared storage or sandboxed execution without changing agent logic.\u003C\u002Fp>\u003Cp>Configure the abstract filesystem backend that matches your deployment shape. Use local storage for development, remote storage for distributed replicas, and sandbox storage when you need isolation.\u003C\u002Fp>\u003Cpre>\u003Ccode>\u002F\u002F Pseudocode: choose the backend that matches your environment\nFilesystem fs = FilesystemFactory.local(Paths.get(\".agentscope\u002Fworkspace\"));\n\u002F\u002F or remote \u002F sandbox implementations when deployed\n\nagent = HarnessAgent.builder()\n    .filesystem(fs)\n    .workspace(Paths.get(\".agentscope\u002Fworkspace\"))\n    .build();\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>When you switch backends, your agent code should stay the same while file reads, writes, and tool execution route through the new storage layer.\u003C\u002Fp>\u003Cp>You should be able to move from a laptop run to a shared backend and still read the same workspace files, which confirms the abstraction is working.\u003C\u002Fp>\u003Ch2>Step 6: Split work into sub-agents\u003C\u002Fh2>\u003Cp>Your final outcome is a harness that can delegate long or parallel work to sub-agents without turning the main agent into a monolith.\u003C\u002Fp>\u003Cp>Define a sub-agent in code or in \u003Ccode>workspace\u002Fsubagents\u002F\u003C\u002Fcode>, then call it synchronously for blocking tasks or asynchronously for long-running jobs.\u003C\u002Fp>\u003Cpre>\u003Ccode>\u002F\u002F Pseudocode for delegation\nSubAgentSpec spec = SubAgentSpec.builder()\n    .name(\"researcher\")\n    .description(\"Research and summarize\")\n    .build();\n\nagent = HarnessAgent.builder()\n    .subagent(spec)\n    .build();\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>You should see the sub-agent appear in the workspace or runtime registry, and delegated work should return results back to the parent agent in a controlled way.\u003C\u002Fp>\u003Ctable>\u003Cthead>\u003Ctr>\u003Cth>Metric\u003C\u002Fth>\u003Cth>Before\u002FBaseline\u003C\u002Fth>\u003Cth>After\u002FResult\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>Context handling\u003C\u002Ftd>\u003Ctd>Single growing prompt\u003C\u002Ftd>\u003Ctd>Compacted context with retained recent messages\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>State persistence\u003C\u002Ftd>\u003Ctd>Lost on restart\u003C\u002Ftd>\u003Ctd>Recovered from workspace session files\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Execution safety\u003C\u002Ftd>\u003Ctd>Tools run on host process\u003C\u002Ftd>\u003Ctd>Tools can run in isolated sandbox\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Deployment fit\u003C\u002Ftd>\u003Ctd>Local-only directory\u003C\u002Ftd>\u003Ctd>Local, remote, or sandbox filesystem backends\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch2>Common mistakes\u003C\u002Fh2>\u003Cul>\u003Cli>Using a new \u003Ccode>sessionId\u003C\u002Fcode> on every request. Fix: keep the same \u003Ccode>sessionId\u003C\u002Fcode> for one conversation so Harness can restore state.\u003C\u002Fli>\u003Cli>Skipping the workspace structure. Fix: create \u003Ccode>AGENTS.md\u003C\u002Fcode>, \u003Ccode>memory\u002F\u003C\u002Fcode>, \u003Ccode>knowledge\u002F\u003C\u002Fcode>, \u003Ccode>skills\u002F\u003C\u002Fcode>, and \u003Ccode>subagents\u002F\u003C\u002Fcode> before the first run.\u003C\u002Fli>\u003Cli>Running untrusted commands on the host. Fix: enable sandbox execution or use a backend that isolates tools from the main process.\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>What's next\u003C\u002Fh2>\u003Cp>Once the basic harness is working, deepen it by adding custom memory consolidation, distributed filesystem adapters, and sub-agent workflows for tasks like data analysis, SRE automation, or coding assistants.\u003C\u002Fp>","This guide shows how to set up AgentScope Java Harness for workspace-driven agents.","zhuanlan.zhihu.com","https:\u002F\u002Fzhuanlan.zhihu.com\u002Fp\u002F2043265948854047649",null,"https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1780877895888-vldr.png","ai-agent","en","823f413f-0504-425c-a8de-956a60754b9d",[17,18,19,20,21,22],"AgentScope","Java","harness framework","workspace","sandbox","sub-agents",[24,25,26],"Use a workspace as the agent’s source of truth for persona, memory, and skills.","Keep session IDs stable so conversations can resume across requests and restarts.","Use abstract filesystem and sandbox backends to move from local demos to distributed deployments.",0,"2026-06-08T00:17:46.960531+00:00","2026-06-08T00:17:46.951+00:00","b15e1e23-2951-4204-aecd-e71b56118436",{"tags":32,"relatedLang":42,"relatedPosts":46},[33,35,36,38,40],{"name":17,"slug":34},"agentscope",{"name":21,"slug":21},{"name":18,"slug":37},"java",{"name":39,"slug":20},"Workspace",{"name":19,"slug":41},"harness-framework",{"id":15,"slug":43,"title":44,"language":45},"how-to-set-up-agentscope-java-harness-zh","怎麼設定 AgentScope Java Harness","zh",[47,53,59,65,71,77],{"id":48,"slug":49,"title":50,"cover_image":51,"image_url":51,"created_at":52,"category":13},"487edd3a-bc1d-4a3b-af82-b304fcb024f6","reid-hoffman-leaves-microsoft-board-manus-ai-en","Reid Hoffman leaves Microsoft board for Manus AI","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1780827472278-elag.png","2026-06-07T10:17:21.75719+00:00",{"id":54,"slug":55,"title":56,"cover_image":57,"image_url":57,"created_at":58,"category":13},"9ed3ac8c-2c79-40ae-982e-bf0450bf40dd","how-to-understand-codex-chatgpt-merge-en","How to understand the Codex and ChatGPT merge","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1780704170924-8s6e.png","2026-06-06T00:02:26.372215+00:00",{"id":60,"slug":61,"title":62,"cover_image":63,"image_url":63,"created_at":64,"category":13},"39acb8a3-431d-49bc-b3ff-aa74800eabfa","how-to-set-up-openclaw-safely-en","How to Set Up OpenClaw Safely","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1780549364539-93vi.png","2026-06-04T05:02:21.766703+00:00",{"id":66,"slug":67,"title":68,"cover_image":69,"image_url":69,"created_at":70,"category":13},"c1f893c0-912a-4061-b54c-df6add870669","aws-devops-agent-turns-incident-chaos-into-triage-en","AWS DevOps Agent turns incident chaos into triage","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1780466635494-xd0l.png","2026-06-03T06:03:14.824713+00:00",{"id":72,"slug":73,"title":74,"cover_image":75,"image_url":75,"created_at":76,"category":13},"5b873eea-a5c8-4e78-9509-e2d904934303","kimi-k26-live-300-agent-workflows-en","Kimi K2.6 goes live with 300-agent workflows","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1780430570173-x78p.png","2026-06-02T20:02:25.552333+00:00",{"id":78,"slug":79,"title":80,"cover_image":81,"image_url":81,"created_at":82,"category":13},"07ab6616-cd42-492d-be78-cab0bfd753fb","how-to-take-a-sabbatical-at-openai-en","How to Take a Sabbatical at OpenAI","https:\u002F\u002Fxxdpdyhzhpamafnrdkyq.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Fcovers\u002Finline-1780398173367-8lyd.png","2026-06-02T11:02:26.247565+00:00",[84,89,94,99,104,109,114,119,124,129],{"id":85,"slug":86,"title":87,"created_at":88},"03db8de8-8dc2-4ac1-9cf7-898782efbb1f","anthropic-claude-ai-agent-task-automation-en","Anthropic's Claude AI Agent: A New Era of Task Automation","2026-03-25T16:25:06.513026+00:00",{"id":90,"slug":91,"title":92,"created_at":93},"045d1abc-190d-4594-8c95-91e2a26f0c5a","googles-2026-ai-agent-report-decoded-en","Google’s 2026 AI Agent Report, Decoded","2026-03-26T11:15:23.046616+00:00",{"id":95,"slug":96,"title":97,"created_at":98},"e64aba21-254b-4f93-aa21-837484bb52ec","kimi-k25-review-stronger-still-not-legend-en","Kimi K2.5 review: stronger, still not a legend","2026-03-27T07:15:55.385951+00:00",{"id":100,"slug":101,"title":102,"created_at":103},"30dfb781-a1b2-4add-aebe-b3df40247c37","claude-code-controls-mac-desktop-en","Claude Code now controls your Mac desktop","2026-03-28T03:01:59.384091+00:00",{"id":105,"slug":106,"title":107,"created_at":108},"254405b6-7833-4800-8e13-f5196deefbe6","cloudflare-100x-faster-ai-agent-sandbox-en","Cloudflare’s 100x Faster AI Agent Sandbox","2026-03-28T03:09:44.356437+00:00",{"id":110,"slug":111,"title":112,"created_at":113},"04f29b7f-9b91-4306-89a7-97d725e6e1ba","openai-backs-isara-agent-swarm-bet-en","OpenAI backs Isara’s agent-swarm bet","2026-03-28T03:15:27.849766+00:00",{"id":115,"slug":116,"title":117,"created_at":118},"3b0bf479-e4ae-4703-9666-721a7e0cdb91","openai-plan-automated-ai-researcher-en","OpenAI’s plan for an automated AI researcher","2026-03-28T03:17:42.312819+00:00",{"id":120,"slug":121,"title":122,"created_at":123},"fe91bce0-b85d-4efa-a207-24ae9939c29f","harness-engineering-ai-agent-reliability-2026","Harness Engineering: From Bridle to Operating System, The Missing Link in AI Agent Reliability","2026-03-31T06:36:55.648751+00:00",{"id":125,"slug":126,"title":127,"created_at":128},"7a09007d-820f-43b3-8607-8ad1bfcb94c8","mcp-explained-from-prompts-to-production-en","MCP Explained: From Prompts to Production","2026-04-01T09:24:40.089177+00:00",{"id":130,"slug":131,"title":132,"created_at":133},"116d5ee9-a4f1-4b5a-aac5-5d035dd22bbe","amazon-bedrock-agents-multi-agent-workflows-en","Amazon Bedrock Agents Gets Multi-Agent Workflows","2026-04-01T09:30:30.197685+00:00"]