{"record":{"id":"9109343fe67c8b04","repo":"NousResearch/hermes-agent","slug":"working-directory-is-not-supported-because-hermes","errorCode":null,"errorMessage":"working_directory is not supported because Hermes delegates use isolated task environments.","messagePattern":"working_directory is not supported because Hermes delegates use isolated task environments\\.","errorType":"exception","errorClass":"SubagentLifecycleError","httpStatus":null,"severity":"error","filePath":"agent/subagent_lifecycle.py","lineNumber":511,"sourceCode":"        ):\n            raise SubagentLifecycleError(\n                \"goal must be a non-empty string of at most 16000 characters.\"\n            )\n        if request.context is not None and (\n            not isinstance(request.context, str)\n            or len(request.context) > _MAX_CONTEXT_CHARS\n        ):\n            raise SubagentLifecycleError(\n                \"context must be a string of at most 32000 characters.\"\n            )\n        if request.role not in {\"leaf\", \"orchestrator\"}:\n            raise SubagentLifecycleError(\"role must be 'leaf' or 'orchestrator'.\")\n        if request.timeout_seconds is not None:\n            raise SubagentLifecycleError(\n                \"Per-launch timeout is not supported; configure delegation timeout explicitly.\"\n            )\n        if request.working_directory is not None:\n            raise SubagentLifecycleError(\n                \"working_directory is not supported because Hermes delegates use isolated task environments.\"\n            )\n        if request.blocked_tools:\n            raise SubagentLifecycleError(\n                \"Per-tool blocking is not supported; use allowed_toolsets. Hermes always blocks unsafe child tools.\"\n            )\n        try:\n            metadata_bytes = len(\n                json.dumps(dict(request.metadata), sort_keys=True).encode()\n            )\n        except (TypeError, ValueError) as exc:\n            raise SubagentLifecycleError(\"metadata must be JSON-serializable.\") from exc\n        if metadata_bytes > _MAX_METADATA_BYTES:\n            raise SubagentLifecycleError(\"metadata exceeds 8192 bytes.\")\n        if request.allowed_toolsets:\n            from toolsets import TOOLSETS\n\n            unknown = set(request.allowed_toolsets) - set(TOOLSETS)","sourceCodeStart":493,"sourceCodeEnd":529,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/agent/subagent_lifecycle.py#L493-L529","documentation":"Validation error from SubagentLifecycleManager._validate_request(): working_directory is intentionally unsupported because Hermes delegate children run in isolated task environments, not in a caller-chosen directory. Any non-None working_directory on the launch request is rejected before a child is built.","triggerScenarios":"Setting SubagentLaunchRequest(working_directory=\"/repo\") to make the child operate on a specific checkout; porting code from agent frameworks where cwd is a standard launch parameter; serializers that emit \"\" instead of None for unset strings.","commonSituations":"Wanting a subagent to work inside the current project directory; multi-repo workflows trying to pin each child to a repo; form/UI code defaulting optional strings to empty string rather than None.","solutions":["Drop working_directory (None) and put the directory path in the goal or context text so the child cds/reads there itself.","If children consistently need a project cwd, configure the delegation environment (terminal.cwd in config.yaml for messaging contexts) rather than per-launch.","Normalize empty strings to None when building requests from loose input: working_directory=wd or None."],"exampleFix":"# before\nrequest = SubagentLaunchRequest(goal=\"run tests\", working_directory=\"/src/app\")\n\n# after\nrequest = SubagentLaunchRequest(\n    goal=\"run the test suite in /src/app and report failures\",\n)","handlingStrategy":"validation","validationCode":"request = SubagentLaunchRequest(\n    goal=f\"{goal} (work in /src/app)\",\n    working_directory=None,  # never set this field\n)","typeGuard":null,"tryCatchPattern":"try:\n    manager.launch(request)\nexcept SubagentLifecycleError as exc:\n    if \"working_directory is not supported\" in str(exc):\n        request = dataclasses.replace(\n            request,\n            working_directory=None,\n            goal=f\"{request.goal} (work in {request.working_directory})\",\n        )\n        manager.launch(request)\n    else:\n        raise","preventionTips":["Children run in isolated environments — express location in goal/context text.","Normalize optional string fields to None (not \"\") when building requests from loose input.","Set persistent working directories via terminal.cwd in config.yaml."],"tags":["subagents","delegation","validation","working-directory"],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}