MCPcopy Create free account
hub / github.com/METR/vivaria / writeJSONToAgentContainer

Method writeJSONToAgentContainer

server/src/docker/agents.ts:871–877  ·  view source on GitHub ↗

Returns the full destination path of the file in the container.

(obj: any, agentContainerName: string, fqn: string)

Source from the content-addressed store, hash-verified

869
870 /** Returns the full destination path of the file in the container. */
871 private async writeJSONToAgentContainer(obj: any, agentContainerName: string, fqn: string) {
872 const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'vivaria-agent-temp-'))
873 const tempFile = path.join(tempDir, 'temp.json')
874 await fs.writeFile(tempFile, JSON.stringify(obj))
875
876 await this.docker.copy(tempFile, { containerName: agentContainerName, path: fqn, owner: 'agent' })
877 }
878
879 private async runWithPyhooksAgentOutput(
880 branchKey: BranchKey,

Callers 1

startAgentBgMethod · 0.95

Calls 1

copyMethod · 0.45

Tested by

no test coverage detected